A library for working with phylogenetic and population genetic data.
v0.32.0
population/function/functions.hpp File Reference
#include "genesis/population/filter/sample_counts_filter.hpp"
#include "genesis/population/sample_counts.hpp"
#include "genesis/population/variant.hpp"
#include "genesis/sequence/reference_genome.hpp"
#include "genesis/utils/text/char.hpp"
#include <array>
#include <iosfwd>
#include <utility>
#include <string>
#include <vector>

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...
 
constexpr bool is_valid_base (char c)
 Return whether a given base is in ACGT, case insensitive. More...
 
constexpr bool is_valid_base_or_n (char c)
 Return whether a given base is in ACGTN, case insensitive. 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...
 
SampleCounts merge_sample_counts (Variant const &v, SampleCountsFilterPolicy filter_policy)
 Merge the counts of a vector SampleCountss. More...
 
template<typename T >
std::array< size_t, 4 > nucleotide_sorting_order (std::array< T, 4 > const &values)
 Return the sorting order of four values, for instance of the four nucleotides ACGT, in descending order (largest first). More...
 
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, G, and T. More...
 
std::ostream & operator<< (std::ostream &os, SampleCounts const &bs)
 Output stream operator for SampleCounts instances. More...
 
template<typename T >
std::array< size_t, 6 > sample_counts_sorting_order (std::array< T, 6 > const &v)
 Return the sorting order of six values, for instance of the four nucleotides ACGT and the N and D counts of a SampleCounts object, in descending order (largest first). More...
 
constexpr size_t sample_counts_sum (SampleCounts const &sample)
 Sum up all the base counts at this sample, that is, the sum of all A, C, G, T, as well as the N and D count for indetermined and deleted counts. 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...
 
size_t total_nucleotide_sum (Variant const &variant, SampleCountsFilterPolicy filter_policy)
 Count of the pure nucleotide bases at this position, that is, the sum of all A, C, G, and T. More...
 
size_t total_sample_counts_sum (Variant const &variant, SampleCountsFilterPolicy filter_policy)
 Sum up all the base counts at this sample, that is, the sum of all A, C, G, T, as well as the N and D count for indetermined and deleted counts. More...