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
Use msprime's wirght-fisher model (model='dtwf') for simulation #392
Comments
Definitely, and it I think it's a pretty straightforward addition to have We should also consider a hybrid model while we're doing this, where we do dtwf for some number of generations and switch to the standard Hudson model afterwards. |
It should be really easy to add it as an engine. E.g. something like below.
It should probably accept an additional parameter indicating the generation
to switch to the Hudson model. And possibly the msprime engine classes
should be moved to an msprime_engine.py file.
…-G
diff --git a/stdpopsim/engines.py b/stdpopsim/engines.py
index 7a7cc2f..ec3c869 100644
--- a/stdpopsim/engines.py
+++ b/stdpopsim/engines.py
@@ -128,3 +128,27 @@ def get_default_engine():
Returns the default simulation engine (msprime).
"""
return get_engine("msprime")
+
+class _MsprimeDTFWEngine(Engine):
+ id = "msprime-dtfw"
+ description = "Msprime discrete-time Wright Fisher simulator"
+ citations = [
+ ...
+ ]
+
+ def simulate(self, demographic_model=None, contig=None, samples=None,
seed=None,
+ **kwargs):
+ return msprime.simulate(
+ samples=samples,
+ recombination_map=contig.recombination_map,
+ mutation_rate=contig.mutation_rate,
+
population_configurations=demographic_model.population_configurations,
+ migration_matrix=demographic_model.migration_matrix,
+ demographic_events=demographic_model.demographic_events,
+ random_seed=seed,
+ model="dtwf")
+
+ def get_version(self):
+ return msprime.__version__
+
+register_engine(_MsprimeDTFWEngine())
On Thu, 30 Jan 2020 at 09:12, Jerome Kelleher ***@***.***> wrote:
Definitely, and it I think it's a pretty straightforward addition to have
--engine=msprime-dtwf, or similar. @grahamgower
<https://github.com/grahamgower>, have you thoughts on how to do this?
We should also consider a hybrid model while we're doing this, where we do
dtwf for some number of generations and switch to the standard Hudson model
afterwards.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#392?email_source=notifications&email_token=ACCDP5JTFJOFYZZTI2LLIUDRAKDYXA5CNFSM4KNPEPFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKKCH5Q#issuecomment-580133878>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACCDP5KJWG3JOUC43QMWGUTRAKDYXANCNFSM4KNPEPFA>
.
|
Or, perhaps it should be a "--model" option to the msprime engine? We can also imagine supporting the SMC models in stdpopsim at some point, if that turns out to be the only reasonably way to simulate drosophila chromosomes. Agreed that we should have an mspirme_engine module. |
Yep, that would work too. Then it also needs a flexible way of specifying
msprime.SimulationModelChange event(s) with the CLI.
If certain species and/or demographic models behave best with a specific
engine (or engine parameters), perhaps we need to provide a hint of some
sort for this. E.g. to print out the recommended configuration, or set the
default engine instead of having a global default engine.
…On Thu, 30 Jan 2020 at 12:07, Jerome Kelleher ***@***.***> wrote:
Or, perhaps it should be a "--model" option to the msprime engine? We can
also imagine supporting the SMC models in stdpopsim at some point, if that
turns out to be the only reasonably way to simulate drosophila chromosomes.
Agreed that we should have an mspirme_engine module.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#392?email_source=notifications&email_token=ACCDP5JBK2T75IXOXYGY63TRAKYI3A5CNFSM4KNPEPFKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKKTGOA#issuecomment-580203320>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACCDP5JCCYFYZSM66VQV3C3RAKYI3ANCNFSM4KNPEPFA>
.
|
Closes popsim-consortium#392. Includes related doc changes which closes popsim-consortium#361.
Closes popsim-consortium#392. Includes related doc changes which closes popsim-consortium#361.
Closes popsim-consortium#392. Includes related doc changes which closes popsim-consortium#361.
Closes popsim-consortium#392. Includes related doc changes which closes popsim-consortium#361.
Closes popsim-consortium#392. Includes related doc changes which closes popsim-consortium#361.
Based on this preprint, https://www.biorxiv.org/content/10.1101/674440v1.full.pdf, it is better to simulate large sample/large chromosome region using the wright-fisher model in msprime. Could such functionality be provided in stdpopsim as well? (Correct me if it's already there, maybe I just missed it from the API). Thx!
The text was updated successfully, but these errors were encountered: