How to do it...

Take a look at the following steps:

  1. Let's start with some basic code from the first recipe:
from collections import defaultdict, OrderedDictfrom copy import deepcopyimport simuPOP as spfrom simuPOP import demographynum_loci = 10pop_size = 50num_gens = 101num_pops = 10migs = [0, 0.005, 0.01, 0.02, 0.05, 0.1]init_ops = OrderedDict()pre_ops = OrderedDict()post_ops = OrderedDict()pops = sp.Population([pop_size] * num_pops, loci=[1] * num_loci, infoFields=['migrate_to'])

We will simulate an island model with 10 islands (num_pops). Also, we will introduce a new infoFields, migrate_to, which is necessary to implement migration. We will try out several migration rates (including 0). Also, when we create a population, the population ...

Get Bioinformatics with Python Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.