Description
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?