Hardy-Weinberg simulation model
Lee Gass

 

Download file

Models in general

Models represent reality. Models constructed for different purposes represent different aspects of reality, but none represent all aspects (if they did they would be reality!). Some model airplanes look like real ones but can't fly. Others fly but don't resemble real ones, and still others, such as wind tunnel models, function in some ways like real airplanes but still can't fly. How we design models depends on what we need them to do.

Mathematical models capture some aspect of reality with equations. For example, the model

5 - 1 = 4

represents a little boy who had 5 apples and ate one. The same model could represent other situations, and more complex models could represent more complex situations.

Iterative mathematical models represent complex situations in which some process is repeated over and over again, in a loop, and we would like to know how its consequences develop over time. The iterative model below represents a boy who had some apples and ate some each day until they were gone. We want to know how long that took.

apples = 10 /* boy has 10
days = 0 /* start at 0 days
ration = 1 /* eats 1 each day

start eating
apples = apples - ration /* boy eats ration
if (apples > 0) /* apples left?
days = days + 1 /* a day goes by
go to start eating
if (apples = 0)
go to STOP EATING

STOP EATING
print days /* how long?

The model would give different results if the boy started with a different number of apples, ate a different ration, ate apples only some days, or changed his ration from day to day. All of this would be easy to model with the same basic structure. If the model were complex enough or required enough iterations through the "day loop", it would be much easier and faster to run it on a computer rather than keeping track of the changes by hand because computers are so fast and so good at bookkeeping.

Hardy-Weinberg Genetic Equilibrium Theory

Hardy-Weinberg theory allows us to predict the genetic composition of populations in coming generations, given certain assumptions about population size, migration, mating patterns, mutation, and given the absense of natural selection. Hardy-Weinberg theory predicts that the genetic structure of populations will remain constant from generation to generation as long as these ideal assumptions are met. That is, allele frequencies in gene pools and genotype frequencies in populations should remain constant as long as there is no natural selection, no mutation, etc.

But we know that the real world is not constant in these ways. The usefulness of this theory about ideal worlds is not in showing us that the real world is not ideal (we already know that), but in helping us to see how (i.e. in what ways) the real world differs from the ideal world that the theory represents. The predictions of the theory provide a yardstick; comparing real situations to these predictions allows us to evaluate to what extent and in what ways the assumptions of the theory are violated.

The Hardy-Weinberg Simulation Model

The Hardy-Weinberg Simulation Model is an iterative (i.e. looping) computer model that uses the Hardy-Weinberg equations to represent changes in a population over 40 generations under specified conditions of natural selection. This is an interactive program; it asks the operator to supply starting genotype frequencies and selection pressures against each of them, then computes 40 years of predicted changes and illustrates them as graphs. The basic logical structure of the program is simple, as follows.

Get parameters from the keyboard (ALL ARE PROPORTIONS).
Frequency of PP in the population?
Frequency of PQ in the population?
Frequency of QQ in the population?

Selection against PP (PPMORT)?
Selection against PQ (PQMORT)?
Selection against QQ (QQMORT)?

CALCULATE SURVIVAL RATES FROM MORTALITY RATES
PPSURV = 1 - PPMORT
PQSURV = 1 - PQMORT
QQSURV = 1 - QQMORT

ENTER GENERATION LOOP

GEN = 0
START LOOPING

PP = PP * PPSURV Apply mortality
PQ = PQ * PQSURV
QQ = QQ * QQSURV
SUMSURV = PP + PQ + QQ

PP = PP/SUMSURV Recalculate frequencies:
PQ = PQ/SUMSURV parental genotypes
QQ = QQ/SUMSURV

P = PP + PQ/2 gene pool; gametes
Q = QQ + PQ/2
PP = P * P offspring genotypes
PQ = P * Q * 2
QQ = Q * Q
Save PP, PQ, QQ, P, Q Administer Loop
if (GEN < 40)
GEN = GEN + 1
go to START LOOPING
if (GEN = 40)
go to END LOOPING

END LOOPING
Draw graphs
Quit

Instructive simulations:

1.

Selection against a lethal recessive allele (various intensities). Illustrated below.
2.

Selection against a lethal dominant allele (various intensities).
3.

Heterozygote superiority; selection against both homozygotes (various intensities).
4.

Heterozygote inferiority; selection against heterozygotes allele (various intensities).Sample inputs and outputs

Lethal recessive: A population begins at genotype frequencies of 25% PP, 50% PQ, and 25% QQ, and all individuals of genotype QQ die before reaching reproductive age (one allele is lethal in homozygous condition). What will be the genotype and gene frequencies after 40 generations of this kind and degree of selection?

Starting Frequencies: PP: 0.2500, PQ: 0.5000, QQ: 0.2500, P: 0.5000, Q: 0.5000
Mortalities: PPMORT: 0.0, PQMORT: 0.0, QQMORT: 1.0
Ending Frequencies: PP: 0.9529, PQ: 0.0465, QQ: 0.0006, P: 0.9762, Q: 0.0238