Skip to content
Tutorials Center
My learning

Topics

Lesson 40 of 40 Ā· Projects and Practice

Project: Allele Frequencies and the Hardy-Weinberg Principle

Calculate allele and genotype frequencies in a population with the Hardy-Weinberg equation, and simulate how chance changes frequencies over generations.

So far you have looked at inheritance in families. Genetics can also describe a whole population: a group of individuals of one species living in the same area. In this project you will measure how common alleles are, learn the Hardy-Weinberg principle (a baseline for "no change"), and simulate genetic drift.

Allele frequency

The allele frequency is the proportion of all copies of a gene that are a particular allele. Suppose a gene has two alleles, A and a. Write p for the frequency of A and q for the frequency of a. Because they are the only alleles,

p + q = 1

If 100 diploid individuals are sampled, there are 200 copies of the gene. If 120 of them are A, then p = 120/200 = 0.6 and q = 0.4.

The Hardy-Weinberg principle

In 1908 G. H. Hardy and Wilhelm Weinberg showed independently that, under certain conditions, allele frequencies do not change from one generation to the next, and genotype frequencies settle into a fixed pattern:

p² + 2pq + q² = 1

where p² is the frequency of AA, 2pq of Aa, and q² of aa. The conditions (an idealized population) are:

  1. Very large population (no genetic drift).
  2. Random mating.
  3. No mutation.
  4. No migration (gene flow).
  5. No natural selection.

Real populations never meet all five conditions exactly. That is the point: the principle gives a null model. If observed frequencies differ from Hardy-Weinberg predictions, one of the conditions must be failing, so evolution is occurring or the population is not mating randomly.

A worked example

A recessive condition affects 1 person in 2,500 (q² = 1/2500 = 0.0004). Then q = √0.0004 = 0.02 and p = 0.98. The carrier frequency is 2pq = 2 Ɨ 0.98 Ɨ 0.02 = 0.0392, about 1 person in 25. Many people are surprised that carriers are much more common than affected people, because most copies of a rare recessive allele are hidden in heterozygotes. (This example uses invented numbers and assumes random mating.)

Python Hardy-Weinberg calculator

Press Run (or Ctrl + Enter) to see the result here.

Program input Ā· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Genetic drift

In a small population, chance alone changes allele frequencies. Imagine ten individuals: if by luck the few that reproduce do not carry allele a, it can vanish from the population in a single generation. Changes caused by chance are called genetic drift. Drift is strongest in small populations and can lead to an allele being lost (frequency 0) or becoming the only allele (frequency 1, called fixation).

A bottleneck (a sudden reduction in population size) or a founder effect (a few individuals starting a new population) can strongly change frequencies.

The simulation below follows allele A at the start frequency of 0.5 in populations of different sizes. Each generation, every individual's two alleles are drawn at random from the previous generation's gene pool. It is a simple model (the Wright-Fisher model), and the seed fixes the random numbers so it repeats.

Python Drift in small and large populations

Press Run (or Ctrl + Enter) to see the result here.

Program input Ā· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

The small populations (N = 10) wander widely and may hit 0 or 1, while the large ones stay close to 0.5. The exact paths depend on the seed.

Selection changes frequencies in a predictable direction

If one genotype survives or reproduces better, its alleles become more common. A new example shows a recessive lethal allele being removed from a large population: affected aa individuals do not reproduce. The change per generation is q' = q / (1 + q), a standard result for a fully recessive lethal.

Python Selection against a recessive lethal

Press Run (or Ctrl + Enter) to see the result here.

Program input Ā· what you'd type while the program runs

Type the answers before you press Run, one per line. Each time the program reads a line (with input()), it gets the next line from this box.

Notice that the allele becomes rarer very slowly once it is rare, because it is hidden in carriers. This is why genetic diseases caused by recessive alleles persist.

Check your understanding

Quick check Ā· 4 questions

of 4 answered You scored / 4 Ā· perfect!

  1. 1. In a population, q = 0.1 for a recessive allele. What is the expected frequency of heterozygotes (2pq)?

    p = 0.9, so 2pq = 2 x 0.9 x 0.1 = 0.18.
  2. 2. Which is NOT a condition for Hardy-Weinberg equilibrium?

    The population must be large. A small population shows genetic drift.
  3. 3. Which population is most affected by genetic drift?

    Chance has a bigger effect on allele frequencies when only a few individuals reproduce.
  4. 4. A recessive disease affects 1 in 10,000 people. What is q?

    q squared = 0.0001, so q = 0.01.

Summary

  • Allele frequencies satisfy p + q = 1; Hardy-Weinberg genotype frequencies are p² + 2pq + q².
  • The principle is a null model that holds only if there is no drift, mutation, migration or selection and mating is random.
  • Genetic drift changes frequencies by chance and is strongest in small populations.
  • Most copies of a rare recessive allele sit in carriers, so selection removes it only slowly.

Next: back to the course overview