Genetic Drift Simulation
Genetic Drift Simulation – Code Explained
This simulation visually shows how allele frequencies change over time due to genetic drift. Here’s how the simulation works:
1. Population Initialization
- Users select population size and the starting percentage of allele “A” (red) using sliders.
- The rest of the population has allele “a” (blue).
2. Next Generation Logic
- Each generation is formed by randomly selecting alleles from the current gene pool.
- This random sampling simulates genetic drift (random chance) affecting allele frequencies.
- Allele frequencies are tracked and visualized on a line graph (using Chart.js).
3. Special Features
- Bottleneck Effect: Temporarily shrinks the population, making random changes more extreme.
- Founder Effect: Starts the simulation with a small sub-population, mimicking migration.
- Fixation Detection: Alerts when only one allele remains in the population (0% or 100%).
4. Controls
- Pause/Resume: Allows user to stop or continue simulation.
- Reset: Restarts the simulation using current settings.
- Alleles are displayed below the chart as red (A) and blue (a) dots.
🔬 What is Genetic Drift?
Genetic drift is a random change in allele frequency in a population. Unlike natural selection, it is not influenced by fitness. It’s especially significant in small populations.
🎯 Key Features
- Random, chance-driven changes
- Can result in allele fixation or loss
- More noticeable in small populations
🌪️ Types of Genetic Drift
1. Bottleneck Effect
A sharp reduction in population due to disasters (flood, disease, etc.) causes dramatic allele frequency changes.
Example: Only a few cheetahs survive a natural disaster, reducing genetic variation drastically.
2. Founder Effect
A few individuals from a population start a new population in a new place. Their alleles may not represent the original population well.
Example: A few beetles float to a new island and begin a colony with limited genetic variation.
📉 Genetic Drift in Action
This graph below shows how the frequency of allele A (red) may fluctuate randomly across generations in a small population.
⚡ Why It Matters
- Reduces genetic diversity
- Can lead to harmful alleles becoming fixed
- Plays a key role in evolution, especially in isolated or endangered populations