You will model a small population in which the next generation is a random sample of gene copies. Then you will add gene flow and count how often an allele is lost or fixed.
The idea. A population of size individuals has 2 * size gene copies. Each copy of the next generation is the allele with the chance , and the new frequency is the share of copies that are .
Your tasks.
next_p. It gives the allele frequency of the next generation.with_migrants. It gives the frequency after a share of the breeders are replaced by migrants.lost_or_fixed. It starts runs populations at , runs each for generations generations, and counts those that end at 0 or 1.Have you tried it?
Do the tasks in the editor first, and run the checker after each one. Its hints help when a check fails. When you are ready, compare your code with this solution.
Log in to join the discussion.
Loading…