-
Notifications
You must be signed in to change notification settings - Fork 23
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
recapitation attempts to use null genomes #357
Comments
Hi! I think |
Thanks for the answer. The defined demography in the python script is not used in recapitate function (I forgot to comment them). Indeed the defined demography is for sim_ancestor() function and it will give another error like "infinite time for coalescent ......., balabala" |
OK. Please provide a complete, minimal SLiM script that can be used to reproduce this problem, and please also provide a correct and minimal Python script to reproduce the problem. |
Ok thank you. I don't have the scripts at hand and will post them tomorrow. Thank you again
获取Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Ben Haller ***@***.***>
Sent: Tuesday, December 24, 2024 10:15:24 PM
To: tskit-dev/pyslim ***@***.***>
Cc: Hongjin Wu ***@***.***>; Author ***@***.***>
Subject: Re: [tskit-dev/pyslim] pyslim.recapitate error (Issue #357)
OK. Please provide a complete, minimal SLiM script that can be used to reproduce this problem, and please also provide a correct and minimal Python script to reproduce the problem.
―
Reply to this email directly, view it on GitHub<#357 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AO4Y6BD6VT5G4HOH3TRFYM32HFT7ZAVCNFSM6AAAAABUECBPN2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRRGE3TGNRWGI>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
recapitate.py.zip please find the scripts in the attachments. Thanks. |
Thanks. It is Christmas here; I imagine @petrelharp will have a look at this some time after that. :-> |
Ok thanks. Merry Christmas.
获取Outlook for Android<https://aka.ms/AAb9ysg>
…________________________________
From: Ben Haller ***@***.***>
Sent: Wednesday, December 25, 2024 10:10:52 PM
To: tskit-dev/pyslim ***@***.***>
Cc: Hongjin Wu ***@***.***>; Author ***@***.***>
Subject: Re: [tskit-dev/pyslim] pyslim.recapitate error (Issue #357)
Thanks. It is Christmas here; I imagine @petrelharp<https://github.com/petrelharp> will have a look at this some time after that. :->
―
Reply to this email directly, view it on GitHub<#357 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AO4Y6BCMQALZY2FGXBB3TN32HK4GZAVCNFSM6AAAAABUECBPN2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRRHEYDKNZZHA>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Thanks for the report, @Hongjinwu - it turns out that Here is a MWE (substantially pared down from your code):
and then
I'll follow up with a workaround for you. |
Okay - here's a workaround:
(Note I'm setting a small Ne just so it runs fast.) |
Interesting. Note that the next SLiM will not use null genomes in a pure haploid model; but will still use them for the haploids in, say, a model of haplodiploidy. So both way of recording haploids will be possible, depending on the model. Just injecting that into the conversation here, since it might influence the fix you decide to do. |
Well, thankfully we have that sanity check in; otherwise this would be quite a bad and silent error! |
Thanks very much for the help! |
edit: Scroll down for the underlying issue.
the code:
import pyslim
import tskit
import msprime
orig_ts = tskit.load("test_true.trees")
demography = msprime.Demography()
demography.add_population(name="pop_0", initial_size=10000)
demography.add_population(name="p1", initial_size=10000)
demography.add_population(name="p2", initial_size=10000)
demography.add_population(name="p3", initial_size=10000)
demography.add_population(name="p4", initial_size=10000)
rts = pyslim.recapitate(orig_ts, ancestral_Ne=1e4)
rts.dump("true_recapitated.trees")
the issue:
Traceback (most recent call last):
File "/sim_data/sim28/recapitate.py", line 14, in
rts = pyslim.recapitate(orig_ts, ancestral_Ne=1e4)
File "/home/miniconda3/lib/python3.9/site-packages/pyslim/methods.py", line 77, in recapitate
raise ValueError(message)
ValueError: Not all roots of the provided tree sequence are at the time expected by recapitate(). This could happen if you've simplified in python before recapitating (fix: don't simplify first). If could also happen in other situations, e.g., you added new individuals without parents in SLiM during the course of the simulation with sim.addSubPop(), in which case you will probably need to recapitate with msprime.sim_ancestry(initial_state=ts, ...). (Expected root time: 27372; Observed root times: [0.0, 27372.0])
and I do not understand why the there is a population named "pop_0" in the true trees. but "pop_0" dose not exit in my slim simulation code.
1 first(){
sim.addSubpop("p1",50,haploid=T); //add population with size 50
sim.addSubpop("p2",50,haploid=T);
sim.addSubpop("p3",50,haploid=T);
sim.addSubpop("p4",50,haploid=T);
}
dose anyone know how to fix this?
The text was updated successfully, but these errors were encountered: