Pages Menu

Saturday, December 20, 2014

Genetic drift: Monte Carlo simulations

The starting point for this blog is a simulation of genetic drift using a Monte Carlo model. The model is included in  Lex Flagel's blog, which I recently stumbled upon. In the blog, Dr. Flegel has posted on many topics including genetics, math and statistics, art and nature, topics I'm quite interested in. In the genetic drift section, Professor Flegel kindly included some of his R-code. First, I took his code verbatum and for convenience repackaged it as an R function. Then I made a couple of additions to the model:  I allowed the population size to vary over the course of the model; and I allowed for non-zero selective advantage in each generation. Both of these modifications are described below. But first, I wanted to make sure that the unmodified code worked as expected for plain vanilla genetic drift.

Function evolve4() was used to reproduce Flagel's model, in which the breeding population (of 100 individuals) remains constant and there is no selective advantage. The result below looks a lot like Flagel's figure labeled "1000 Random Walks".

           evolve4(n.pop1=100, n.pop2=100, n.gen=5, n.samp=1000, f.init=0.5, s.adv=0.0)

Figure 1. In this simulation, population size = 100 (200 alleles), initial allele frequency = 0.5, neutral survival advantage. 1000 random walks, 5 generations

Model assumptions. Mating is random in each generation, and there is no generation overlap in mating. The population size is forced to remain at 100 individuals.  Every individual mates in each generation.

Varying population size. The size of the mating population in evolve4() can vary linearly from a specified starting size to a specified ending size. But, in fact, so far I've been keeping the population constant. It should be interesting to play around with varying of the population size. While the current code uses a linear function, an arbitrary population history could be imposed. For example, a bottleneck. More on this soon.

Selective Advantage



No comments:

Post a Comment