Closed petrelharp closed 4 years ago
I think it starts to get tricky if all provenances are not slim provenances. msprime goes back in time, so it does not make sense to consider them for the split time.
we could make that assumption (all prov are slim prov) but checking this is true to make it more robust.
I think you just need to do like:
last_slim_prov = None
for j, (p1, p2) in enuemrate(zip(ts1.provenances, ts2.provenances)):
if p1 != p2:
break
if (p1 is a slim prov):
last_slim_prov = psylim.however_you_parse_a_prov(p1)
if last_slim_prov is None:
raise ValueError("No shared SLiM provenance entries.")
Done. See here.
Looks good!
Right now it assumes that slim_provenances and provenances are the same length. Instead, should probably parse the provenance directly instead of using slim_provenances (see pyslim code for slim_provenances; maybe using
json.reads( )
).Also: