Hi, I'm simulating treesequences with slim, then adding mutations with msprime (example code below). For a sample of chromosomes, I'd like to get the ages of extant mutations, but I'm not sure how to separate the extant mutations (most recent mutation at a site for a chromosome) from ancestral mutations that have been replaced. The mutations table includes all of these with no distinction.
Ex.:
#simulating a simple tree sequence with msprime, 1-locus chromosome, ending in 5 diploid individuals
ats=msprime.sim_ancestry(5, sequence_length=1)
#binary (0 or 1) mutations, with state-dependence so no silent mutations
mts=msprime.sim_mutations(ats, rate=0.5, model=msprime.BinaryMutationModel(state_independent=False))
This gives me a treesequence with 8 mutations. At present time (generation 0, or 'present'), some of those mutations have gone extinct (fully replaced by other mutations), and some exist on one or a few chromosomes. If I want to calculate the average age of mutations:
np.mean(mts.tables.mutations.time)
The ages of all mutations that have happened on the tree are included, rather than just those that are the most recent mutation for at least 1 sample chromosome.
I'd really appreciate advice on how to get the ages (or just mean age) of extant mutations! Hopefully I'm not just missing an obvious function.
Thanks,
Daniel