Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

Finite Sampling, Genetic Drift, and Mutation

Reproduce the simulations in Lecture 8. Each section names the corresponding slide. NN counts diploid individuals, KtK_t counts allele copies, and pt=Kt/(2N)p_t=K_t/(2N). The probability-model calculations are supplied by hpgR.

Draw the Next Generation in R

Five diploid individuals carry three AA copies. Independently sample ten parental copies, with replacement. Then Kt+1∣pt=0.3K_{t+1}\mid p_t=0.3 is binomial with size 10 and probability 0.3.

Loading...
Plot with title “1000 offspring copies”

Sampling Builds a New Generation

Regenerate the two sampling animations using their original code and seed. The ten explicit draws become the first update of the N=5N=5 path. Population Size Changes the Rate of Drift uses these same paths. The infinite-population limit keeps p=0.3p=0.3.

Plot with title “Ten draws with replacement”

Buri’s Experiment Tests the Sampling Model

The Buri comparison in the lecture follows generations 0–19. Here 105 simulated cultures start at p0=0.5p_0=0.5, with N=16N=16. Every column is an independent culture; every row is a generation. These are model draws, not Buri’s observed cultures. The second notebook reuses these records. The panels show generations 1–19 after the identical starting state.

Plot with title “105 simulated cultures”

Frequency Differences Accumulate across Generations

Reproduce the lecture’s curves at p0=0.5p_0=0.5, N=16,100N=16,100:

Vt=p0(1−p0)[1−(1−1/(2N))t],Ht=2p0(1−p0)(1−1/(2N))t.V_t=p_0(1-p_0)[1-(1-1/(2N))^t],\qquad H_t=2p_0(1-p_0)(1-1/(2N))^t.

These are expectations across replicate populations, not individual paths.

plot without title

Population Recovery Copies the Surviving Alleles

Reproduce the bottleneck animation: five states at N=10N=10, two at N=3N=3, then five at N=10N=10. Generation 0 contains 20 different founder alleles. Mutation is off. The code records each parental-copy choice.

plot without title

The Fate of a New Mutation

Recreate the setting of Pritchard’s Fig. 2.9: 200 independent new mutations introduced at random generations, each starting as one of 100 copies (2N=1002N=100, as labeled in the figure). Use a new seed, so these are new trajectories under the same model. Each lineage subsequently follows drift alone. Variants still segregating at generation 1000 remain unresolved.

Lost Fixed Still segregating 198 1 1
Loading...
plot without title

Mutation and Drift Keep Alleles Turning Over

Reproduce the animation at one locus: N=5N=5, μ=0.10\mu=0.10 per copy per generation, initially one allele. Every mutation receives a new allele ID. For the raw finite-pool diversity h=1−∑apa2h=1-\sum_a p_a^2, this model gives

E(ht+1∣ht)=(1−1/(2N))[1−(1−μ)2(1−ht)].E(h_{t+1}\mid h_t)=(1-1/(2N))[1-(1-\mu)^2(1-h_t)].

Here the update is 0.171+0.729ht0.171+0.729h_t. Its stationary mean is 171/271171/271. The lecture’s small-mutation approximation H≈4NμH\approx4N\mu does not apply at these settings; μ\mu here is per locus, not a human per-base rate.

plot without title

How Two Copies Become IBD

Reproduce the animation’s ten separately identified founder copies and recorded parental choices. The final pair was specified before simulation. Matching founder IDs measure founder-relative IBD; these IDs are retained simulation records, not IBD inferred from sequence similarity.

plot without title

Finite Inheritance Can Create LD

Reproduce the slide’s parental frequencies and displayed offspring draw. D=fAB−pApBD=f_{AB}-p_Ap_B. The offspring counts are a possible multinomial outcome, not a deterministic consequence of copying whole haplotypes.

Loading...
Loading...

Recombination Cuts the Shared Ancestral Segment

Reproduce the animation on a one-Morgan region, conditional on retaining the ancestral copy at its central site. Twelve meioses alternate between two descendant paths. Breakpoints follow a Poisson process with mean one per meiosis. This focal-containing interval is not a randomly chosen tract.

plot without title

Sources: Pritchard, Sec. 2.1 and Sec. 2.3; Gorroochurn, Secs. 8.2–8.9; Láruson and Reed, Ch. 6; Coop, Ch. 4. The six animation calculations use the lecture’s original state generators. The mutation trajectories recreate Fig. 2.9 with a new seed and uniformly sampled introduction times, using the plotted copy count 2N=1002N=100. The Buri comparison uses 105 simulated cultures and 19 updates; observed experimental frequencies are shown separately in the lecture.