forked from popsim-consortium/stdpopsim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example.py
31 lines (25 loc) · 865 Bytes
/
example.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
"""
Example of using the stdpopsim library with msprime.
"""
import msprime
# import daiquiri
# # Print out log messages for recombination map retrieval
# daiquiri.setup(level="DEBUG")
import stdpopsim
from stdpopsim import homo_sapiens
chrom = homo_sapiens.genome.chromosomes["chr22"]
recomb_map = chrom.recombination_map()
model = homo_sapiens.GutenkunstThreePopOutOfAfrica()
model.debug()
# One sample each from YRI, CEU and CHB. There's no point in pushing
# the sampling strategy into the model generation
samples = [
msprime.Sample(population=0, time=0),
msprime.Sample(population=1, time=0),
msprime.Sample(population=2, time=0)]
ts = msprime.simulate(
samples=samples,
recombination_map=chrom.recombination_map(),
mutation_rate=chrom.default_mutation_rate,
**model.asdict())
print("simulated:", ts.num_trees, ts.num_sites)