A library for working with phylogenetic and population genetic data.
v0.27.0
population/functions/functions.cpp File Reference
#include "genesis/population/functions/functions.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

std::pair< char, double > consensus (BaseCounts const &sample)
 Consensus character for a BaseCounts, and its confidence. More...
 
std::pair< char, double > consensus (BaseCounts const &sample, BaseCountsStatus const &status)
 Consensus character for a BaseCounts, and its confidence. More...
 
size_t get_base_count (BaseCounts const &bc, char base)
 Get the count for a base given as a char. More...
 
char guess_alternative_base (Variant const &variant, bool force=true)
 Guess the alternative base of a Variant. More...
 
char guess_reference_base (Variant const &variant)
 Guess the reference base of a Variant. More...
 
BaseCounts merge (BaseCounts const &p1, BaseCounts const &p2)
 Merge the counts of two BaseCountss. More...
 
BaseCounts merge (std::vector< BaseCounts > const &p)
 Merge the counts of a vector BaseCountss. More...
 
void merge_inplace (BaseCounts &p1, BaseCounts const &p2)
 Merge the counts of two BaseCountss, by adding the counts of the second (p2) to the first (p1). More...
 
template<typename T >
std::array< size_t, 4 > nucleotide_sorting_order_ (std::array< T, 4 > const &values)
 Local helper function that runs a sorting network to sort four values, coming from the four nucleotides. More...
 
std::ostream & operator<< (std::ostream &os, BaseCounts const &bs)
 Output stream operator for BaseCounts instances. More...
 
std::pair< SortedBaseCounts, SortedBaseCounts > sorted_average_base_counts (BaseCounts const &sample_a, BaseCounts 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...
 
SortedBaseCounts sorted_base_counts (BaseCounts const &sample)
 Return the order of base counts (nucleotides), largest one first. More...
 
SortedBaseCounts sorted_base_counts (Variant const &variant, bool reference_first)
 Get a list of bases sorted by their counts. More...
 
BaseCountsStatus status (BaseCounts const &sample, size_t min_coverage=0, size_t max_coverage=0, size_t min_count=0, bool tolerate_deletions=false)
 Compute a simple status with useful properties from the counts of a BaseCounts. More...
 
BaseCounts total_base_counts (Variant const &variant)
 Get the summed up total base counts of a Variant. More...