Msprime: unequal branch lengths in species tree

Created on 1 Dec 2020  路  5Comments  路  Source: tskit-dev/msprime

consider the simplest example of two populations separated since some time T ago, but specifying the species tree with unequal branch lenghts does not raise a warning or an error:

import msprime
from IPython.display import SVG
phylogeny = msprime.parse_species_tree(tree="(popA:100.0,popB:10.0)",Ne=1000)
print(phylogeny)

here the branch lengths to popA and popB should be the same, but in the example above they are not, and this mistake is
not caught

bug

Most helpful comment

From what I understand in the new Demography API, there is no notion of population existence times (as there is in demes). There's nothing stopping you from drawing a sample from a population at any time, for example even times deeper than when mass migration moved all present lineages to a different population for the split event.

So either 1) yes, this is a bug and a phylogeny is required to be ultrametric, or 2) there would need to be an additional parameter that says sampling is not allowed during certain times, based on the "end times" of each branch (in the example from this issue, no sampling would be allowed in popB for the most recent 90 generations).

We handle that second case in demes, but maybe for parse_species_tree() we enforce the first case?

All 5 comments

The simplest solution here is to raise an error, but we need to consider the problem of drawing samples from populations too. This seems like a clear example where a population should have a sampling_time attribute which determines the default time samples are drawn from when we write demography.sample(population_name=n).

I'm going to label this as a bug for now anyway, since we're clearly doing the wrong thing at the moment.

@grahamgower, @apragsdale - any opinions on what we should do for sampling times in the new Demography API, and how this should interact with upstream demes?

From what I understand in the new Demography API, there is no notion of population existence times (as there is in demes). There's nothing stopping you from drawing a sample from a population at any time, for example even times deeper than when mass migration moved all present lineages to a different population for the split event.

So either 1) yes, this is a bug and a phylogeny is required to be ultrametric, or 2) there would need to be an additional parameter that says sampling is not allowed during certain times, based on the "end times" of each branch (in the example from this issue, no sampling would be allowed in popB for the most recent 90 generations).

We handle that second case in demes, but maybe for parse_species_tree() we enforce the first case?

I agree with @apragsdale here. Do the simple thing for now (raise an error). When demes is pulled in, that can be used to check for invalid sampling times and/or provide a default sampling time (e.g. the first valid time closest to the present).

This seems like an edge case though---I'm not sure there are other circumstances where a non-zero default sampling time makes sense. You don't really want a non-zero default sampling time here either, that's just a hack to give different rates of genetic drift along the branches. The tree more reasonably suggests there are unmodelled population size differences, or possibly distinct mutation rates or generation times along the branches.

OK, sounds good, I'll raise an error. Thanks for the input.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeromekelleher picture jeromekelleher  路  4Comments

jeromekelleher picture jeromekelleher  路  13Comments

jeromekelleher picture jeromekelleher  路  11Comments

jeromekelleher picture jeromekelleher  路  4Comments

nspope picture nspope  路  12Comments