hcunnin6
(Hannah)
July 2, 2018, 7:20pm
1
Good afternoon, I was curious if there was some guidance on how to better pull out the specific taxa that describe the variance described in the PcoA plots within Beta-diversity and/or those that explain differences in alpha-diversity (Chao1 specifically). Perhaps this is obvious, but as someone who as usually just done a broad alpha and beta-diversity approach trying to dig deeper into these I would appreciate any guidance.
Thank you!
Hannah
Hello Hannah,
Yes! You are looking for a biplot. Basically, this ordination plots both the samples, and the taxonomy common within those samples at the same time, so you can which taxa are strongest in which parts of your ordination. They look like this:
See this pull request, in which @yoshiki demos how to make a biplot in emperor.
biocore:new-api
← ElDeveloper:biplots-new-api
opened 07:45AM - 09 Mar 18 UTC
# TL;DR
Arrow-based biplots work 🎉
We need feedback 🙏
This is a big chang… eset 🤕
cc @antgonza @mortonjt @wasade
----------------------
This pull request adds the ability for the `Emperor` class to display biplots based on the `OrdinationResults` class. This resulted in one visible change to the Python API, the `Emperor` class can now receive as a parameter feature metadata. The metadata is validated just like with sample metadata. Since feature metadata has traditionally not been as copious and readily available, `Emperor` also works when no feature metadata is present.
Internally, some methods were changed to be made feature- or sample-agnostic. And beyond this, I simplified the serialization of objects so that only a dictionary containing all the data is ever serialized, see the `_to_dict` method.
In the JavaScript API, the `DecompositionModel` class gained a new attribute, `type`. This attribute indicates whether the decomposition is a scatter type (normal plots) or an arrow type (biplots). Depending on the type the `DecompositionView` and the view controllers perform different actions. This makes it such that all controllers (that make sense) can operate on both decompositions seamlessly.
Further down the internals of the display logic, we use arrows to show biplots, these are created with a custom subclass of THREE's `ArrowHelper` class (`EmperorArrowHelper`). These objects can be interacted with just like with spheres, etc.
Through this changeset you will notice a number of changes in "random" spots, these were to account for modifications needed to truly operate on multiple decompositions.
All the menus in the attribute tabs will show metadata names under the 'biplot' name (scroll to the bottom on the dropdown). Anything you can do with a sample, you can do with an arrow, except change shape or scale as it would change the meaning of the plot itself.
### Examples
I've included a notebook that should create a live biplot so you can try this out. **Please** try this out as the functionality is rather new.
**Color and manipulate the arrows based on a feature metadata category**:

If you are curious about what happens with no metadata, unfold the gif below:
<details>

</details>
### Feedback and open items
- [x] @antgonza mentioned that it would be nice to show labels on the arrows indicating the name of the feature. We tried to think about a number of alternatives, but couldn't quite come up with something good other than labels. While the metadata can be displayed and the arrows colored, this is probably not sufficient in general. Also, labels were historically not great because they would often be rather long strings, and it was a bit hard to make anything out of them when there were more than a handful, trimming them helped but it wasn't quite the most useful thing.
- [x] ~Saving labels is a bit fuzzy right now, this would be better addressed in #634. This would be done by implementing a method for each controller `makeLegend` that way the controller can take care of any other necessary business~.
- [x] ~Saving settings is also rather fuzzy~.
- [x] ~The controllers need to implement a cache to be able to switch back and forth between categories without needing to reset custom set values~.
The real question is, is there a tutorial for making biplots using emperor ?
https://docs.qiime2.org/2018.6/plugins/available/emperor/
Colin
3 Likes
@hcunnin6 @colinbrislawn ,
The pull request Colin linked to is for emperor — emperor can now generate biplots. However, this functionality has not yet made it over to QIIME 2 because some other lesser obstacles remain; but we have an open issue to track this so we hope to add it in an upcoming release! We will report back here when this happens.
2 Likes
system
(system)
Closed
August 3, 2018, 8:10pm
4
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.