Comments (11)
This should be possible with
library(mia)
library(miaViz)
data(GlobalPatterns)
tse <- GlobalPatterns
plotAbundance(tse, abund_values="counts", rank = "Phylum", order_sample_by = "Bacteroidetes")
However, when selecting order_sample_by = "Bacteroidetes"
the figure does not seem to be sorted by Bacteroidetes abundance.
Check why, and fix if necessary or add an option to sort based on the abundance of a given taxonomic group at the chosen level (as in the visualization example in microbiome tutorial linked above).
PR the changes to miaViz (if needed) and then add an example to OMA, section on community composition.
I suggest that @ChouaibB works on this, supervised by @tvborm . Then me and @FelixErnst will support where necessary.
from miaviz.
Ah, right. Of course, this does not work that well with the count assay.
I suggest the following:
-
The figure was confusing with the count assay because I overlooked the fact that the data is visualized as relative abundances anyway. A warning might be in place if one tries to run this with something else than "relabundance" assay but the visualization is done with relabundance anyway? Then it looks like sample sorting is not correct, although it is.
-
Before the visualization, add a line that aggregates the rare taxa to "Other" category; an example is already shown in OMA section on Visualizing the most dominant genus on PCoA
-
Can we add this example with relabundance to OMA, sorting by Bacteroidetes and showing the top-5 taxa + "Other"
from miaviz.
Also improvisaatio function documentation, I couldnt figure out from that. Ask support from the authors of this function if necessary
from miaviz.
How about:
"plotAbundance(tse, abund_values="counts", rank = "Phylum", order_rank_by="revabund", order_sample_by = "Bacteroidetes")"
It gives the following:
from miaviz.
Relative values are calculated by default through use_relative=TRUE
Just one more comment about sorting by samples. I might be a bit confused still, because I tried the following and it seems it does sort the samples:
library(mia)
library(miaViz)
data(GlobalPatterns)
tse <- GlobalPatterns
plotAbundance(tse, rank="Phylum", add_legend=FALSE, add_x_text=TRUE) +
theme(axis.text.x.bottom = element_text(angle = 90, hjust = 0))
plotAbundance(tse, rank="Phylum",order_sample_by = "Bacteroidetes", add_legend=FALSE,add_x_text=TRUE) +
theme(axis.text.x.bottom = element_text(angle = 90, hjust = 0))
Output: (first without order_by_sample and second is)
from miaviz.
Yes it does the sorting but if you sort by Bacteroidetes then you could expect to see that in the plot. The explanation is clear in this case but a warning might help uncautious users like me.
I suggest to use minimal examples and exclude themselves and other elements in the code that are unrelated to the issue.
from miaviz.
The assay should be explicitly defined to avoid confusion?
from miaviz.
Guess for readability the line:
tse <- relAbundanceCounts(tse)
Could be added.
In documentation the default values set for the args is clear about using relabundance, and gets calculated if not present.
I tested it when "abund_values" not passed (like the earlier comment) by default it counts relative abundance if it is not present among the assays.
from miaviz.
Yes, it counts relabundances for the visualization.
But sorting is not done on that assay by default, i.e.
plotAbundance(tse, rank="Phylum",order_sample_by = "Bacteroidetes")
Does sorting for Bacteroidetes but does not specify which assay.
plotAbundance(tse, rank="Phylum",order_sample_by = "Bacteroidetes", abund_values="counts")
would be explicit about the assay that is being used in the sorting.
However, when I do
tse <- relAbundanceCounts(tse)
plotAbundance(tse, rank="Phylum",order_sample_by = "Bacteroidetes", abund_values = "relabundance")
The values do not seem to be sorted by Bacteroidetes relative abundance.
Adding the order_rank_by
option does the trick with revabund
plotAbundance(tse, rank="Phylum",order_sample_by = "Bacteroidetes", abund_values = "relabundance", order_rank_by="revabund")
But the documentation is not very clear on how the abund and revabund are expected to differ, or what order_rank_by="name" really means/does.
plotAbundance(tse, rank="Phylum",order_sample_by = "Bacteroidetes", abund_values = "relabundance", order_rank_by="abund")
Action point: clarify function documentation and examples, and afterwards also add example in OMA.
from miaviz.
Ok I see your point clearly now.
I try figure out what "name" or "abund" do, then move to OMA.
from miaviz.
Ok "name" sorts names/labels alphabetically present in rank, if no rank is mentioned the first in taxonomyRanks (e.g. Kingdom) names are sorted. I double check with authors about all.
from miaviz.
Related Issues (20)
- plotAbundance problem HOT 2
- Boxplots significance HOT 4
- plotAbundanceDensity colors
- Plot by group HOT 1
- plotAbundanceDensity not working when counts assay is missing HOT 2
- Replace abund_values with assay_name
- print x-axis label in plotAbundance HOT 2
- Update the pkg in Bioc devel HOT 1
- Check fails HOT 2
- Ordination plots with trajectories: add examples HOT 3
- Enable examples and tests
- Update Bioc devel HOT 1
- argument names
- Default ranks HOT 3
- RDA influences from microViz
- plotAbundanceDensity options
- plotRDA, plot loadings HOT 1
- plotRowTree error
- sysreqs error
- Strange example HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from miaviz.