Add "pack_untracked_polytomies" ability to draw_svg()#3012
Add "pack_untracked_polytomies" ability to draw_svg()#3012mergify[bot] merged 1 commit intotskit-dev:mainfrom
Conversation
|
Fixes #3011 . I'm not sure what the API should be yet. E.g. when you specify (and in addition, it's not clear to me whether this make sense as an ordering for a whole tree sequence, or just for a single tree). |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3012 +/- ##
==========================================
+ Coverage 89.82% 89.84% +0.01%
==========================================
Files 29 29
Lines 32030 32093 +63
Branches 6207 6230 +23
==========================================
+ Hits 28772 28833 +61
Misses 1859 1859
- Partials 1399 1401 +2
Flags with carried forward coverage won't be shown. Click here to find out more.
|
|
Let's not worry too much about final API and get something in there for now that we can start playing with. |
Yep, 100% agree, which is why I've left it all undocumented |
ff4860e to
2c2c502
Compare
|
After discussion with Jerome, it seemed useful to be able to collapse a subtree if (say) > 99% of the samples within it were tracked samples. It would be relatively easy to change the |
|
SGTM |
|
Cool, done. Thanks. |
This allows us to visualise trees with large polytomies (such as from tsinfer or sc2ts) by using the "tracked_samples" functionality of a constructed
tskit.Tree. Specifically, we pack all lineages in a polytomy that containing entirely "untracked" nodes, to allow us to focus on only the tracked nodes.The
drawing._postorder_tracked_minlex_traversal()function provides a way to create a postorder traversal that puts all the non tracked-node lineages on the right hand side of the polytomy, which is required for packing. At the moment I have kept this as a private function, and the new (undocumented) functionality is triggered using e.g.