-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Demography.from_demes(): ancestral population sizes and migration rates missing #2255
Comments
Hi @simonharnqvist -- thanks for opening the issue. I believe everything is working as expected, and those missing population sizes and migration rates will appear as the populations come into existence. If we specify [PopulationParametersChange(time=10000.0, initial_size=1000000.0, growth_rate=None, population='ab_anc'),
PopulationSplit(time=10000.0, derived=['a', 'b'], ancestral='ab_anc'),
MigrationRateChange(time=10000.0, rate=0, source='b', dest='a'),
MigrationRateChange(time=10000.0, rate=0, source='a', dest='b'),
MigrationRateChange(time=10000.0, rate=1e-05, source='ab_anc', dest='c'),
PopulationParametersChange(time=100000.0, initial_size=1000000.0, growth_rate=None, population='abc_anc'),
PopulationSplit(time=100000.0, derived=['c', 'ab_anc'], ancestral='abc_anc'),
MigrationRateChange(time=100000.0, rate=0, source='ab_anc', dest='c')] For example, population Hope this helps explain the behavior, but please let us know if there seem to still be issues or something else could be clarified. |
I think @apragsdale is correct here, and it's just a quirk of how msprime represents these models. The 'debug()' method should resolve these problems - hopefully this section of the docs will clarify: Does that help? |
Thanks @apragsdale and @jeromekelleher for getting back to me so quickly. You are (of course) right that the population sizes aren't lost (and clearly I could have checked for that very easily - thanks for your patience). Unless there is a logic to why models specified directly as a That's an enhancement suggestion, however - so I'll close this bug report now. Thanks both! |
What was your resolution here @simonharnqvist - does the |
@jeromekelleher - both I'm not sure I've understood your point correctly here - this is not the behaviour if I specify a model directly in msprime. Let's create the first model without migration directly as an msprime msprime_demography = msprime.Demography()
msprime_demography.add_population(initial_size=1e6, name="abc_anc")
msprime_demography.add_population(initial_size=1e6, name="ab_anc")
msprime_demography.add_population(initial_size=1e6, name="a")
msprime_demography.add_population(initial_size=1e6, name="b")
msprime_demography.add_population(initial_size=1e6, name="c")
msprime_demography.add_population_split(time=1e6, ancestral="abc_anc", derived=["ab_anc", "c"])
msprime_demography.add_population_split(time=1e5, ancestral="ab_anc", derived=["a", "b"])
msprime_demography.sort_events() Here the representation of the If I convert this to a Demes graph and then back to a demesgraph = msprime_demography.to_demes()
msprime.Demography.from_demes(demesgraph) ... the representation now loses its population sizes: If this is intended or expected behaviour, then explaning this in the docs would be very helpful - and perhaps clarifying to users whether this would have any effects on downstream simulations. |
Ah thanks - that is confusing! I suspect there may be some slight semantic differences here in the Demes model vs msprime. Let's keep this open to see if we can do any better. |
Hi,
I'm having issues converting my Demes graphs to msprime
Demography
objects; both population sizes and migration rates are missing unexpectedly. My Demes graphs match what I think I'm trying to specify, so it looks to me like a bug inmsprime.Demography.from_demes()
rather than in Demes.I first encountered this problem with msprime 1.2.0, and upgraded to 1.3.0 in a fresh environment, with the exact same behaviour. The versions of key packages for this example are:
Missing population sizes
I've specified a Demes
graph
with three current demes (a, b, c) and their ancestors (ab_anc and abc_anc):The graph looks like what I was trying to create:
And indeed population sizes are what we specified:
But when converting to an msprime
Demography
, population sizes are not preserved for the ancestral populations:This is not just a table formatting error either:
I tried also specifying
"end_size"
......but that made no difference.
Missing migration rates
Adding some migration to the demes specification:
Again, demes builds the graph that I intended to specify:
But the c -> ab_anc migration rate is missing:
The text was updated successfully, but these errors were encountered: