Explore how selection, mutation, migration, and drift shift allele and genotype frequencies
In a large randomly mating population with no selection, mutation, migration, or drift, allele frequencies p and q remain constant across generations, and genotype frequencies reach equilibrium at p^2, 2pq, and q^2. Independently discovered by Hardy and Weinberg in 1908.
HWE requires: (1) Infinite population (no drift), (2) Random mating, (3) No selection, (4) No mutation, (5) No migration. Violating any assumption causes evolution. Toggle each force in the controls to observe its effect.
Different genotypes have different fitness values w. Selection shifts allele frequency in favor of advantageous alleles. When w(AA)=w(Aa)>w(aa), selection acts against the recessive homozygote. When w(AA)>w(Aa)>w(aa), incomplete dominance favors the dominant allele. Higher selection coefficients cause faster allele frequency changes.
Mutation rate mu causes allele A to mutate to a at probability mu per generation. With only one-way mutation, p gradually approaches 0. Mutation-selection balance is a key mechanism maintaining genetic variation: selection removes deleterious alleles while mutation continuously generates new variation.
Immigration introduces alleles from other populations. Migration rate m and migrant allele frequency p_m determine the direction and strength of gene flow. Gene flow reduces genetic differences between populations and counteracts local adaptation.
In finite populations, random sampling causes allele frequencies to fluctuate randomly. Smaller populations experience stronger drift. Drift ultimately leads to allele fixation (p=1) or loss (p=0). Try N=50 with drift enabled to observe rapid random fixation paths.
Start with HWE (no forces): p and q stay constant. Then enable one force at a time. Selection shifts p directionally. Mutation pushes p toward 0. Migration pulls p toward p_m. Drift causes random walks, stronger in small populations.
1) Set N=50, enable drift, run multiple times to see different fixation paths. 2) Set w(aa)=0.5, observe how fast the deleterious recessive allele is eliminated. 3) Enable mutation (mu=0.01) and selection (w(aa)=0.3) together to find mutation-selection balance. 4) Set migration (m=0.1, p_m=0.9) against selection to see which force dominates.