Quetzal-CoaTL
The Coalescence Template Library
Loading...
Searching...
No Matches
kingman.hpp
1// Copyright 2021 Arnaud Becheler <abechele@umich.edu>
2
3/*********************************************************************** * This program is free software; you can
4 *redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free
5 *Software Foundation; either version 2 of the License, or * (at your option) any later version. *
6 * *
7 ***************************************************************************/
8
9#ifndef __DISCRETE_WRIGHT_FISHER_H_INCLUDED__
10#define __DISCRETE_WRIGHT_FISHER_H_INCLUDED__
11
12#include <quetzal.hpp>
13
14using namespace quetzal::units;
15
16namespace quetzal
17{
18int sampling_size = 10;
19using haplotype = int;
20constexpr std::vector<haplotype> sample(0, sampling_size);
21constexpr auto L = 100 q_bp;
22constexpr auto mu = mutation_rate(10⁻9 q_mutations / q_generation / q_bp);
23
24// define a model of demography and reproduction, equivalently assumptions = wright_fisher
25assumptions =
26 {
27 panmixia, diploidy, discrete_time, constant_population_size, neutral, non_overlapping_generation_times,
28}
29
30// define a data generation process
31generative_model = {draw, number_of_remaining_lineages, infinite_site_model}
32
33summary = {TajimasD}
34
35// assumptions induce a law on gene genealogies
36auto genealogical_law = gene_genealogy::induce_law_from(assumptions);
37static_assert(genealogical_law == wright_fisher);
38
40
41distribution_of_number_of_offspring Binomial(2N, 1/2N)
42prob. of coalescence in previous generation 1/(2N)
43average coalescence time for 2 individuals: T = 2N
44time since last common ancestor: T generations
45mean fraction of sites differing between 2 individuals: π = 2µT.
46average diversity: π = 2Tµ = 2.2N.µ = 4Nµ = θ
47θ: scaled mutation rate (N and µ are confounded)
48effective_population_size
49census_size
50prob. of coalescence in t generations (1 − 1/(2N)) ^ t−1 (1/(2N))
51t has a geometric distribution
52
53} // namespace quetzal
54
55#endif
Compile-time unit quantities for coalescence.
Definition units.hpp:30
Simulation of coalescence-based models of molecular evolution.
Definition coalescence.hpp:21
Definition landscape_quantities.hpp:31