libsequence
1.9.5
|
Matrix representation of variation data. More...
#include <VariantMatrix.hpp>
Public Types | |
using | value_type = std::int8_t |
Public Member Functions | |
template<typename data_input , typename positions_input > | |
VariantMatrix (data_input &&data_, positions_input &&positions_, const std::int8_t max_allele_value=-1) | |
"Perfect-forwarding" constructor. More... | |
std::int8_t & | get (const std::size_t site, const std::size_t haplotype) |
Get data from marker site and haplotype haplotype . No range-checking is done. | |
const std::int8_t & | get (const std::size_t site, const std::size_t haplotype) const |
Get data from marker site and haplotype haplotype . No range-checking is done. | |
std::int8_t & | at (const std::size_t site, const std::size_t haplotype) |
Get data from marker site and haplotype haplotype . std::out_of_range is thrown if indexes are invalid. | |
const std::int8_t & | at (const std::size_t site, const std::size_t haplotype) const |
Get data from marker site and haplotype haplotype . std::out_of_range is thrown if indexes are invalid. | |
Public Attributes | |
std::vector< std::int8_t > | data |
Data stored in matrix form with rows as sites. | |
std::vector< double > | positions |
Position of sites. | |
std::size_t | nsites |
Number of sites in data set. | |
std::size_t | nsam |
Sample size of data set. | |
const std::int8_t | max_allele |
Max allelic value stored in matrix. | |
Static Public Attributes | |
static const std::int8_t | mask = std::numeric_limits<std::int8_t>::min() |
Reserved value for masked data. | |
Matrix representation of variation data.
The data structure is a row-major matrix. Variants are represented by 8-bit integers. Negative values represent missing data, thus allowing up to 128 non-missing states per variable site.
Rows are sites, columns are either haplotypes or are populated as necessary in the case of genotype (unphased) data. Storing variable sites in rows places the performance priority on sites over haplotypes.
The only reserved character state is std::numeric_limits<std::int8_t>::min(), which is used to represent masked data. That reserved value is VariantMatrix::mask, which is a static constant.
\version 1.9.2
Definition at line 22 of file VariantMatrix.hpp.
using Sequence::VariantMatrix::value_type = std::int8_t |
The value type of the data. Helpful for generic programming
Definition at line 78 of file VariantMatrix.hpp.
|
inline |
"Perfect-forwarding" constructor.
std::invalid_argument will be thrown if data.size() % positions.size() != 0.0.
Definition at line 82 of file VariantMatrix.hpp.