convert stdpopsim models to msprime demography model #2148
-
How do I convert the stdpopsim model to a msprime.Demography instance? I see the example of the demography model in python, but how would I use the managed stdpopsim models in msprime? I can't use stdpopsim directly because I need chromosome-aware simulations, and as far as I can tell, stdpopsim does not model that. I can successfully build the demographic model and simulate data as per the tutorials would rather use the managed models in stdpopsim. Also, I don't see Africa_1B08 in Here is my code:
and this is the error |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, the import stdpopsim
species = stdpopsim.get_species("HomSap")
demog_model = species.get_demographic_model("AmericanAdmixture_4B11")
completed_ts = msprime.sim_ancestry(
recombination_rate = rate_map,
demography = demog_model.model, #<<--- here
... As for import stdpopsim
homsap = stdpopsim.get_species("HomSap")
demog_model = homsap.get_demographic_model("Africa_1B08") |
Beta Was this translation helpful? Give feedback.
Hi, the
msprime.Demography
object is stored as an attribute calledmodel
in thestdpopsim.DemographicModel
object. So, something like:As for
HomSap/Africa_1B08
, it should still be in there! The following works for me with stdpopsim 0.2.0: