How Natural Selection Shapes Allele Frequencies
Natural selection is the differential survival and reproduction of organisms due to heritable variation in fitness. At the genetic level, this process changes allele frequencies across generations — the fundamental mechanism of adaptive evolution. This simulator implements the classic one-locus, two-allele model with viability selection, building on the Hardy-Weinberg framework first established independently by G.H. Hardy and Wilhelm Weinberg in 1908.
The Hardy-Weinberg Selection Model
In a diploid population with two alleles (A and a) at a single locus, the genotype frequencies after random mating follow Hardy-Weinberg proportions: freq(AA) = p², freq(Aa) = 2pq, freq(aa) = q², where p is the frequency of allele A and q = 1 - p. When genotypes differ in fitness (denoted w_AA, w_Aa, w_aa), the allele frequency in the next generation becomes:
p' = (p²·w_AA + p·q·w_Aa) / w̄
where w̄ = p²·w_AA + 2pq·w_Aa + q²·w_aa is the mean population fitness. This deceptively simple equation captures the essence of Darwinian selection at the molecular level.
Types of Selection
Directional selection occurs when one homozygote has the highest fitness. If w_AA > w_Aa > w_aa, allele A increases to fixation. The rate depends on the magnitude of fitness differences — try setting w_aa = 0.8 to see moderate directional selection in action.
Overdominance (heterozygote advantage) arises when w_Aa > w_AA and w_Aa > w_aa. This maintains a stable polymorphism with both alleles persisting indefinitely. The classic example is sickle-cell anemia: heterozygous carriers (Aa) resist malaria better than either homozygote. Try w_AA = 0.9, w_Aa = 1.0, w_aa = 0.7 to observe this.
Underdominance occurs when the heterozygote has the lowest fitness (w_Aa < w_AA and w_Aa < w_aa), creating an unstable equilibrium. The allele frequency will move toward whichever homozygote it is closer to.
Key Observations
Adjust the fitness values and initial frequency to explore: (1) How the selection coefficient affects the speed of allele frequency change — even small fitness differences compound over many generations. (2) How initial allele frequency matters — rare beneficial alleles take longer to establish. (3) The dramatic difference between additive, dominant, and recessive selection in their dynamics. R.A. Fisher's Fundamental Theorem of Natural Selection (1930) states that the rate of increase in mean fitness equals the additive genetic variance in fitness — a principle directly observable in this simulation.