|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file.
44 namespace population {
53 for(
auto const& elem : set ) {
56 size_t len = elem.second.
size() - 1;
57 if( elem.second.size() == 0 ) {
60 result.
add( elem.first, len );
70 std::shared_ptr< utils::BaseInputSource > source,
78 throw std::invalid_argument(
79 "Fasta mask min value is " +
std::to_string( mask_min ) +
", but has to be in [0-9]."
86 throw std::runtime_error(
87 "Duplicate sequence name \"" + seq.label() +
"\" in " + source->source_name()
94 for(
size_t i = 0; i < seq.length(); ++i ) {
95 if( seq[i] <
'0' || seq[i] >
'9' ) {
96 throw std::runtime_error(
97 "Invalid mask code '" + std::string( 1, seq[i] ) +
"' not in [0-9] "
98 "in sequence \"" + seq.label() +
"\" in " + source->source_name()
103 size_t const val = seq[i] -
'0';
104 if( val > mask_min ) {
116 result.
add( seq.label(), bv );
GenomeLocusSet read_mask_fasta(std::shared_ptr< utils::BaseInputSource > source, size_t mask_min, bool invert)
Read an input source as a mask fasta file, and return its content as a GenomeLocusSet.
void add(Sequence const &sequence, bool also_look_up_first_word=true)
Add a Sequence to the dictionary.
Store dictionary/index data on sequence files, such as coming from .fai or .dict files.
bool has_chromosome(std::string const &chromosome) const
Return whether a chromosome is stored.
List of positions/coordinates in a genome, for each chromosome.
std::string to_string(GenomeLocus const &locus)
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
genesis::sequence::SequenceDict reference_locus_set_to_dict(GenomeLocusSet const &set)
void add(std::string const &chromosome)
Add a whole chromosome to the list, so that all its positions are considered to be covered.