A library for working with phylogenetic and population genetic data.
v0.32.0
population/function/functions.cpp File Reference
#include "genesis/population/function/functions.hpp"
#include "genesis/sequence/functions/codes.hpp"
#include "genesis/utils/text/char.hpp"
#include <array>
#include <cassert>
#include <cstring>
#include <iostream>
#include <stdexcept>
#include <utility>

Go to the source code of this file.

Namespaces

 genesis
 Container namespace for all symbols of genesis in order to keep them separate when used as a library.
 
 genesis::population
 

Functions

size_t allele_count (SampleCounts const &sample)
 Return the number of alleles, that is, of non-zero nucleotide counts of the sample. More...
 
size_t allele_count (SampleCounts const &sample, size_t min_count)
 Return the number of alleles, taking a min_count into consideration, that is, we compute the number of nucleotide counts of the sample that are at least the min_count. More...
 
size_t allele_count (SampleCounts const &sample, size_t min_count, size_t max_count)
 Return the number of alleles, taking a min_count and max_count into consideration, that is, we compute the number of nucleotide counts of the sample that are at least min_count and at most max_count. More...
 
std::pair< char, double > consensus (SampleCounts const &sample)
 Consensus character for a SampleCounts, and its confidence. More...
 
std::pair< char, double > consensus (SampleCounts const &sample, bool is_covered)
 Consensus character for a SampleCounts, and its confidence. More...
 
SampleCounts::size_type get_base_count (SampleCounts const &sample, char base)
 Get the count for a base given as a char. More...
 
char guess_alternative_base (Variant const &variant, bool force=false, SampleCountsFilterPolicy filter_policy=SampleCountsFilterPolicy::kOnlyPassing)
 Guess the alternative base of a Variant. More...
 
void guess_and_set_ref_and_alt_bases (Variant &variant, bool force=false, SampleCountsFilterPolicy filter_policy=SampleCountsFilterPolicy::kOnlyPassing)
 Guess the reference and alternative bases for a Variant, and set them. More...
 
void guess_and_set_ref_and_alt_bases (Variant &variant, char ref_base, bool force=false, SampleCountsFilterPolicy filter_policy=SampleCountsFilterPolicy::kOnlyPassing)
 Guess the reference and alternative bases for a Variant, and set them, using a given reference base. More...
 
void guess_and_set_ref_and_alt_bases (Variant &variant, genesis::sequence::ReferenceGenome const &ref_genome, bool force=false, SampleCountsFilterPolicy filter_policy=SampleCountsFilterPolicy::kOnlyPassing)
 Guess the reference and alternative bases for a Variant, and set them, using a given reference genme to obtain the base. More...
 
char guess_reference_base (Variant const &variant, bool force=false, SampleCountsFilterPolicy filter_policy=SampleCountsFilterPolicy::kOnlyPassing)
 Guess the reference base of a Variant. More...
 
SampleCounts merge (SampleCounts const &p1, SampleCounts const &p2)
 Merge the counts of two SampleCountss. More...
 
SampleCounts merge (std::vector< SampleCounts > const &p, SampleCountsFilterPolicy filter_policy)
 Merge the counts of a vector SampleCountss. More...
 
void merge_inplace (SampleCounts &p1, SampleCounts const &p2)
 Merge the counts of two SampleCountss, by adding the counts of the second (p2) to the first (p1). More...
 
std::ostream & operator<< (std::ostream &os, SampleCounts const &bs)
 Output stream operator for SampleCounts instances. More...
 
void set_base_count (SampleCounts &sample, char base, SampleCounts::size_type value)
 Set the count for a base given as a char. More...
 
std::pair< SortedSampleCounts, SortedSampleCounts > sorted_average_sample_counts (SampleCounts const &sample_a, SampleCounts const &sample_b)
 Return the sorted base counts of both input samples, orderd by the average frequencies of the nucleotide counts in the two samples. More...
 
SortedSampleCounts sorted_sample_counts (SampleCounts const &sample)
 Return the order of base counts (nucleotides), largest one first. More...
 
SortedSampleCounts sorted_sample_counts (Variant const &variant, bool reference_first, SampleCountsFilterPolicy filter_policy)
 Get a list of bases sorted by their counts. More...
 
SortedSampleCounts sorted_sample_counts_ (Variant const &variant, bool reference_first, SampleCounts const &total)
 Local helper function that takes an already computed total from merge_sample_counts(), so that it can be re-used internally here. More...