Code Monkey home page Code Monkey logo

Comments (11)

antagomir avatar antagomir commented on June 7, 2024 2

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.

antagomir avatar antagomir commented on June 7, 2024 1

Ah, right. Of course, this does not work that well with the count assay.

I suggest the following:

  1. 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.

  2. 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

  3. Can we add this example with relabundance to OMA, sorting by Bacteroidetes and showing the top-5 taxa + "Other"

from miaviz.

antagomir avatar antagomir commented on June 7, 2024 1

Also improvisaatio function documentation, I couldnt figure out from that. Ask support from the authors of this function if necessary

from miaviz.

ChouaibB avatar ChouaibB commented on June 7, 2024

How about:
"plotAbundance(tse, abund_values="counts", rank = "Phylum", order_rank_by="revabund", order_sample_by = "Bacteroidetes")"
It gives the following:
image

from miaviz.

ChouaibB avatar ChouaibB commented on June 7, 2024

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)
image
image

from miaviz.

antagomir avatar antagomir commented on June 7, 2024

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.

antagomir avatar antagomir commented on June 7, 2024

The assay should be explicitly defined to avoid confusion?

from miaviz.

ChouaibB avatar ChouaibB commented on June 7, 2024

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.

antagomir avatar antagomir commented on June 7, 2024

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.

ChouaibB avatar ChouaibB commented on June 7, 2024

Ok I see your point clearly now.
I try figure out what "name" or "abund" do, then move to OMA.

from miaviz.

ChouaibB avatar ChouaibB commented on June 7, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.