Skip to content

MaelitoP/genetic-inheritance

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MIT License LinkedIn


Common Ancestors

Data Structure Course Project #2

Table of Contents
  1. About The Project
  2. License
  3. Contact

About The Project

In this course project we study genetic inheritance in a human population by simulation. In particular, we develop a platform to simulate random events (birth, coupling, death) in the lives of a population of sims, and we examine the coalescence of ancestral lineages.

Simulation

The simulation follows a population of virtual individuals, or sims, which are objects with the following attributes:

  • parents: mother and father
  • date of birth
  • date of death
  • sex: male or female

The life of each sim advances by random events: birth, death and reproduction. The simulation runs in time by maintaining two data structures: the population of living sims, and the event queue.

Random life model

Time is represented as a floating number on the scale 1.0=1 year, starting at 0.0 with the founder population.

The lifetime of a sim is a random number, following the Gompertz-Makeham law. This law combines a constant accident rate (of 1%/year by default), and a mortality rate increasing with age (doubling every 8 years by default).

Reproduction is described from the perspective of the mothers:

  • mating is possible between two sims of different sex, and of ages bounded by minimum and maximum (by default, 16-73 for male, and 16-50 for female)
  • the mother gives birth to children during her reproductive years, with the waiting time until mating following the exponential law with a fixed rate r (= Poisson process)
  • when the time arrives, the mother chooses a partner at random, with preference for her previous partner (10% probability of changing partner by default)

Events

We follow the evolution of the population by generating random events such as birth, death, or mating of sims. Each event applies to a specific sim, and during the time of its occurrence, it can generate other events to follow.

After simulating a few thousand years, we can trace the ancestors of the current population of sims. If we go back in time in reverse, the ancestral lines merge and we will find less and less lines represented in the current population. We want to plot the number of ancestors in the current population as a function of time. For the fathers (forefathers), we maintain a set PA of paternal alleles by going back in time.

Output A POPULATION OF ~5000 INDIVIDUALS FOR 20000 YEARS (PRESENT TIME IS ON THE RIGHT). ANCESTRAL LINEAGES (FOREMOTHERS AND FOREFATHERS) MERGE RAPIDLY DURING THE RECENT ~300 YEARS BUT INCREASINGLY RARELY IN THE MORE DISTANT PAST.

Competences

  • Priority queues implementation
  • Symbol tables
  • Random events: modeling & simulation

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Maël LE PETIT - @Maelito_P - contact@maelito.fr

Project Link: https://github.com/MaelitoP/genetic-inheritance

Languages