msprime.Demography.from_species_tree() is very picky about ultrametricity. All nodes must be within 1e-8 of time zero. The role phylogeny sometimes results in tips that violate this requirement and it errors out:
ValueError: All leaf populations must be at time 0: time=2.8421709430404007e-08
role_msprime.py includes a function called _force_ultrametric(tree) which walks the newick tree and sets all leaf nodes to exactly the same depth. It "works" in the sense that it seems to work, but I remain unconvinced. If ValueErrors start popping up we'll need to triage this a bit more.
I have a hunch that the phylogeny occasionally fails to be exactly ultrametric because of extinction and pruning in the metacommunity process, but I haven't explored this further, just to document the thought.
msprime.Demography.from_species_tree()
is very picky about ultrametricity. All nodes must be within 1e-8 of time zero. The role phylogeny sometimes results in tips that violate this requirement and it errors out:role_msprime.py includes a function called
_force_ultrametric(tree)
which walks the newick tree and sets all leaf nodes to exactly the same depth. It "works" in the sense that it seems to work, but I remain unconvinced. If ValueErrors start popping up we'll need to triage this a bit more.I have a hunch that the phylogeny occasionally fails to be exactly ultrametric because of extinction and pruning in the metacommunity process, but I haven't explored this further, just to document the thought.