16 Hardy-Weinberg equilibrium

Learning outcomes. By the end of this practical you should be able to:

  • Explain the difference between alleles and genotypes.
  • Calculate expected genotype frequencies from allele frequencies, and allele frequencies from the frequency of a recessive genotype.
  • Estimate allele frequencies from observed genotype counts and compare the observed counts with those expected under Hardy-Weinberg equilibrium (HWE).
  • List the assumptions of HWE and explain what a departure from HWE might, and might not, tell you.

16.1 Background

Hardy-Weinberg equilibrium is a fundamental concept in population genetics for understanding the genetic dynamics of populations. Named after British mathematician G.H. Hardy and German physician Wilhelm Weinberg, this principle describes the stable genetic proportions in a population under specific conditions of no evolution.

In an idealised population, where mating is random, genetic mutations are absent, natural selection is not acting, and there is no gene flow or genetic drift, the frequencies of alleles and genotypes remain constant across generations.

The Hardy-Weinberg equilibrium provides a baseline against which real populations can be compared, allowing researchers to detect factors that may cause deviations from this equilibrium and, in turn, understand the forces driving evolution and genetic changes within populations.

In this practical we will learn more about HWE and practise solving some HWE-related problems.

Reading: Neal, chapter The Hardy-Weinberg Principle. Neal writes the two alleles as \(A_1\) and \(A_2\); here we use A and a.

The key formulae of the Hardy-Weinberg Equilibrium are:

Equation 1: \(p + q = 1\)

and

Equation 2: \(p^2 + 2pq + q^2 = 1\).

Let’s first consider where these equations come from. First, Equation 1.

In a diploid organism, each individual carries two alleles for a particular gene. Let’s consider a gene with two alleles, A and a. In a given population:

Symbol Meaning
\(p\) Frequency of allele A
\(q\) Frequency of allele a

The sum of the frequencies of these two alleles in the population must equal 1, as they are the only two possibilities for this gene, so \(p+q=1\).

Note that dominance affects the phenotype, not the allele frequency. A dominant allele can be rare and a recessive allele can be common.

When genotype counts are available, we can calculate allele frequencies directly by counting allele copies:

\[ p = \frac{2n_{AA} + n_{Aa}}{2N}, \qquad q = \frac{2n_{aa} + n_{Aa}}{2N}. \]

Here, \(n_{AA}\), \(n_{Aa}\) and \(n_{aa}\) are the numbers of individuals with each genotype, and \(N = n_{AA} + n_{Aa} + n_{aa}\). Each homozygote contributes two copies of the same allele, while each heterozygote contributes one copy of each allele. These calculations do not require HWE. Once we know \(p\) and \(q\), we can calculate the expected genotype counts under HWE as \(Np^2\), \(N(2pq)\) and \(Nq^2\), and compare them with the observed counts.

Equation 1 serves as the foundational stepping stone for Equation 2. In Equation 1, we establish the sum of allele frequencies, \(p\) and \(q\), in the gene pool. This equation sets the stage for the more complex Equation 2, where we translate these allele frequencies into genotype frequencies for the population.

We can derive Equation 2 from the gene pool and random mating. Consider a zygote formed by two gametes, one from the father and one from the mother, each drawn at random from the gene pool (the random union of gametes). A gamete carries A with probability \(p\) and a with probability \(q\), so the possible combinations (father’s allele first) are:

  • \(p \times p = p^2\) (AA)
  • \(q \times q = q^2\) (aa)
  • \(p \times q = pq\) (Aa)
  • \(q \times p = pq\) (aA)

Notice that we have two \(pq\) terms (Aa and aA). The order of alleles doesn’t matter, so they are summed together: \(2pq\).

So, the total probability for all possible combinations is:

\(p^2 + 2pq + q^2\).

This must equal 1 (100% probability), which gives us Equation 2:

\(p^2 + 2pq + q^2 = 1\).

Note that this identity is true for any value of \(p\): it is just \((p + q)^2 = 1\). What HWE claims is something stronger, namely that the genotype frequencies in the population actually equal \(p^2\), \(2pq\) and \(q^2\).

In these formulae, \(p^2\) is the frequency of the homozygous AA genotype, \(q^2\) is the frequency of the homozygous aa genotype and \(2pq\) is the frequency of the heterozygous Aa genotype. From these equations we can produce the following plot, which shows the expected genotype frequencies at HWE for any allele frequency. HWE can occur at any allele frequency, but once the allele frequency is known, the expected genotype frequencies are fixed by Equation 2. (It is a common misconception that the three genotypes should occur in a 1:2:1 ratio, or that allele frequencies should tend towards 50% \(p\) and 50% \(q\).)

Given a small amount of information it is possible to figure out what the allele and genotype frequencies should be if the population is at HWE.

If a population is NOT at HWE, that is a signal worth investigating. It may mean that one of the assumptions below is violated, but apparent departures can also arise from genotyping errors or simple chance in a small sample.

The Hardy-Weinberg Equilibrium. The lines show the expected genotype frequencies at HWE for each allele frequency, p.

Figure 16.1: The Hardy-Weinberg Equilibrium. The lines show the expected genotype frequencies at HWE for each allele frequency, p.

16.2 Assumptions of Hardy-Weinberg Equilibrium

For a population to be in Hardy-Weinberg Equilibrium, certain assumptions must be met:

  • Random mating: There is no preference in mate selection based on genotype.
  • No mutation: Alleles do not change into other alleles, so mutation does not alter allele frequencies.
  • Very large population size: Random sampling has a negligible effect on allele frequencies (genetic drift).
  • No gene flow: Migration does not transfer alleles into or out of the population’s breeding gene pool.
  • No natural selection: All genotypes in the population have an equal chance of reproductive success.

These assumptions do two different jobs. Random mating is what produces the Hardy-Weinberg genotype proportions (\(p^2 : 2pq : q^2\)) in each generation. The other four (no mutation, no drift, no gene flow and no selection) are what keep the allele frequencies themselves constant from one generation to the next.

Any deviation from these assumptions could result in a population that is not in Hardy-Weinberg Equilibrium.

16.3 Worked example

Unless a problem states otherwise, assume that the population is at HWE. This matters: working back from the frequency of a recessive genotype to an allele frequency (as below) is only valid if the population is at HWE.

Suppose 16% of individuals have the recessive genotype, aa, so \(q^2 = 0.16\). What proportion of the population would we expect to be heterozygous?

  1. Calculate \(q = \sqrt{0.16} \approx 0.4\).
  2. Calculate \(p = 1 - q \approx 0.6\).
  3. Calculate the heterozygote frequency: \(2pq \approx 2(0.6)(0.4) \approx 0.48\).

We therefore expect about 48% of individuals to be heterozygous (Aa), assuming the population is at HWE.

16.4 Your task

Tackle the following problems, using the HWE theory outlined above. Worked solutions are given in Section 26.16.

16.4.1 Problem #1.

A population has two alleles, A and a, at a gene of interest. The frequency of allele A is 0.8. Assuming the population is at HWE, calculate the following:

  • The frequency of allele a.
  • The expected frequencies of the genotypes AA, Aa and aa.
  • The frequencies of the two possible phenotypes if A is completely dominant over a.

16.4.2 PROBLEM #2.

Sickle-cell disease is caused by the HbS allele of the haemoglobin gene; the normal allele is HbA. People with genotype AA have normal red blood cells but are vulnerable to severe malaria. People with genotype SS have sickle-cell disease, which is often fatal without treatment. Carriers (AS) are usually healthy and are protected against severe malaria, so in malarial regions they survive better than either homozygote.

If 9% of babies in a population are born with sickle-cell disease (SS), what percentage are carriers (AS)?

16.4.3 Problem #3.

You genotype a sample of 200 individuals from a population at a gene with two alleles, A and a. You find 90 AA, 70 Aa and 40 aa individuals. This time, do not assume the population is at HWE: assess whether the observed counts match HWE expectations. A descriptive comparison is sufficient for this exercise; a formal statistical test is an optional extension (see the box below).

  • Calculate the frequencies of alleles A and a from the genotype counts. (Hint: 200 diploid individuals carry 400 allele copies, and each heterozygote carries one copy of each allele.)
  • Calculate the expected number of each genotype if the population were at HWE.
  • Compare the observed and expected counts. Is there an excess or a deficit of heterozygotes? Suggest some reasons why a population might show this pattern.

Optional extension: a formal test. Neal tests for departures from HWE with a \(\chi^2\) (chi-square) test. For each genotype, calculate \((O - E)^2/E\), where \(O\) is the observed and \(E\) the expected count, and add the three values to get \(\chi^2\). Compare your value with the critical value of the \(\chi^2\) distribution for the correct degrees of freedom (3.84 for \(P = 0.05\) and 10.83 for \(P = 0.001\) with 1 degree of freedom; in R, pchisq(your_value, df = 1, lower.tail = FALSE) gives the \(P\) value).

Think carefully about the degrees of freedom. There are three genotype classes, but how many independent pieces of information did you take from the data to calculate the expected counts? Why is the answer 1 degree of freedom, not 2?

16.4.4 Problem #4.

Within a population of butterflies, brown (B) is completely dominant over white (b), and 40% of all butterflies are white. Assuming the population is at HWE, calculate the following:

  • The percentage of butterflies in the population that are heterozygous.
  • The frequency of homozygous dominant individuals.
  • Extension: Of the brown butterflies, what proportion would you expect to be heterozygous? (Think carefully about what the denominator should be.)

16.5 Takeaways

  • Hardy-Weinberg equilibrium provides a baseline for detecting evolutionary forces.
  • Allele frequencies (\(p\), \(q\)) determine genotype frequencies (\(p^2\), \(2pq\), \(q^2\)).
  • Comparing observed genotype counts with HWE expectations can reveal a departure from HWE. A departure identifies a pattern worth investigating (for example, a violated assumption, genotyping error or chance in a small sample), not its cause.