Home
Help
Resources
Extensions
FAQ
NetLogo Publications
Donate

Models:
Library
Community
Modeling Commons

Beginners Interactive NetLogo Dictionary (BIND)
NetLogo Dictionary

User Manuals:
Web
Printable
Chinese
Czech
Farsi / Persian
Japanese
Spanish

## NetLogo User Community Models

## WHAT IS IT?

This is a model of the fundamental law of population genetics a.k.a. Hardy-Weinberg equilibrium. The model is strictly adherent to the implicit and explicit assumptions originally made in 1908 by the English mathematician Godfrey Harold Hardy and the German physician Wilhelm Weinberg. These assumptions are summarized as follows:

* the organism is diploid;
* the considered gene is autosomal and bi-allelic (e.g., Brachydactyly);
* reproduction is sexual;
* generations are rigorously nonoverlapping;
* sexes are evenly distributed;
* the allele and genotypic frequencies are the same in males and females;
* mating is random (the population is panmictic);
* population size is very large (virtually infinite);
* migration is neglible;
* mutation can be ignored;
* natural selection does not affect the alleles under consideration.

Based on these assumptions, the simulation shows that equilibrium of genotypic and allele frequencies is reached in one generation, and the population remains in equilibrium in successive generations. Verification of Hardy-Weinberg equilibrium in the population is done with the chi-square test.

## HOW IT WORKS

Three agents' types with a "person" shape - one for each genotype - are implemented as as described hereafter:

1) white agents = "dd", homozygous genotype for the dominant phenotype;
2) red agents = "rr", homozygous genotype for the recessive phenotype;
3) green agents = "dr", heterozygous genotype, also correspondent to the dominant phenotype.

After fixing the initial number of individuals, each with a specific genotype, an equal number of males and females is assigned. Sex ratio is then maintained constantly = 1 throughout simulation. At ythe start of simulation, agents are arranged in a circle. The circular arrangement was chosen to facilitate visualization of random mating through the formation of links between agents of opposite sex. For each generation, each partner can only mate with a partner of opposite sex who is not engaged already in another mating event. After reproduction, the population of parents is completely replaced by the population of their offspring, which bears the specific genotypes predicted on the basis of Mendelian segregation rules. Over generations, population size remains constant Overlapping generations are never allowed because parents "die" at each generation after they have reproduced. The model uses a chi-square formula with correction for small sample size (i.e., expected values of genotypes < 5) (Hartl, Clark 2007).

## HOW TO USE IT

Use the sliders to select the initial number of agents with their specific genotypes. Press the setup button to arrange agents in a circle. Simulation consists of two steps to be performed in succession: first mating, then reproduction. These steps are implemented with two buttons to run the simulation in a discrete mode. Alternatively, simulation can be run in a continuous mode by pressing the "go" (forever) button. Evolution of genotype and allele frequency is "p", and genotype frequency is "q") can be followed by watching at the corresponding monitors and plots. Statistical differences between observed and expected number of each genotypic class is calculated, generation after generation, by the chi-square statistics, anf chi-squarevalues are reported in the corresponding monitor and plot. If population is in equilibrium chi square does not exceed the critical value which - for one degree of freedom - is = 3,84. This value is represented in the chi-square plot as a red line.

## THINGS TO NOTICE

Note that each generation is equivalent to two ticks, one tick for mating and the next for reproduction.
Note also that, for expected values of genotypes too close to zero, the chi-square calculation is not reliable. Moreover, if a genotype is completely missing no chi square value is calculated.

## THINGS TO TRY

Test the performance of the model with different initial numbers of the three genotypes.
Use the mating and reproduction buttons to visualize the single steps of simulation (discrete mode). Alternatively, use the go button to observe the behavior of the model run in continuous mode.

## EXTENDING THE MODEL

The code can be modified to test the effects of evolutionary forces (e.g., selection, mutations, etc.) on HWE.

## NETLOGO FEATURES

The two key primitive terms that were used to implement the mating and the reproduction procedures were "create-link-to" and "hatch" respectively. Furthermore, segregation ratios are stochastically implemented to assign the probabilities ton Mendelian segregation ratios.

## RELATED MODELS

In the Netlogo Models Library look at (i) Hardy Weinberg Equilibrium, (ii) Mendelian Inheritance, and (iii) PopGen Fishbowl.

## CREDITS AND REFERENCES

Hardy, G. H. 1908. Mendelian proportions in a mixed population. Science 28: 49-50.

Hartl, D. L., and Clark, A. G. 2007. Principles of Population Genetics (4th edition), Chapter 2 pp. 45-92. Sinauer.

Weinberg, W. 1908. Uber den Nachweis der Vererbung beim Menschen. Jahresh. Ver. Vaterl. Naturkd. Wurttemb 64: 369-382 (English translations in Boyer 1963 and Jameson 1977).

## HOW TO CITE

For the model itself:

Romano, V., and Tarantino, R. 2021. Hardy-Weinberg Basic Model.

University of Palermo, Italy