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

Recalculate radial and unrooted tree layout on clade zoom #752

Closed
wants to merge 3 commits into from

Conversation

trvrb
Copy link
Member

@trvrb trvrb commented Jul 29, 2019

This PR started with the direct goal of recalculating radial and unrooted tree layout on clade zoom. This was basically making radialLayout and unrootedLayout depend on node visibility to set bounds. These changes required some additional modifications however. These were:

  • Inclusion of a new node visibility flag to distinguish nodes that are filtered from nodes that outside of the "shell". Zooming into a radial or unrooted clade and applying layout to other branches resulted in strange layouts of out of view nodes. This had the added benefit of cleaning up the thin branches that interfered with the x-axes when zooming to clade in rectangular layout.
  • A new change arg called updateLayout is passed through reactD3Interface when zooming to clades that causes layout recalculation in a modifySVG action.

I believe this is a slight improvement over existing behavior (but definitely not as much as I was hoping for when I started on it), but please @jameshadfield, @rneher, @emmahodcroft , etc... let me know if you think existing zoom behavior is preferable. Or if you have other directions you think to take this. There are a few things (like dynamically updating radial grid lines) that need cleaning up in this PR.

Zika radial zoom before and after:

zika-before

zika-after

Zika unrooted zoom before and after:

unrooted-before

unrooted-after

The zoom animation does come out looking rather fun for these.

And I see now that this is mostly a reimplementation of @jameshadfield's js-v-vals branch. I think I prefer the current behavior of clade zoom for rectangular trees, but keeping more context around for unrooted and radial trees seems helpful.

This commit started with the direct goal of recalculating radial and unrooted tree layout on clade zoom. This was basically making radialLayout and unrootedLayout depend on node visibility to set bounds. These changes required some additional modifications however. These were:
* Inclusion of a new node visibility flag to distinguish nodes that are filtered from nodes that outside of the "shell". Zooming into a radial or unrooted clade and applying layout to other branches resulted in strange layouts of out of view nodes. This had the added benefit of cleaning up the thin branches that interfered with the x-axes when zooming to clade in rectangular layout.
* A new change arg called "updateLayout" is passed through reactD3Interface when zooming to clades that causes layout recalculation in a modifySVG action.
@jameshadfield
Copy link
Member

Cool! These directions are valuable & fun to play with.

What you've done here I think brings radial & unrooted views much closer to the current rectangular tree behavior. By this I mean that zooming into "clades" takes all the other branches & tips off screen -- looking at clade A1b/131K means you can no longer see the other ones. Changing the filtering / date range has no effect on the layout (it turns branches into skeleton ones, but the layout is the same).

There are some d3 transition details that I think would need changing. In rectangular trees, zooming into a clade is like bringing the camera into that part of the tree, so you understand what's going on. But with radial / unrooted trees it's hard to get a feeling for what's happening when you zoom into a branch -- i.e. you loose the relationship of how this clade fitted into the bigger tree.


Re: js-y-vals -- one day I'd love to revisit this. It was a bit different in the sense that I wanted to keep the entire tree in the field of view at all times, but squash nodes that weren't "visible" (e.g. filtered as well as zoomed). The idea being that you would always be able to see how your selection fitted into the entire tree. This worked really well in the y-direction but not so well in the x-direction.

@trvrb
Copy link
Member Author

trvrb commented Jul 29, 2019

You're right that these don't feel like a camera zoom and so are rather disorientating. For both radial and unrooted, I'd like it to feel like the camera is zooming into the clade of interest and alongside this, the clade unspools a bit to fill the frame better. I'll keep tinkering with this.

Also restore previous 0/1/2 node visibility flags.
@trvrb
Copy link
Member Author

trvrb commented Jul 29, 2019

@jameshadfield: Try unrooted zoom here now. I think this achieves most of what I wanted with

zooming into the clade of interest and alongside this, the clade unspools a bit to fill the frame better

I've reverted radial zoom while I try to get it working.

Want spread of clades to be determined by "inView" attribute rather than "visibility" attribute so that clade zoom causes clades to expand/contract but filtering by attribute does not.
@trvrb
Copy link
Member Author

trvrb commented Jul 29, 2019

I'm going to rebase this without all the cruft as a separate PR targeted just at unrooted zoom.

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.

2 participants