biocore / empress

A fast and scalable phylogenetic tree viewer for microbiome data analysis
BSD 3-Clause "New" or "Revised" License
45 stars 31 forks source link

Using a hierarchy over sample-ids in an Empire plot #437

Open wasade opened 3 years ago

wasade commented 3 years ago

We have a usecase where we have a tree structure that relates samples together, and it would be nice to use this within an Empire plot. The general usecase with Empire plots is a tree with tips that correspond to feature-ids, whereas in this instance, the tips of tree correspond to sample-ids.

Is it possible to use the empire plots right now for this situation?

(sorry if this is a replicate issue, I didn't see it when looking though)

cc @zoechallacombe

antgonza commented 3 years ago

Good question! Now, I'm wondering if we could use something like this in the beta rarefaction results and display the "UPGMA clustering" and PCoA side by side ...

fedarko commented 3 years ago

I don't think this will be possible with Empire plots (currently!) unless the ordination you're looking at is also "inverted", i.e. the points are samples features. Even if that is the case I think this would require some confusing CLI stuff, e.g. passing in the sample metadata as "feature metadata" and vice versa (which IIRC is a paradigm that has caused a bunch of headaches for users of mmvec/songbird biplots in some cases).

Altering the Emperor integration code to actually treat the tips as samples would be feasible with some effort, but I think this would require rewriting most of the callback code for this additional case—and since a lot of these callbacks are not formally covered by tests yet, things could get hairy.

This is a really interesting case though!

wasade commented 3 years ago

@antgonza that would be awesome!

@fedarko, ya I think it would be a terrible abuse at the moment. What about a boolean flag with plugin setup that is --p-tree-tips-as-samples or something? I can see why some of the callbacks may get weird but for much of this it is effectively the logical opposite axis to features (relative to the feature table at least) so it is possible the delta may be smallish

tanaes commented 3 years ago

Not the same use-case, but in general I find it useful to organize samples hierarchically for paired displays, for example ordering heatmaps around the edge of the tree when looking phylogenetically organized host samples.

ElDeveloper commented 3 years ago

This is a great idea, like @fedarko notes this might require some finesse but it would ultimately be great to add. @kwcantrell and @gwarmstrong are working on formalizing the callback code as part of some related work they are currently doing.

@antgonza's point is great, this could potentially replace the two separate tabs in the beta-rarefaction visualizer over in qiime2/q2-diversity.