Skip to content
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

pyslim.recapitate error #358

Closed
Hongjinwu opened this issue Dec 24, 2024 · 1 comment
Closed

pyslim.recapitate error #358

Hongjinwu opened this issue Dec 24, 2024 · 1 comment

Comments

@Hongjinwu
Copy link

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?

@bhaller
Copy link
Collaborator

bhaller commented Dec 24, 2024

This appears to be an exact duplicate of #357. Closing.

@bhaller bhaller closed this as completed Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants