Skip to content

convert stdpopsim models to msprime demography model #2148

Answered by nspope
lakishadavid asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, the msprime.Demography object is stored as an attribute called model in the stdpopsim.DemographicModel object. So, something like:

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 HomSap/Africa_1B08, it should still be in there! The following works for me with stdpopsim 0.2.0:

import stdpopsim
homsap = stdpopsim.get_species("HomSap")
demog_model = homsap.get_demographic_model("Africa_1B08")

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lakishadavid
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants