Population Genetics Simulator
Wright-Fisher model - drift, selection, mutation, migration, and bottlenecks
About this model
Each generation, forces are applied in order:
- Selection (diploid): p′ = (p²wAA + p(1−p)wAa) / w̄ where wAA = 1+s, wAa = 1+hs, waa = 1
- Mutation: p′ = p(1−μ) + (1−p)ν
- Migration (island model): p′ = p(1−m) + mpm
- Drift: sample 2Ne alleles from Binomial(2Ne, p)
Trajectories stop at fixation (p = 1) or loss (p = 0). A bottleneck replaces Ne with Nbottle for a single generation. The dashed amber line marks the bottleneck generation.
Sex Chromosome mode tracks three allele frequencies per replicate: pdip (sex chromosome in diploid homogametic sex), phap (sex chromosome in hemizygous heterogametic sex), psec (secondary chromosome: Y or W). The solid trajectory shows the overall population-level frequency p = (2pdip + phap + psec) / 4. Selection in the hemizygous sex is fully exposed (no dominance). Recombination rate r mixes allele pools between the sex chromosome and secondary chromosome in the heterogametic sex each generation. At r = 0.5 (pseudoautosomal), behavior converges to the autosomal model. Drift is applied separately to each chromosome class: 2×(Ne/2) alleles for the diploid sex, and 1×(Ne/2) each for the hemizygous sex's sex chromosome and secondary chromosome, giving effective population size Ne,X ≈ ¾Ne.