NetLogo User Community Models
Hardy Weinberg Classroom Model
by Kenneth Letendre (Submitted: 01/02/2009)
WHAT IS IT?
This is a model of the Hardy-Weinberg (HW) equilibrium. The HW principle predicts the genotypic frequencies that will be observed in a population over the course of generations given particular allele frequencies, and given that five assumptions (discussed below) hold true in the population.
Given two alleles, A and a, and the frequencies of each allele in the population, freq(A)=p and freq(a)=q, the HW principle predicts:
1) p + q = 1.
2) The genotypic frequency of AA homozygotes in the population is p^2.
These predictions hold true given that five assumptions about the population all hold true.
1) Large (infinite) population size. In small populations, chance differences in reproductive success and mating choices can produce deviations from the predictions of HW.
2) No selection. There is no systematic difference in the survival or reproductive success of organisms with different genotypes.
3) No mutation. The alleles are inherited from one generation to the next without being changed by mutation.
4) No migration. No organisms leave the population, and no new ones come in.
5) Random mating. Organisms choose mates at random with respect to the alleles of interest in the model.
If any of these assumptions do not hold true in a population, the observed genotypic frequencies will deviate from the predictions of HW in particular ways depending on the assumption(s) that is (are) violated.
HOW IT WORKS
The model is initialized with a randomly distributed population of blue (the dominant trait) and yellow (the recessive trait) organisms. Organisms are randomly assigned alleles according to the selected frequency of the A allele (the frequency of the a allele is determined as q = p - 1.)
As the model runs, organisms move around the world in a correlated random walk at a dispersal rate determined by the user. On each tick, organisms select a mate, either by mating with another organism chosen at random anywhere in the world, or by choosing a nearby organism to mate with. An offspring is produced adjacent to the reproducing organism, which randomly inherits either the a or A alleles from each of its parents. The organisms are diploid, but are essentially hermaphroditic, as every organism is capable of producing offspring and may mate with any other organism without the need to locate a mate of the opposite sex.
Following reproduction, the population is culled to bring the population size back down to the carrying capacity determined by the user. During each culling, each organism is subject to a probability of death determined by the degree to which the current population size exceeds the carrying capacity. As a result, an organism may live for several generations, or it may not survive to first reproduction. There is no maturation time, so that any organism that survives the first culling following its birth can reproduce during the next reproduction cycle.
The model ends when it reaches a specified number of generations ("ticks"), or when one allele becomes fixed in the population (that is, the other allele goes extinct), or when the entire population of organisms goes extinct (e.g. due to high selection against both phenotypes).
HOW TO USE IT
The "proportion-allele-A" slider bar determines the initial frequency of the allele A. The frequency of allele a is determined by calculating freq(a) = 1 - freq(A). The "population-size" slider determines the carrying capacity of the system. The "species" chooser allows the user to select from a list of possible icons to represent the organism as they move around the world.
Clicking the "setup" button initializes the world with a population of organisms of the selected species, with the specified allele frequencies. The "go" button starts the model.
The "Population size" monitor displays the current population size. Note that this population size will not always match exactly the value selected by the "population-size" slider. In fact, during each reproduction cycle, the population size will rise well above this value, and then fall back roughly to the specified population size at the end of the culling cycle. However because mortality for each organism is determined by a certain probability, the final population size will not be exactly the specified value, although it will be close.
Graphs track the genotypic frequencies, phenotypic frequencies, and allele frequencies over time as the model runs. Monitors display the current values for each of these.
As the model runs, the user may change the settings of any slider, chooser or input -- with the exception of the "proportion-allele-A" slider -- and the model will reflect these newly selected values. The value of the "proportion-allele-A" slider is used only at model setup; allele frequencies are determined only by the behavior of the organisms after the model begins running.
THINGS TO NOTICE
Note that the genotypic and phenotypic frequencies approximate the values predicted by the HW formulas. Try calculating the predicted values based on the allele frequencies you have specified (or the current allele frequencies obtained by the current A and a alleles preent in the population) and compare these to the actual values produced by the model as it runs. The model itself does not make use of the HW formulas, but produces values similar to those predicted by HW by the interactions of the model organisms.
Note the random changes in the genotypic, phenotypic, and allelic frequencies over time. These changes are more apparent with smaller population sizes, but can still be observed even with populations in the thousands. These random changes result from random differences in the survival and reproductive success of individuals each generation, and are called genetic drift. Genetic drift has a bigger effect on the makeup of small populations than larger ones. Theoretically, the HW assumption of "large population" actually requires an infinitely large population in order to completely eliminate the effect of drift.
THINGS TO TRY
Experiment with the settings of the model to create violations of the five assumptions described above. The Hardy-Weinberg equilibrium describes a theoretical population that cannot exist in the real world; perhaps its greatest value is in describing a population where no evolution is occurring, in order to better understand real populations where one or more of the five assumptions are violated, and evolution is occurring.
1) Large (infinite) population size. Try running the model with populations of different sizes in order to observe differences in the strength of genetic drift.
EXTENDING THE MODEL
Other methods for violating the assumptions of the HW equilibrium could be added. For example, selection in this model is caused by increasing the mortality rate of one or both of the phenotypes. Selection could also result from differential reproductive output, or from differential success in finding mates (sexual selection).
The model could also be extended to multiple genes to, for example, examine the effect of linkage on inheritance.
NetLogo Library Models:
CREDITS AND REFERENCES
Hardy-Weinberg Classroom Model (2009)
Council-Garcia, C.L., S. Ligon, B. Milne, R. Thornhill and D. Swenton. 2004. Biology 203L: Evolution and Ecology Lab Manual.
(back to the NetLogo User Community Models)