Skip to content

Conversation

hyanwong
Copy link
Member

@hyanwong hyanwong commented Mar 19, 2021

Description

New parameter all_edge_mutations (default False, and only for Tree.draw_svg() not TreeSequence.draw_svg()) that plots "extra" mutations on a single tree. The default is to plot these in HotPink, and to extend the X axis (if show, which it isn't by default), to show the position of the extra mutations outside the tree interval:

Screenshot 2021-03-19 at 09 03 24

Probably needs a few more tests, but opening this PR for feedback. I generalised the "background shading" function so that it could be used on a tree as well as a tree sequence.

Fixes #1253

PR Checklist:

  • Tests that fully cover new/changed functionality.
  • Documentation including tutorial content if appropriate.
  • Changelogs, if there are API changes.

@codecov
Copy link

codecov bot commented Mar 19, 2021

Codecov Report

Merging #1258 (5b384a5) into main (c84a89b) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1258      +/-   ##
==========================================
+ Coverage   93.77%   93.78%   +0.01%     
==========================================
  Files          26       26              
  Lines       21939    21991      +52     
  Branches      971      987      +16     
==========================================
+ Hits        20573    20625      +52     
  Misses       1325     1325              
  Partials       41       41              
Flag Coverage Δ
c-tests 92.49% <ø> (ø)
lwt-tests 92.97% <ø> (ø)
python-c-tests 95.03% <100.00%> (+0.02%) ⬆️
python-tests 98.67% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
python/tskit/trees.py 97.44% <ø> (ø)
python/tskit/drawing.py 99.12% <100.00%> (+0.05%) ⬆️

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 c84a89b...5b384a5. Read the comment docs.

@hyanwong hyanwong force-pushed the outside-mutations branch 2 times, most recently from 90c300d to 2dc4fac Compare March 19, 2021 10:47
@hyanwong hyanwong marked this pull request as ready for review March 19, 2021 10:48
@hyanwong hyanwong requested a review from benjeffery March 19, 2021 10:48
@benjeffery
Copy link
Member

Will review later - just a quick comment to ask if we are at the point where a legend might be helpful?

@hyanwong
Copy link
Member Author

Will review later - just a quick comment to ask if we are at the point where a legend might be helpful?

Thanks @benjeffery. No hurry on this.

Personally, I don't think we are quite at that point yet. The various fancy graphics I've added aren't always very suited to explaining in a legend (I'm thinking of background shading, and, to a lesser extent, ticks & sites on the X axis); also this is only relevant for a single tree, so the legend stuff in trees vs tree sequences could get messy. But other views welcome.

@grahamgower
Copy link
Member

If you're open to some bike-shedding @hyanwong, I'd like to suggest that it would be better to have slightly more contrast between red/pink than HotPink provides.

@hyanwong
Copy link
Member Author

After discussion with @jeromekelleher, I'm temporarily switching this to a draft PR again so that we can generalise the "edges above tree nodes" function in a separate PR first.

@hyanwong hyanwong marked this pull request as draft March 19, 2021 11:39
@hyanwong
Copy link
Member Author

If you're open to some bike-shedding @hyanwong, I'd like to suggest that it would be better to have slightly more contrast between red/pink than HotPink provides.

How about PaleVioletRed @grahamgower?

Screenshot 2021-03-19 at 11 49 26

I think LightPink may be too faded to be easily visible:

Screenshot 2021-03-19 at 11 50 55

@grahamgower
Copy link
Member

grahamgower commented Mar 19, 2021

How about PaleVioletRed @grahamgower?

That's better, but the difference is still fairly small. I understand that red/green colourblindness is often driven by poor ability to distinguish reds from gray, so if you have any red-challenged friends, it might be worth asking them.

@hyanwong hyanwong mentioned this pull request Mar 19, 2021
3 tasks
@awohns
Copy link
Member

awohns commented Mar 19, 2021

I just checked with two colour-blind folks, they can see the difference in the PaleVioletRed example clearly

@hyanwong
Copy link
Member Author

hyanwong commented Mar 19, 2021

I just checked with two colour-blind folks, they can see the difference in the PaleVioletRed example clearly

That's really helpful. Thanks @grahamgower @awohns

@hyanwong hyanwong force-pushed the outside-mutations branch from 2dc4fac to 6d945bc Compare March 20, 2021 09:13
@hyanwong
Copy link
Member Author

OK, this now uses the new tree._node_edges() method, so I'm re-open ing for review.

@hyanwong hyanwong marked this pull request as ready for review March 20, 2021 09:38
Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

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

Looks good, minor comments.

@hyanwong hyanwong force-pushed the outside-mutations branch 2 times, most recently from 484f353 to fdb46b8 Compare March 22, 2021 11:03
Copy link
Member

@jeromekelleher jeromekelleher left a comment

Choose a reason for hiding this comment

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

Looks good, thanks.

@hyanwong hyanwong force-pushed the outside-mutations branch 2 times, most recently from f524cc9 to da53b90 Compare March 23, 2021 11:16
@jeromekelleher
Copy link
Member

Ready to merge I think - @benjeffery?

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.

LGTM, one minor thing in the changelog.

@mergify mergify bot merged commit 1510d2a into tskit-dev:main Mar 24, 2021
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.

Plot mutations on a single tree even if they are outside the tree span
5 participants