A library for working with phylogenetic and population genetic data.
v0.27.0
diversity.hpp File Reference
#include "genesis/population/functions/filter_transform.hpp"
#include "genesis/population/functions/functions.hpp"
#include "genesis/population/variant.hpp"
#include "genesis/utils/containers/filter_iterator.hpp"
#include "genesis/utils/containers/matrix.hpp"
#include "genesis/utils/containers/transform_iterator.hpp"
#include <cassert>
#include <cmath>
#include <cstdint>
#include <iterator>
#include <string>
#include <type_traits>
#include <vector>

Go to the source code of this file.

Classes

struct  PoolDiversityResults
 Data struct to collect all diversity statistics computed by pool_diversity_measures(). More...
 
struct  PoolDiversitySettings
 Settings used by different pool-sequencing corrected diversity statistics. More...
 

Namespaces

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

Functions

double a_n (size_t n)
 Compute a_n, the sum of reciprocals. More...
 
double alpha_star (double n)
 Compute alpha* according to Achaz 2008 and Kofler et al. 2011. More...
 
double b_n (size_t n)
 Compute b_n, the sum of squared reciprocals. More...
 
double beta_star (double n)
 Compute beta* according to Achaz 2008 and Kofler et al. 2011. More...
 
double f_star (double a_n, double n)
 Compute f* according to Achaz 2008 and Kofler et al. 2011. More...
 
double heterozygosity (BaseCounts const &sample, bool with_bessel=false)
 Compute classic heterozygosity. More...
 
double n_base (size_t coverage, size_t poolsize)
 Compute the n_base term used for Tajima's D in Kofler et al. 2011, using a faster closed form expression. More...
 
double n_base_matrix (size_t coverage, size_t poolsize)
 Compute the n_base term used for Tajima's D in Kofler et al. 2011, following their approach. More...
 
template<class ForwardIterator >
PoolDiversityResults pool_diversity_measures (PoolDiversitySettings const &settings, ForwardIterator begin, ForwardIterator end)
 Compute Theta Pi, Theta Watterson, and Tajia's D in their pool-sequencing corrected versions according to Kofler et al. More...
 
template<class ForwardIterator >
double tajima_d_pool (PoolDiversitySettings const &settings, ForwardIterator begin, ForwardIterator end)
 Compute the pool-sequencing corrected version of Tajima's D according to Kofler et al. More...
 
template<class ForwardIterator >
double tajima_d_pool (PoolDiversitySettings const &settings, ForwardIterator begin, ForwardIterator end, double theta_pi, double theta_watterson)
 Compute the pool-sequencing corrected version of Tajima's D according to Kofler et al. More...
 
double tajima_d_pool_denominator (PoolDiversitySettings const &settings, size_t snp_count, double theta)
 Compute the denominator for the pool-sequencing correction of Tajima's D according to Kofler et al. More...
 
template<class ForwardIterator >
double theta_pi (ForwardIterator begin, ForwardIterator end, bool with_bessel=true)
 Compute classic theta pi, that is, the sum of heterozygosities. More...
 
double theta_pi_pool (PoolDiversitySettings const &settings, BaseCounts const &sample)
 Compute theta pi with pool-sequencing correction according to Kofler et al, for a single BaseCounts, that is, its heterozygosity() including Bessel's correction for the total nucleotide count at each position, divided by the correction denominator. More...
 
template<class ForwardIterator >
double theta_pi_pool (PoolDiversitySettings const &settings, ForwardIterator begin, ForwardIterator end)
 Compute theta pi with pool-sequencing correction according to Kofler et al, that is, the sum of heterozygosities divided by the correction denominator. More...
 
double theta_pi_pool_denominator (PoolDiversitySettings const &settings, size_t nucleotide_count)
 Compute the denominator for the pool-sequencing correction of theta pi according to Kofler et al. More...
 
template<class ForwardIterator >
double theta_pi_within_pool (ForwardIterator begin, ForwardIterator end, size_t poolsize)
 Compute classic theta pi (within a population), that is, the sum of heterozygosities including Bessel's correction for total nucleotide sum at each position, and Bessel's correction for the pool size. More...
 
template<class ForwardIterator >
double theta_watterson_pool (PoolDiversitySettings const &settings, ForwardIterator begin, ForwardIterator end)
 Compute theta watterson with pool-sequencing correction according to Kofler et al. More...
 
double theta_watterson_pool_denominator (PoolDiversitySettings const &settings, size_t nucleotide_count)
 Compute the denominator for the pool-sequencing correction of theta watterson according to Kofler et al. More...