Tskit: draw_ methods ignore mutation_time

Created on 5 Sep 2020  路  3Comments  路  Source: tskit-dev/tskit

At the moment, draw_svg() spaces apart mutations evenly on a branch. Now that we have introduced mutation times we should really use the time value (if defined) to place mutations on branches when drawing trees.

This would be easy, apart from the fact that there may be mutations above the root. In this case, we need to scale the tree so that, rather than a fixed root branch length (which is a hack anyway), the tree height is given by the oldest mutation above the root node. When plotting a whole tree sequence, we need to find the oldest of these values. Unfortunately, this is not quite as easy as finding max(ts.tables.mutations.time), because I think we can have valid mutations that are not above any node on any tree. We previously hit this issue for node times, and solved it by defining a ts.max_root_time property. I wonder if we now need a ts.max_mutation_time property too?

Python API enhancement

Most helpful comment

I think max(ts.tables.mutations.time) is all we need for drawing - having a mutation above an isolated non-sample node that is older than the mutations above the roots is a pretty remote corner case.

All 3 comments

I think max(ts.tables.mutations.time) is all we need for drawing - having a mutation above an isolated non-sample node that is older than the mutations above the roots is a pretty remote corner case.

@hyanwong Looks like we can close this, yes?

Just looking through the list of old issues. I don't think this has actually been implemented yet, so we should leave it open. Sorry!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeromekelleher picture jeromekelleher  路  7Comments

jeromekelleher picture jeromekelleher  路  3Comments

jeromekelleher picture jeromekelleher  路  4Comments

gtsambos picture gtsambos  路  9Comments

bhaller picture bhaller  路  6Comments