forked from popsim-consortium/stdpopsim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample.py
More file actions
28 lines (21 loc) · 717 Bytes
/
example.py
File metadata and controls
28 lines (21 loc) · 717 Bytes
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
"""
Example of using the stdpopsim library with msprime.
"""
import msprime
import stdpopsim.h_sapiens as h_sap
model = h_sap.models.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,
length=h_sap.chr22.length,
recombination_rate=h_sap.chr22.mean_recombination_rate,
mutation_rate=h_sap.chr22.mean_mutation_rate,
**model.asdict())
# print(ts.tables)
print("simulated:", ts.num_trees, ts.num_sites)