Replies: 1 comment 6 replies
-
This is an interesting one @stsmall, and I guess it's probably a statistic we should add to the library. I don't have time to think this through properly, but I wonder if you'd considered using the num_tracked_samples as a way to possibly do this? e.g. import msprime
ts = msprime.sim_ancestry(10, random_seed=234)
iter1 = ts.trees(tracked_samples=[0, 1, 2])
iter2 = ts.trees(tracked_samples=[3, 4, 5])
for tree1, tree2 in zip(iter1, iter2):
for u in tree1.nodes(order='timeasc'):
n1 = tree1.num_tracked_samples(u)
n2 = tree2.num_tracked_samples(u)
n = tree1.num_samples(u)
# Reason about n1, n2 and n?
print(u, n, n1, n2) |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi All,
I was attempting to calculate the cross-coalescent as defined from Hejase et al. 2020 (bioRxiv link).
Defined in section: A Test for Elevation in Cross-Coalescence Time ... "For a given local tree and pair of species, we considered the 10 most recent cross coalescent events between the two species and normalized these ages, as in test 2, by the age of the youngest subtree that contains at least half of the total number of haploid samples."
The way I conceived of it was to calculate all the mrcas for each pair of samples from a tree and then sort and take the youngest 10. This is clearly very inefficient. Any ideas on a more efficient search?
my inefficient attempt ...
Beta Was this translation helpful? Give feedback.
All reactions