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

Download data improvements #1245

Merged
merged 6 commits into from
Jan 5, 2021
Merged

Download data improvements #1245

merged 6 commits into from
Jan 5, 2021

Conversation

jameshadfield
Copy link
Member

@jameshadfield jameshadfield commented Dec 17, 2020

This PR makes a number of improvements to the download-data functionality in auspice. See individual commit messages for specifics. Testing on diverse datasets would be highly valuable at this point.

This PR introduces consistency by making downloaded data represent the selected data (before it was different depending on what was being downloaded). This means that if you have manipulated the data (e.g. zoomed the tree, filtered the dataset) then every downloaded file -- trees, metadata, entropy -- will reflect this.

We also allow the abliity to download BEAST-style Nexus trees which can be read by FigTree. These are annotated with all of the colorings in the dataset (as well as genotype and div, as applicable). I failed to find a proper schema for the annotations block, which means there's likely some scenarios where exported trees can't be read by FigTree. I also imagine there's more annotations which can be exported, such as defining colours for annotation values. Please let me know of any you come across! This functionality allows nextstrain data to be used in FigTree -- for instance, here's a global nCoV tree filtered to England samples and zoomed to clade 20B in Auspice, exported, imported into FigTree, and annotated there by mapping tip colours to pangolin lineage, tip labels to num_date, node labels to num_date_CI, tip & node shapes to divergence.

image

This splits apart the download modal react component into two: one for the main modal layout, and another for the download buttons. This improves separation and paves the way for improvements to the download buttons. There should be no changes in behavior arising from this commit.
Previously this triggered an automatic screenshot (SVG) download, which was dev-only, undocumented functionality that made it into production.

Here we map "d" to open the download modal which is both more expected, and helpful for the current work. This key shortcut can either be removed in this PR or documented and released as-is.
Previously certain downloaded files (e.g. trees) represented all data, certain files only represented selected (visible) data (e.g. entropy) and some could do both (e.g. there were two metadata buttons).

This commit moves to having all buttons behave in a consistent manner -- if the data is subsetted (filtered, zoomed etc) then only the visible nodes will be part of the download.

All file exports _except_ trees are updated in this commit.
(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.
Similar to current Newick export except in a format conforming with BEAST such that it can be read by FigTree.
@jameshadfield jameshadfield temporarily deployed to auspice-download-improv-l32usy December 17, 2020 18:54 Inactive
Copy link
Contributor

@cassiawag cassiawag left a comment

Choose a reason for hiding this comment

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

I demoed this today on WA trees (https://dev.nextstrain.org/groups/blab/ncov/wa/1y), and overall it works super well!

I thought it was very clear that I only downloaded data for the tips that were filtered and zoomed. It did take me awhile (several days) to figure out how to download divergence trees. This is probably because I'm used to the previous interface. I'd be a fan of including divergence tree options, even if the tree is set to time tree. Alternatively, you could be very explicit in the description. Something along the lines of: "The current view is displaying data for X/X tips in units of time. To download trees in units of divergence, please switch to divergence tree."

Also, I didn't do much with the Nexus tree, so it might be worth having someone who uses Nexus trees frequently (@nicfel maybe?) try it out.

This makes behavior consistent with the idea that downloaded data represents the current view. It also prevents a bug when trying to download a temporally scaled tree for a non-temporal dataset.
@jameshadfield jameshadfield merged commit 0c70781 into master Jan 5, 2021
@jameshadfield jameshadfield deleted the download-improvements branch January 5, 2021 20:39
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