|
A library for working with phylogenetic and population genetic data.
v0.32.0
|
|
Go to the documentation of this file.
44 namespace population {
130 if( params.
only_snps && al_count_min < 2 ) {
146 if( params.
only_snps && al_count_min_max < 2 ) {
172 throw std::runtime_error(
173 "Invalid VariantFilterNumericalParams::snp_min_allele_frequency == " +
187 ref_cnt = sorted_counts[0].count;
188 alt_cnt = sorted_counts[1].count;
197 ref_cnt = sorted_counts[0].count;
198 alt_cnt = sorted_counts[1].count;
212 auto const cnt_sum = ref_cnt + alt_cnt;
213 auto const frequency =
static_cast<double>( ref_cnt ) /
static_cast<double>( cnt_sum );
214 assert( ! std::isfinite( frequency ) || ( frequency >= 0.0 && frequency <= 1.0 ));
218 ! std::isfinite( frequency ) ||
size_t snp_max_count
Maximum count for each nucleotide to be considered a SNP for the whole Variant.
@ kAboveSnpMaxCount
Sum of nucleotides is above VariantFilterNumericalParams::snp_max_count.
double sum(const Histogram &h)
@ kBelowMinAlleleFreq
Did not reach minimum allele frequency.
constexpr size_t nucleotide_sum(SampleCounts const &sample)
Count of the pure nucleotide bases at this position, that is, the sum of all A, C,...
size_t snp_min_count
Minimum count for each nucleotide to be considered a SNP for the whole Variant.
size_t allele_count(SampleCounts const &sample)
Return the number of alleles, that is, of non-zero nucleotide counts of the sample.
bool only_biallelic_snps
Filter if the Variant does not have exactly two alleles.
SampleCounts::size_type get_base_count(SampleCounts const &sample, char base)
Get the count for a base given as a char.
@ kNotBiallelicSnp
SNP position, but not biallelic, i.e., has more than one alternative.
size_t deletions_count_limit
Maximum number of deletions at a position before being filtered out.
std::string to_string(GenomeLocus const &locus)
constexpr char to_upper(char c) noexcept
Return the upper case version of a letter, ASCII-only.
@ kEmpty
All counts across all samples are zero.
size_t max_read_depth
Maximum read depth expected for the whole Variant to be considered covered.
@ kNotSnp
Invariant position, not a SNP.
SampleCounts merge_sample_counts(Variant const &v, SampleCountsFilterPolicy filter_policy)
Merge the counts of a vector SampleCountss.
constexpr bool is_valid_base(char c)
Return whether a given base is in ACGT, case insensitive.
A single variant at a position in a chromosome, along with SampleCounts for a set of samples.
Container namespace for all symbols of genesis in order to keep them separate when used as a library.
@ kBelowMinReadDepth
Sum of counts across all samples is below the min read depth threshold.
size_t min_read_depth
Minimum read depth expected for the whole Variant to be considered covered.
@ kAboveDeletionsCountLimit
Too many deletions at the position.
Counts of how many entries with a particular Filter Tag occured in some data.
bool apply_variant_filter_numerical(Variant &variant, VariantFilterNumericalParams const ¶ms, VariantFilterStats &stats)
Filter a given Variant based on the numerical properties of the counts.
SortedSampleCounts sorted_sample_counts(SampleCounts const &sample)
Return the order of base counts (nucleotides), largest one first.
@ kBelowSnpMinCount
Sum of nucleotides is below VariantFilterNumericalParams::snp_min_count.
bool only_snps
Filter if the Variant does not have two or more alleles.
@ kAboveMaxReadDepth
Sum of counts across all samples is above the max read depth threshold.
double snp_min_allele_frequency
Minimum allele frequency that needs to be achieved.