Hardy-Weinberg Equation Explained (Video)

Written guide: Variant Allele Frequency (VAF) in Somatic Calling: What It Tells You About Tumor Purity, Ploidy, and Clonality

Explains the Hardy-Weinberg equation and its assumptions for calculating allele frequencies.

Watch on YouTube

Chapters

  1. 0:03 Introduction
  2. 0:27 Why population genetics needs a baseline
  3. 1:59 Genes, alleles and genotypes
  4. 3:12 Allele and genotype frequencies
  5. 4:56 Where the principle comes from
  6. 5:49 Deriving the equation from the gene pool
  7. 7:21 Equilibrium in one generation
  8. 8:41 The five assumptions
  9. 10:23 Worked problem with a recessive condition
  10. 12:15 Testing a sample with chi-square
  11. 14:34 Reading a departure from equilibrium
  12. 16:02 Three alleles and the ABO blood groups
  13. 17:37 X-linked genes
  14. 18:52 Common mistakes
  15. 20:26 Recap and quiz
Video transcript

0:03 Introduction

In this video, you will learn how to use the Hardy-Wainberg equation with the worked problems and details about understanding the equation itself. The Hardy-Weinberg equation, p squared plus two p q plus q squared equals 1, gives the genotype frequencies you expect from the allele frequencies in a population that is not evolving. The video has eight parts.

0:27 Why population genetics needs a baseline

First, we will look at why population genetics needs a baseline and define genes, alleles and genotypes. Evolution is a change in allele frequencies from one generation to the next. To detect such a change in a real population, you need a prediction of the frequencies when no change occurs. The Hardy-Weinberg equation supplies that prediction. It describes a population that is not evolving, in which allele frequencies stay constant across generations and genotype frequencies settle at fixed proportions of the allele frequencies. Without a baseline, a difference in allele frequency between two samples has no interpretation, because sampling alone produces differences. The equation also converts one kind of frequency into another, which is the step the worked problems depend on. Genetic counselling uses the equation to estimate the carrier frequency of a recessive condition in a population. Genetic association studies test the genotypes of control samples against the frequencies the equation gives, because a departure can signal genotyping error. A sample that matches the prediction gives no detectable sign of those forces, although a small sample can hide such forces.

1:59 Genes, alleles and genotypes

The equation counts two different things, alleles and genotypes, so both need precise definitions. A gene is a stretch of DNA that carries the information for a product or a trait. An allele is one of the alternative forms of a gene at one locus, which is a fixed position on a chromosome. A diploid individual carries two copies of each autosomal locus, one on each chromosome of a pair. The pair of alleles at that locus is the genotype, written as big A big A, big A small a, or small a small a. The observable trait that results from the genotype is the phenotype. An individual with two different alleles at a locus is heterozygous, and an individual with two identical alleles is homozygous. A heterozygous carrier of a recessive allele does not show the trait. The gene pool is all the alleles at a locus carried by the members of a population. A population in this sense is a group of individuals of one species that interbreed, and the boundaries of the group are a choice you make when you design a study. The equation works on the gene pool, and it treats the alleles in that pool as the units it counts.

3:12 Allele and genotype frequencies

Second, we will calculate allele and genotype frequencies. From a sample of individuals, you calculate two kinds of frequency, and the two differ. An allele frequency is the proportion of all copies of a gene in a population that are one allele. A genotype frequency is the proportion of individuals with one genotype. In an illustrative sample of 500 people, 195 have genotype big A big A, 210 have genotype big A small a, and 95 have genotype small a small a. Dividing each count by 500 gives genotype frequencies of 0.39, 0.42 and 0.19. These genotype frequencies describe the sample, and they do not follow from p and q on their own. To get the allele frequencies, you count alleles rather than individuals. Each big A big A individual carries two copies of big A, so those 195 people contribute 390 copies. Each big A small a individual carries one copy, which adds 210. The sample therefore holds 600 copies of big A out of 1,000 alleles at the locus. The frequency of big A, written p, is 0.6. The remaining 400 copies are small a, so the frequency of small a, written q, is 0.4. The two frequencies sum to 1, so p plus q equals 1. You can also count the small a copies directly, and the two routes agree. With a sample this size, the counts carry sampling error, and a later segment tests whether the gap from the prediction is larger than chance.

4:56 Where the principle comes from

Third, we will trace where the principle comes from and derive the equation from the gene pool. The frequencies you have counted connect to a principle that explains why a dominant allele does not spread through a population on its own. A heterozygote shows the dominant phenotype, and a naive argument predicts that the dominant phenotype becomes more common with each generation. In 1908, the mathematician G. H. Hardy and the physician Wilhelm Weinberg described the result independently. The result showed that, under random mating and in the absence of other forces, allele frequencies stay where they start, because the recessive allele persists inside heterozygotes. The principle carries both names, and the next segment states the result in algebraic form.

5:49 Deriving the equation from the gene pool

The equation follows from treating mating as random sampling from the gene pool. Drawing gametes resembles drawing cards at random, with the difference that the gene pool is large enough for each draw to leave the proportions unchanged. Random mating draws two gametes from the gene pool in the same way. A gamete carries big A with probability p and small a with probability q. The two gametes that form an individual come from the pool independently, so you multiply the probabilities. Two big A gametes meet with probability p times p, which is p squared. Two small a gametes meet with probability q times q, which is q squared. A heterozygote forms in two ways, with big A from the mother and small a from the father, or with small a from the mother and big A from the father. Each order has probability p times q, and the two orders together give two p q. The Punnett square of the gene pool shows the same multiplication, with p and q along the two edges. With p equal to 0.6 and q equal to 0.4, the three probabilities are 0.36, 0.48 and 0.16. The three sum to 1, because p plus q equals 1 and squaring both sides gives p squared plus two p q plus q squared equals 1. The factor 2 in two p q counts the two orders in which the alleles can arrive, and leaving it out halves the expected number of heterozygotes.

7:21 Equilibrium in one generation

Fourth, we will see how a population reaches equilibrium in one generation and go through the five assumptions. The equation also predicts how quickly a population reaches these proportions. Start a population with half of the individuals of genotype big A big A and half of genotype small a small a, and no heterozygotes at all. The allele frequency of big A is 0.5, because the big A big A individuals contribute two copies each and the small a small a individuals contribute none. Random mating then draws gametes from a pool that is half big A and half small a. The offspring genotypes come out at 0.25 big A big A, 0.50 big A small a and 0.25 small a small a. The allele frequencies in those offspring are still 0.5, and another round of random mating gives the same genotype frequencies. One generation of random mating is enough to reach the proportions, and the population stays there while the assumptions hold. This state is Hardy-Weinberg equilibrium, in which allele and genotype frequencies stay constant from one generation to the next and the genotype frequencies equal p squared, two p q and q squared.

8:41 The five assumptions

The prediction holds only under conditions that real populations meet approximately. Random mating means that an individual's choice of mate does not depend on genotype at the locus. Non-random mating changes genotype frequencies without changing allele frequencies, because the alleles stay in the population and only their pairing changes. Inbreeding raises the proportion of homozygotes and lowers the proportion of heterozygotes. No mutation means that new alleles do not enter the pool. Mutation rates per locus are small, so a violation of this assumption changes allele frequencies slowly. No migration means that no individuals or gametes arrive from another population with different allele frequencies. Migration, or gene flow, can change allele frequencies quickly when the two populations differ. A very large population means that chance fluctuations in allele frequencies are negligible. In a small population, genetic drift changes allele frequencies at random, and a rare allele may disappear within a few generations. The smaller the population, the larger the change that drift produces in each generation. No natural selection means that each genotype contributes the same number of offspring on average. Selection changes allele frequencies, and it changes genotype frequencies as a consequence. A real population meets some of the five conditions closely and others poorly, and the next segments use the size and direction of the departure to identify which condition fails.

10:23 Worked problem with a recessive condition

Fifth, we will work through a problem with a recessive condition. The equation applies most directly to a recessive condition, because the frequency of affected individuals gives q squared. A recessive condition affects about 1 in 2,500 births in some populations of European ancestry, and cystic fibrosis is the textbook case. Affected individuals have genotype small a small a, so the frequency of the condition equals q squared. Set q squared to 1 divided by 2,500, which is 0.0004. Take the square root, and q equals 0.02. Then p equals 1 minus 0.02, which is 0.98. The carrier frequency is two p q, or two times 0.98 times 0.02, which is 0.0392. About 3.9 percent of the population carries one copy, or roughly 1 in 25 people. The unaffected non-carriers have genotype big A big A, at a frequency of p squared, or 0.9604. You start from the recessive phenotype because it is the only group whose genotype you know with certainty. A person with the dominant phenotype may be big A big A or big A small a, and the equation separates those two groups. The carrier frequency is about 100 times the frequency of the condition in this example, because two p q is close to two q while q squared is much smaller. The calculation assumes Hardy-Weinberg equilibrium in the population, and a population with inbreeding gives a different carrier frequency. For a person with no family history, the population carrier frequency gives the starting estimate of carrier risk.

12:15 Testing a sample with chi-square

Sixth, we will test a sample with chi-square and read a departure from equilibrium. A real sample never matches the expected numbers exactly, so you test whether the gap is larger than chance. Return to the 500 people with 195 big A big A, 210 big A small a and 95 small a small a. The allele frequencies are p equal to 0.6 and q equal to 0.4, and the prediction gives genotype frequencies of 0.36, 0.48 and 0.16. Multiplying each frequency by 500 gives expected counts of 180, 240 and 80. The chi-square statistic sums, over the three genotype classes, the squared difference between observed and expected, divided by the expected count. For big A big A, 195 minus 180 is 15, and 15 squared divided by 180 is 1.25. For big A small a, 210 minus 240 is minus 30, and 30 squared divided by 240 is 3.75. For small a small a, 95 minus 80 is 15, and 15 squared divided by 80 is 2.81. The sum is 7.81. The chi-square test compares counts of individuals, so you enter the three genotype counts and not the allele counts. The degrees of freedom are the number of genotype classes, which is 3, minus 1, minus the number of allele frequencies you estimated from the data, which is 1. The degrees of freedom are therefore 1. The critical value at the 0.05 level for one degree of freedom is 3.84, and 7.81 exceeds that value. The p-value is about 0.005, so the sample departs from Hardy-Weinberg equilibrium. If you did not subtract the estimated allele frequency, the test would use 2 degrees of freedom and give a larger p-value. A p-value below 0.05 tells you that the departure is unlikely under the prediction, and it does not tell you which assumption failed.

14:34 Reading a departure from equilibrium

A significant result indicates that at least one assumption fails, and the pattern of the departure suggests which. The sample has 210 heterozygotes, and the prediction gives 240. The inbreeding coefficient F is 1 minus the observed heterozygosity divided by the expected heterozygosity. The observed heterozygosity is 0.42 and the expected value is 0.48, so F equals 1 minus 0.875, which is 0.125. A deficit of heterozygotes points to inbreeding, because relatives share alleles and their offspring are more often homozygous. A deficit also appears when a sample mixes subpopulations that have different allele frequencies, because the mixture produces fewer heterozygotes than a single randomly mating population would. An excess of heterozygotes points to selection that favors heterozygotes, or to genotyping error that misclassifies homozygotes as heterozygotes. The direction of the departure narrows the list of causes, and a comparison of allele frequencies across generations or populations tells you whether the cause acts on the alleles or only on their pairing. You report F alongside the chi-square result, because the test gives a p-value and F gives the size of the departure.

16:02 Three alleles and the ABO blood groups

Seventh, we will extend the logic to three alleles and the ABO blood groups, and apply the same reasoning to X-linked genes. The same logic extends to genes with more than two alleles. The ABO blood group has three alleles at one locus, written I A, I B and small i. Write their frequencies as p, q and r. The three frequencies sum to 1, so p plus q plus r equals 1. Squaring the sum gives the genotype frequencies, and each squared term gives a homozygote while each cross term gives a heterozygote. Take illustrative values of p equal to 0.28, q equal to 0.06 and r equal to 0.66. Blood group O requires two copies of small i, so its frequency is r squared, or 0.4356. Blood group A comes from I A I A and from I A small i, so its frequency is p squared plus two p r, which is 0.0784 plus 0.3696, or 0.448. Blood group B comes from I B I B and from I B small i, so its frequency is q squared plus two q r, which is 0.0036 plus 0.0792, or 0.0828. Blood group AB comes from I A I B, so its frequency is two p q, or 0.0336. The four phenotype frequencies sum to 1. You cannot read the allele frequencies directly from the phenotype frequencies here, because group A mixes two genotypes.

17:37 X-linked genes

Genes on the X chromosome need a different calculation for males and females. A male carries one X chromosome and a female carries two. For an X-linked recessive trait, a male has one copy of the locus, so his genotype is either the disease allele or the normal allele. The frequency of affected males equals q, the frequency of the disease allele in the population. Red-green color vision deficiency affects about 8 percent of men of European ancestry, so q is about 0.08. A female has two copies, so the Hardy-Weinberg proportions apply to her. The frequency of affected females is q squared, or 0.0064, which is about 0.64 percent. The frequency of carrier females is two p q, or two times 0.92 times 0.08, which is 0.147, or about 15 percent. For an X-linked locus, you calculate the genotype frequencies separately in males and in females, and the two sexes carry different numbers of copies. The male frequency gives you q directly, and you can then predict the female frequencies without counting affected women.

18:52 Common mistakes

The last part covers common mistakes. Students make a small set of recurring errors in these calculations. One error is to take the square root of the frequency of the dominant phenotype. With 1 in 2,500 affected, the dominant phenotype has a frequency of 0.9996, and its square root is 0.9998, which is not p, because the dominant phenotype contains both big A big A and big A small a. Take the square root of the recessive frequency instead. A second error is to confuse p with p squared. The allele frequency p is the proportion of copies of the allele, and p squared is the proportion of homozygotes. A third error is to apply the equation to a population that clearly violates the assumptions, such as a small population with strong selection at the locus. A fourth error is to count individuals instead of alleles when you calculate p. Each big A big A individual contributes two copies of big A, and each heterozygote contributes a single copy. A fifth error is to report the genotype frequencies of the sample as the expected frequencies, when the sample may not be in equilibrium. Write the three genotype frequencies down and check that they sum to 1 before you compare them with the prediction. Check that p plus q equals 1 before you continue, because an arithmetic slip at that step carries through the rest of the calculation.

20:26 Recap and quiz

Here is what you learned in this video. The equation gives the genotype frequencies you expect from the allele frequencies in a population that is not evolving. Allele frequencies count copies of an allele, and genotype frequencies count individuals. Random union of gametes gives p squared, two p q and q squared, and one generation of random mating reaches those proportions. The five assumptions are random mating, no mutation, no migration, a large population and no selection. A recessive condition at 1 in 2,500 gives q equal to 0.02 and a carrier frequency of about 3.9 percent. A chi-square test on 500 genotypes gave 7.81 with one degree of freedom, and the heterozygote deficit gave F equal to 0.125. Three alleles extend the same logic, and X-linked genes apply it separately in males and females. Here is a question for you to test what you learned. Consider a recessive condition that affects 1 in 10,000 people in a population at Hardy-Weinberg equilibrium. Find the frequency of heterozygous carriers. Pause the video and work it out. The answer follows. Q squared is 1 in 10,000, so q is 0.01 and p is 0.99, and two p q gives a carrier frequency of 0.0198, or about 1 in 50 people.

Read more

All videos