Replies: 1 comment
-
The relationship between stdpopsim models and msprime demographic models is a bit tricky, and tied to some obscure implementation details (related to the change between msprime's pre 1.0 API and its post-1.0 demography API). It's best not to try to "edit" them in place. I think possibly your best option here is to export the model to Demes ( Some related discussion: |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi devs, is it possible to modify existing parameters from a stdpopsim model?
I have tried the add_migration_rate_change script below, however, upon looking at the debug() I don't think its doing what I hoped it would (i.e. over-writing an existing parameter).
Any thoughts would be greatly appreciated!
-M
import msprime
import stdpopsim
engine = stdpopsim.get_engine("msprime")
species = stdpopsim.get_species("HomSap")
demog = species.get_demographic_model("AncientEurasia_9K19")
demog.model.add_migration_rate_change(time=1348, rate=0, source=1, dest=8)
demog.model.sort_events()
print(demog.model.debug())
╟ Events @ generation 1.35e+03
║ ┌──────────────────────────────────────────────────────────────────────────────────┐
║ │ time│type │parameters │effect │
║ ├──────────────────────────────────────────────────────────────────────────────────┤
║ │ 1348│Mass Migration │source=1, dest=8, │Lineages currently in population 1 │
║ │ │ │proportion=0.0936 │move to 8 with probability 0.0936 │
║ │ │ │ │(equivalent to individuals migrating │
║ │ │ │ │from 8 to 1 forwards in time) │
║ │┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈┈│
║ │ 1348│Migration rate │source=1, dest=8, │Backwards-time migration rate from 1 │
║ │ │change │rate=0 │to 8 → 0 │
║ └──────────────────────────────────────────────────────────────────────────────────┘
Beta Was this translation helpful? Give feedback.
All reactions