Skip to content
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

ancestral branch thicknesses (below CA) should be minimal #1240

Closed
jameshadfield opened this issue Dec 10, 2020 · 4 comments · Fixed by #1257
Closed

ancestral branch thicknesses (below CA) should be minimal #1240

jameshadfield opened this issue Dec 10, 2020 · 4 comments · Fixed by #1257
Assignees

Comments

@jameshadfield
Copy link
Member

jameshadfield commented Dec 10, 2020

This issue may represent two independent problems, but I suspect they are highly related.

  1. Upon filtering the data, all branches ancestral to the common ancestor of the selected strains should have minimum thickness. These branches are circled in the following screenshot.

2. Upon filtering the data, the tree should zoom in to the CA node - in other words, the same behavior as if one clicked on that branch.

Complication to 2: unsure what behavior is best when toggling selected filters as visible / invisible if that action were to modify the CA


image
Figure 1: https://nextstrain.org/zika?f_region=North%20America, displayed using auspice 2.20.1

@trvrb
Copy link
Member

trvrb commented Dec 10, 2020

I considered (2) previously and even implemented it on a demo branch, but felt that it was too "jumpy" especially for things like date slider interactions and you'd lose your place. I think I'd still recommend a "zoom to selected" button in the tree panel to accomplish this. #1132 is related.

@emmahodcroft
Copy link
Member

I agree with 1 but I also have concerns about 2. I think this could get really jumpy and I'm also not sure if it is always desired behaviour. Often (now that filters can turn on and off more easily) I'm flipping these on and off pretty fast for various countries in Europe (for example) and part of what I'm looking at is how they distribute across the tree, part of tree, or cluster that I've zoomed to. So if it was rezooming all the time this would be super annoying. (Ex: Do we have early samples from Finland in 19A? What about France? What about Spain? Are samples from Ireland in 'both branches' of 439 cluster? What about Switzerland?)

I'd second Trevor's idea about a 'zoom to selected' button, to make zooming to filtered easy, though!

@jameshadfield
Copy link
Member Author

Thanks both! Sounds like the best course of action is to not implement (2) here, instead going with #1132

@jameshadfield jameshadfield changed the title Filtering should zoom tree and ancestral branch thicknesses should be minimal ancestral branch thicknesses (below CA) should be minimal Dec 10, 2020
jameshadfield added a commit that referenced this issue Dec 17, 2020
(See previous commit message for context).

Exported trees now represent the visible (and in-view) tree.

Note that exported trees of filtered datasets often contain nodes higher (more ancestral) than the expected root. This is the bug reported in #1240.
@jameshadfield
Copy link
Member Author

@joverlee521 -- without diving into the code, my instinct would be that the visibility array is at fault here. As a bit of background:

  • visibility is an array such that the visibility of node[i] is found at visibility[i]. It refers to whether a node is within the currently active (sub)tree - for instance all the "thin" branches in the figure above should have visibility[nodeIdx] !== NODE_VISIBLE -> true. The visibility of nodes above (ancestral to) the CA should be NODE_NOT_VISIBLE
  • the inView property of a node is subtly different to visibility and refers to the nodes that are out of the current tree-panel view. This is relevant when zooming into the tree.
  • Branch thicknesses are calculated using the visibility data, and are stored in a similar fashion, where node[i]'s branch thickness is found at branchThickness[i].

(This is all going off my memory, so take it with a grain of salt!)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants