Practical Evolution · ENTM 7230 · Population Genetics, Week 2
Breaking Hardy–Weinberg
Infinite population, random mating, no mutation, no selection — and nothing ever changes. This demo starts there, then hands you the switches for every assumption you're about to spend the next few weeks breaking.
Generation
0
Freq. of allele A (p)
0.500
F (departure from HW)
0.000
Population size
150
Genotype space (de Finetti diagram)
Dashed curve = every genotype composition consistent with Hardy-Weinberg proportions. On the curve: F ≈ 0. Above it (toward "all Aa"): heterozygote excess, F < 0. Below it (toward the base): heterozygote deficit, F > 0.
Genotype frequencies over time
AA Aa (observed) aa Aa expected under HW (2pq)
population = N adults (diploid genotypes)
for generation:
w = fitness(genotype) # selectionfor k in 1..N: # form N zygotesif random() < selfRate:
parent = weighted_choice(population, w)
gametes = two alleles from that one parent
else:
p1, p2 = weighted_choice(population, w), again
gametes = one allele from p1, one from p2
mutate(each gamete, rate=μ)
zygote[k] = combine(gametes)
population = weighted_resample(zygotes, w, N) # viability selection
record genotype frequencies, p, F
Break an assumption
Each card below is one Hardy-Weinberg assumption. The triangle and the dashed parabola are fixed reference geometry — turn a slider up from zero and watch the population's point pull away from the parabola, or slide along it.
Assumption: infinite population
Population size (N)
Small N means real sampling noise every generation — drift — even with random mating and no selection. Push N up toward the max to make drift negligible, so any departure from Hardy-Weinberg you see is coming from whatever other slider you've moved.
Assumption: random mating
Non-random mating (selfing rate)
Pulls genotype frequencies off the parabola toward the two homozygote corners — without moving p at all.
Assumption: no mutation
Mutation rate (μ)
Wildly exaggerated relative to real mutation rates (~10⁻⁸) so it's visible in a lecture — but it still only ever pushes p, and stays right on the parabola.