top of page
  • Writer's pictureJolene Pappas

Population Genetics Simulation

Updated: May 5, 2020

The population genetics simulation was the first one made for the site and is one of the most open-ended. Teachers can make a guided lab to test a variety of situations (like the "Heterozygote Advantage" lab, available on the resources page or on Google Drive), or it can be an opportunity for student inquiry (see the "Population Genetics" worksheet). Simulations can be a great option for letting students practice developing questions and designing experiments, so it was important to me that at least some of the simulations on Biology Simulations have an open structure.


Fictional species color phenotypes with corresponding genotypes
Phenotypes and genotypes for the fictional species used in the population genetics simulation

The simulation examines the frequencies of two alleles for one gene that codes for color in a fictional population. There are red (R) and blue (B) alleles, with red (RR), purple (RB), and blue (BB) phenotypes. Before jumping into any virtual labs using this simulation students should be familiar with heredity terms like gene, allele, genotype, and phenotype. Students should also understand frequencies. I do my evolution unit with the 9th grade before the heredity unit, so I review heredity terms which students worked with in middle school before starting any of the evolution simulations. There is an introduction worksheet available that I use to review terms and review/introduce frequencies. Students do not need to be familiar with Hardy-Weinberg formulas to use this simulation. However, teachers could incorporate H-W calculations and/or hypothesis testing for advanced classes.

In the simulation students can manipulate the starting frequency of the red allele, the number of generations, the population size, the survival chance of each phenotype, and mutation between the two alleles. The simulation can test genetic equilibrium, genetic drift, natural selection, and mutation (between existing alleles, not producing new alleles).

Sample run of a population genetics simulation used for a virtual heterozygote advantage lab.
Sample simulation results

When the simulation is run, a picture representing the population is produced for each generation. A graph is produced to show the allele and phenotype frequencies for each generation. Hovering the mouse over a data point will show the value. Clicking on a line in the key will remove it from the graph, which is useful if students want to focus on a specific data set.

Data from a population genetics simulation, demonstrating graph functionality.
Hovering the mouse over a data point will show the value and clicking on a line in the key will remove it from the graph.

Each run includes random components, so each trial will have variation. A random number function assigns a decimal number for each allele. The simulation uses the user inputs or previous generation's data to determine how those numbers are interpreted. The random variations allow students to collect data for multiple trials to analyze. It also means that each student in a class will get slightly different results. While the same patters will likely emerge (depending on what is tested), each student should have a unique data set to analyze and interpret.

Population genetics simulation JavaScript code, demonstrating use of Math.random() function.
Some of the population genetics code

8,688 views0 comments

Recent Posts

See All


Join the email list for updates!

Thank you for using Biology Simulations! Please verify your email to confirm.

bottom of page