nextstrain / auspice

Web app for visualizing pathogen evolution
https://docs.nextstrain.org/projects/auspice/
GNU Affero General Public License v3.0
292 stars 162 forks source link

Enable zoom out from tree after zooming in #936

Closed huddlej closed 4 years ago

huddlej commented 4 years ago

Motivating user story

John is interested in the hCoV-19 strains circulating in Washington State. He clicks the base node of the primary Washington State clade to zoom into that phylogenetic context (shown below). Next, John wants to view the Washington clade in the context of its sibling clades. He cannot zoom out from the current context by a single step up the tree. He has to click “Reset Layout” to return to the whole tree view, find his place in the tree again, and click the appropriate node for the ancestor of the Washington clade’s node.

image

Proposed solution

Provide an interface to allow users to “zoom out” of the tree in steps (or “step up the tree toward the root”).

The definition of a “step” up the tree can differ depending on the selected “Branch Length” mode. The figure above shows the “divergence” view of the tree where multiple strains are identical to their ancestral node (also known as a “polytomy”). For example, USA/WA1/2020 and Fujian/8/2020 and the ancestral node all have 3 mutations from the root of the tree. One step up the tree will take the user to the parent node of the ancestral node in the view above.

If the user has selected the “time” branch length view, they will see a tree like the one below instead.

image

If the user zoomed into the ancestral node of the USA/WA1/2020 sample, they would see:

image

One step up the tree from that node would be:

image

Proposed implementation ideas

Add an affordance to the root (or left-most ancestral) node in the current view to alert users that they can step up the tree by clicking something (e.g., the root again, or a nearby button, etc.).

Add a left arrow button (like https://fontawesome.com/icons/arrow-circle-left) that would allow the user to step up the tree once per click.

Consider implementing one “step” based on the divergence view of the tree regardless of the currently selected branch length view. This implementation could be more biologically relevant and easier to actually implement in the existing tree component. In this implementation, one step up from the zoomed in view of USA/WA1/2020 and Fujian/8/2020 above would look like the following (where USA/WA1/2020 is the earliest large red circle):

image

This is because the divergence values of USA/WA1/2020 and the other intermediary ancestral nodes shown in the time view are identical.

Alternately, consider implementing one step as a delta of the existing branch length view (e.g., divergence of 1 or time of 1 month).

lukas-eu commented 4 years ago

I would like to take over this issue but with a slightly modified goal: Enable graph zooming and navigation via scrolling/buttons and "grabbing" the graph (analogous to the map view)

In the context of this COVID-19 themed hackathon we formed a team to support open-source visualization tools for researchers. Specifically, one of our team members who is connected to the research community requested for the tree zooming to be more arbitrary/smooth overall.

lukas-eu commented 4 years ago

Issued PR for the original scope of the issue: https://github.com/nextstrain/auspice/pull/965

Arbitrary zooming seems non-trivial due to implementation specifics of the tree SVG. I will take another look and potentially create a follow-up issue.

jameshadfield commented 4 years ago

Enable graph zooming and navigation via scrolling/buttons and "grabbing" the graph (analogous to the map view)

Worth saying that we used to have this and removed it as it was often confusing and hard to use. In general, this functionality is desirable for auspice and PRs are welcome, but there are lots and lots of edge cases that need to be taken into account. If you do wish to pursue this please make an issue detailing your proposal so we can comment on it / highlight edge cases to consider.

lukas-eu commented 4 years ago

I was planning to play around with cytoscape a little to see if that could be a good solution for the graph visualization, but then I saw that this started https://github.com/nextstrain/auspice/issues/968 Starting a competing implementation in parallel might not be the best thing to do.

If you think it makes sense though I'll look into it.

jameshadfield commented 4 years ago

Closed via #1001