9 #include "stream_tools.h"
11 #include "file_index.h"
20 using Indexed_data::abs_pos_;
23 static Data * create(
const std::vector <std::string> & Columns){
24 return new Locus(Columns);
26 void write (std::ostream& out)
const;
27 void read (std::istream& in);
29 void write_binary (std::ostream& out)
const;
30 void read_binary (std::istream& in);
38 static const gt_t default_order[5];
41 Locus (
const count_t &);
43 Locus (
const std::vector<std::string> &);
51 const count_t
getindex(count_t)
const;
57 count_t
getcount(count_t, count_t)
const;
59 void swap(count_t, count_t);
80 void mask(
const std::vector <size_t> &);
81 void unmask(
const std::vector <size_t> &);
89 char getname(
const count_t &)
const;
101 void resize(
const size_t &);
107 inline std::vector <quartet_t>::iterator begin(
void) {
return sample.begin();};
110 inline std::vector <quartet_t>::iterator
116 inline std::vector <quartet_t>::const_iterator
122 inline std::vector <quartet_t>::const_iterator
128 inline std::vector <std::string>
147 std::string header(
void)
const;
148 size_t size(
void)
const;
150 static const std::string file_name;
151 static const std::string table_name;
152 static const bool binary;
154 const std::string get_file_name(
void)
const;
155 const std::string get_table_name(
void)
const;
156 const bool get_binary(
void)
const;
162 void sql_read(std::istream &)
override;
165 friend std::istream& mpileup (std::istream& in,
Locus& x,
const int &,
const int &);
166 friend void scan(
const Locus & site,
const std::string &str,
quartet_t &q);
std::vector< quartet_t >::const_iterator cend(void) const
Return an iterator to the quartet_t s stored at this Locus.
Definition: locus.h:122
A class converts human readable bases to bit flags.
Definition: base.h:16
const quartet_t & get_quartet(const count_t &) const
Returns the N'th quartet at the Locus.
Definition: locus.cc:253
void write(std::ostream &out) const
The write function must be defined in the child class.
Definition: locus.cc:280
void resize(const size_t &)
< Set the absolute position of the Locus.
Definition: locus.cc:267
std::vector< quartet_t >::iterator end(void)
Return an iterator to the quartet_t s stored at this Locus.
Definition: locus.h:110
A class that stores quartet information.
Definition: quartet.h:16
const std::string sql_column_names(void) const
Return the names of the columns.
Definition: locus.cc:407
Locus()
Locus is initialized to abs_pos_=0, id1=0, and set to contain 0 samples.
Definition: locus.cc:12
void unmaskall(void)
Unmask all lines.
Definition: locus.cc:97
std::vector< std::string > get_sample_names(void) const
names of the samples sequenced
Definition: locus.h:129
Data which has an absolute position.
Definition: data.h:144
std::vector< quartet_t > sample
The five bases A/C/G/T/N;.
Definition: locus.h:34
void set_extraid(const count_t &, const size_t &)
Set the extraid of the Locus. Just used to represent the reference call.
std::vector< quartet_t >::const_iterator cbegin(void) const
Return an iterator to the quartet_t s stored at this Locus.
Definition: locus.h:116
void swap(count_t, count_t)
Exchange the alleles.
Definition: locus.cc:184
count_t getcoverage(void) const
Returns total coverage.
Definition: locus.cc:231
std::vector< std::string > sample_names_
names of the samples sequenced.
Definition: locus.h:17
void sql_read(std::istream &) override
Reads the values...
Definition: locus.cc:412
char getname(const count_t &) const
Get the nucleotide represented by the count at the N'th indexed quartet_t.
count_t getcount(count_t) const
Returns the count of allele in all individuals in the population.
Definition: locus.cc:204
void set_abs_pos(const id1_t &)
Indexed data needs to associate each datum with a position in the genome.
Definition: data.cc:138
void unmask(const std::vector< size_t > &)
Unmask all lines.
Definition: locus.cc:116
gt_t sorted_[5]
an array to allow sorted access to quartets.
Definition: locus.h:33
void mask(const std::vector< size_t > &)
Mask all lines.
Definition: locus.cc:127
void set_quartet(const quartet_t &, const count_t &)
Sets the quartet_t array (unsorted).
Definition: locus.cc:246
void mask_low_cov(const count_t &dp)
Mask site with coverage stricktly lt dp;.
Definition: locus.cc:273
void read(std::istream &in)
The read function must be defined in the child class.
Definition: locus.cc:303
count_t maskedcount(void) const
Returns the count of the number of individuals that are masked.
Definition: locus.cc:136
const std::string sql_values(void) const
Return the values to be placed in columns.
Definition: locus.cc:430
id1_t get_abs_pos(void) const
Indexed data needs to associate each datum with a position in the genome.
Definition: data.cc:123
const count_t getindex(count_t) const
Returns the index of the alleles in order a sorted order.
Definition: locus.cc:197
count_t get_extraid(const size_t &) const
Get the extraid of the Locus. Used to represent the reference call.
A class which registers a child of Data in Data::new_data_.
Definition: data.h:222
void maskall(void)
Mask all lines.
Definition: locus.cc:107
const std::string sql_header(void) const
Return the names of the columns, along with variable type.
Definition: locus.cc:402
A class which can be written as flat text file or into an SQL database.
Definition: data.h:34
size_t size(void) const
The size of the class in bytes.
Definition: locus.cc:362
char getname_gt(const count_t &) const
Get the nucleotide represented by the count at the N'th indexed quartet_t, return * if the count equa...
void sort(void)
Sort counts from most common to least common (among all non-masked sites).
Definition: locus.cc:144
void set_sample_names(const std::vector< std::string > &sample_names)
names of the samples sequenced.
Definition: locus.h:136