Skip to content

Added "order" argument to drawing functions. #566

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2020

Conversation

jeromekelleher
Copy link
Member

Add a new order argument to the various drawing functions that can be either tree (the natural order arising from the quintuply linked trees) or minlex, the ordering from @brianzhang01's minlex_postorder tree traversal functions.

Since this is much better, we've changed the default ordering, so that people's trees will look different now. The small chance of breakage seems worth it. As this is a breaking change, I've pinged a good few of you for review - feel free to just ignore this or "approve" if you're not bothered.

This ended up being a bit more involved than I had expected, but I think it's good now.

Closes #389

@codecov
Copy link

codecov bot commented Apr 30, 2020

Codecov Report

Merging #566 into master will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #566      +/-   ##
==========================================
+ Coverage   87.35%   87.36%   +0.01%     
==========================================
  Files          22       22              
  Lines       16682    16696      +14     
  Branches     3260     3262       +2     
==========================================
+ Hits        14573    14587      +14     
  Misses       1030     1030              
  Partials     1079     1079              
Flag Coverage Δ
#c_tests 88.61% <100.00%> (+0.01%) ⬆️
#python_c_tests 90.44% <100.00%> (+0.01%) ⬆️
#python_tests 99.05% <100.00%> (+<0.01%) ⬆️
Impacted Files Coverage Δ
python/tskit/trees.py 98.18% <ø> (ø)
python/tskit/drawing.py 99.82% <100.00%> (+<0.01%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 88f043c...ce366cf. Read the comment docs.

Copy link
Contributor

@petrelharp petrelharp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good!

@jeromekelleher
Copy link
Member Author

This can wait until #555 is in.

@brianzhang01
Copy link
Member

Only took a skim, but it looks good to me.

@hyanwong
Copy link
Member

hyanwong commented May 5, 2020

Yeah. LGTM too. I worried that I might need a minlex_preorder function for the new SVG drawing functionality, but it turns out not, and this change should slot in quite easily.

@jeromekelleher
Copy link
Member Author

OK, great. Let's try to get the main SVG stuff in first and then I'll update this PR.

@hyanwong
Copy link
Member

hyanwong commented May 5, 2020

@jeromekelleher the main SVG stuff is ready to merge I think.

Copy link
Member

@benjeffery benjeffery left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Just a couple of typos in docstrings, and one code style suggestion that I'm not very attached to.

@jeromekelleher
Copy link
Member Author

Great, thanks @benjeffery. I'll rebase this and fix conflicts when @hyanwong's merge queue has settled down, no point in making his life more difficult right now.

@benjeffery
Copy link
Member

Talking to @hyanwong that he'd like this in first - are you happy for me to rebase and merge?

@jeromekelleher
Copy link
Member Author

Sure, if you don't mind resolving the merge conflicts here. I think it's a mistake though, as it'll add a bunch more conflicts for @hyanwong to resolve in his series of PRs.

Note this changes the default order in which nodes are output in trees
from the natural tree order to the minlex order which minimises the
difference between adjacent trees.

Closes tskit-dev#389
@benjeffery benjeffery merged commit 732df87 into tskit-dev:master May 7, 2020
@jeromekelleher jeromekelleher deleted the draw-minlex branch May 7, 2020 16:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Given a tree sequence, draw marginal trees emphasising similarity between neighbouring trees
5 participants