SimuVeda

Biology · Simulator 031

Natural Selection

A population of moths comes in light and dark forms. Predators spot moths that stand out against the bark. Change the bark colour, predation strength and starting mix, and watch the frequency of the dark allele change over generations.

How the model works

Each moth has two copies (alleles) of a colour gene: dark D (dominant) or light d. DD and Dd moths are dark; dd moths are light. Each generation:

  1. Predators remove some moths. Camouflaged moths survive with probability 1, conspicuous ones with probability 1 − s, where s is the selection coefficient.
  2. Survivors mate at random and produce the next generation (fixed population size N), each parent passing on one allele.
  3. A small mutation rate μ flips alleles at random.

The simulation tracks real individuals with a seeded random generator, so small populations also show chance effects (genetic drift). The dashed line is the deterministic expectation for an infinite population, using the standard one-locus selection recursion.

This is the classic peppered moth story: soot-darkened trees in industrial England favoured dark moths, and clean-air laws reversed the trend.

Simplified single-gene model with complete dominance, random mating and non-overlapping generations. Real moth colour genetics and predation are more complex.

Guided experiments

  1. Industrial revolution. Dark bark, dark allele starts rare (5%). Prediction: because D is dominant, even rare dark moths are visible and favoured straight away. The dark allele rises within a few dozen generations to well over 50%.
  2. Clean air. Light bark, dark allele starts common (90%). Prediction: light moths increase, but the dark allele lingers for a long time, hidden in Dd moths that look dark yet carry d. Selection against a dominant trait is fast; selection against a hidden recessive is slow.
  3. No selection, small population. s = 0, N = 30. Prediction: frequencies wander at random and may hit 0 or 100% by chance alone (drift).

Challenge

On dark bark with strong selection, why does the light allele (d) never quite disappear, even after many generations?

Reveal the explanation

When d is rare it is almost always in Dd moths, which look dark and are not selected against. Only dd moths are exposed, at frequency q². That shrinks very fast as q falls, so selection slows dramatically. Mutation also keeps reintroducing d at a low rate. The deterministic curve flattens near zero for the same reason.

References

  • OpenStax, Biology 2e, §19.2 “Population Genetics” and §19.3 “Adaptive Evolution”.
  • Cook, L. M. et al. (2012), “Selective bird predation on the peppered moth”, Biology Letters 8: 609–612.