Populations and Alleles
Genetics and Heredity Fundamentals
Course 1 ยท Chapter 8 ยท Populations and Allele Frequencies
Every chapter so far followed one family at a time. Now we step back and look at a whole population: a group of individuals who breed with each other. The question changes from "what will this couple's children look like?" to "how common is each allele in the group, and does that change from one generation to the next?" This is the starting point of population genetics (check). All the programs here are Python 3.
Counting Alleles
An allele frequency is the share of all the copies of a gene, in the whole population, that are a given allele. Each person carries two copies of an ordinary gene, so a population of 100 people has 200 copies. Take a gene with alleles A and a, and count them by walking through the genotypes. It is the same counting idea as in Genetics and Heredity Fundamentals 1, but done over a group.
By convention the frequency of one allele is written p and the other q. With only two alleles, p + q = 1. Here p = 0.6 and q = 0.4. Notice that a heterozygote Aa contributes one copy of each allele, so the 48 heterozygotes are counted in both totals. A frequency is a share of alleles, not a share of people.
The Hardy-Weinberg Principle
Suppose the allele frequencies are p and q, and individuals pair up at random (no one chooses a mate by genotype). Picking two alleles from the gene pool is like the coin tosses and Punnett squares we have used since Genetics and Heredity Fundamentals 1: the chance of AA is p times p, of aa is q times q, and of Aa is 2pq, because there are two orders (A then a, or a then A). This gives the Hardy-Weinberg proportions (check):
p2 + 2pq + q2 = 1
The principle goes further. If a population is large, mates at random, and nothing pushes the allele frequencies (no new mutations, no migration, no selection), then the frequencies stay exactly the same in every generation, and the genotype proportions settle into p2, 2pq, q2 after one generation of random mating (check). It is best read as a baseline: a population that matches it is not evolving at that gene, and a population that does not match is a clue that one of the assumptions fails. We can compute the expected proportions exactly with fractions.
Each row sums to 1, as it must. Look at the last row: when a is rare (q = 1/10), only 1 person in 100 is aa, but 18 in 100 (9/50) carry one copy. Most copies of a rare recessive allele are hidden in heterozygotes, which is why such alleles are hard to remove from a population (check).
Testing a Population Against the Baseline
Given a real count of genotypes, we compute p from the alleles, work out the expected counts, and compare. A common measure of the gap is the chi-square statistic: for each genotype, take (observed minus expected) squared, divide by expected, and add them up (check). The larger the number, the worse the fit. For this test, with two alleles, a value above about 3.84 is usually taken as a poor fit at the 5% level (check).
This population has too many heterozygotes (60 seen, 48 expected) and too few of both homozygotes. The statistic is 6.25, above 3.84, so it does not fit the baseline. Possible reasons include non-random mating, selection that favours heterozygotes, or two populations that were mixed together (check). The test says that something differs, not which thing it is. Small samples also give unreliable results, as sample size did in Genetics and Heredity Fundamentals 1.
Genetic Drift
The principle assumed a very large population. In a small one, chance matters. Each generation, the next generation's alleles are a random sample of the current gene pool, and a random sample does not match its source exactly (just as 10 coin tosses are rarely exactly 5 heads). The allele frequency therefore wanders from generation to generation, with no cause other than luck. This is genetic drift (check).
The simplest model: a population of size individuals has 2 * size allele copies. For the next generation, draw 2 * size copies at random, each being A with the current probability p. This is a simplified version of the Wright-Fisher model (check). The program follows p for 50 generations, starting at 0.5, in populations of 10, 100 and 1000, printing it every 10 generations.
In the population of 10, the frequency fell to 0.2 by generation 10 and then hit 0.0 by generation 20: the allele A was lost, and since no new alleles arrive in this model, it stays lost (the frequency 0 cannot grow back). The opposite end, a frequency of 1.0, is called fixation: everyone carries only that allele. In the population of 100 the frequency moved between about 0.43 and 0.63 and was still not fixed after 50 generations. The population of 1000 also drifted, within a fairly narrow range at first, but this run happened to end at 0.625 (a single run, not a rule). Drift is stronger the smaller the population. We can measure it by repeating the experiment many times and recording which allele ends up fixed, and how long that takes.
The columns are the population size, the runs where A became fixed, the runs where it was lost, and the average number of generations until one or the other happened. Starting from 0.5, the two outcomes are about equally likely (roughly half each, not exactly), so drift does not favour either allele; it only removes variation. The average time grows with size: about 14 generations for 5 individuals, 53 for 20 and 140 for 50. Small populations lose variation quickly; large ones keep it much longer (check). This is also why a small group that starts a new population can differ in its allele frequencies from the group it came from (check).
Selection
Natural selection acts when genotypes differ in how many offspring they leave. We give each genotype a fitness, a number for its relative reproductive success: 1.0 for the best, lower for the worse (check). After one round of selection, each genotype's share is multiplied by its fitness and the shares are rescaled to total 1. In the model below, the frequency of A in the next generation is the share of A copies among all the surviving, reproducing genotypes.
Let w_AA, w_Aa and w_aa be the fitnesses. Genotypes start in Hardy-Weinberg proportions. The mean fitness is the sum of each proportion times its fitness. The copies of A come from all AA (every copy) and half of the Aa copies. This gives the update below. It is deterministic (no random numbers), so it describes a very large population where drift can be ignored.
Here aa individuals leave only 90% as many offspring as the others, a mild disadvantage, and A starts rare at 0.01. The pattern is typical. At first A moves slowly, because when it is rare almost all its copies are in heterozygotes, which have full fitness like AA, so most of the selection falls on the few aa individuals that exist. The change speeds up in the middle (from 0.11 at generation 25 to 0.46 at generation 50) and then slows again as a becomes rare and hides in heterozygotes. After 300 generations a has not disappeared; it is still about 4%. Selection against a recessive allele is slow at removing the last copies (check). This ties back to the rare-allele row in the Hardy-Weinberg table.
| Force | Changes allele frequencies? | Direction | Strongest when |
|---|---|---|---|
| random mating, nothing else | no (Hardy-Weinberg) | none | - |
| genetic drift | yes | random | the population is small |
| natural selection | yes | towards higher fitness | fitness differences are large |
| mutation, migration | yes | depends | (not simulated here) |
Challenges
Three populations have these genotype counts (AA, Aa, aa): north 49, 42, 9; south 20, 60, 20; east 5, 30, 65. For each, compute p and q as Fraction values, the expected counts under Hardy-Weinberg, and the chi-square statistic. Say which fit the baseline using the cut-off 3.84.
Using random.Random(2), run 400 populations of 25 individuals starting at p = 0.2, each until the allele is fixed or lost. Print how many ended fixed, how many lost, the fixed fraction, and the mean number of generations. Compare the fixed fraction with the starting p.
Using the step function with fitnesses 1.0, 1.0 and 1 - s for aa, start with q = 0.5 and count how many generations it takes for q to fall below 0.1 when s is 0.2 and when s is 0.05. Then run 100 generations with s = 0.2 and print the final q.
Quick Reference
- Allele frequency: share of all gene copies;
p + q = 1; a heterozygote counts once for each allele - Hardy-Weinberg: with random mating and no other forces, genotypes are
p2,2pq,q2and frequencies do not change - Rare recessives: most copies hide in heterozygotes
- Drift: random change in allele frequency, stronger in small populations; ends in loss or fixation
- Selection: fitness differences push frequencies in a direction; slow against a rare recessive
- Check: the model details, the 3.84 cut-off, and the drift and fixation vocabulary