Comments (1)
Hi @najibveto ,
The plot_taxa_heatmap
is only for OTU/ASV level data. It does not support aggregated data. If you want to have genus-level data with clustering you can try our new TreeSE based tools here: https://microbiome.github.io/OMA/viz-chapter.html#viz-chapter.
If you want to do it in phyloseq, then I have an in-house set of tools which are focused for our data analysis but should work widely.
https://github.com/RIVM-IIV-Microbiome/biomeUtils and https://github.com/RIVM-IIV-Microbiome/biomeViz are under development.
This plot function relies on TidyHeatmap and ComplexHeatmap
# install two tools
devtools::install_github("RIVM-IIV-Microbiome/biomeUtils")
devtools::install_github("RIVM-IIV-Microbiome/biomeViz")
# load
library(biomeUtils)
library(biomeViz)
library(microbiome)
library(dplyr)
data("FuentesIliGutData") # example data
ps <- FuentesIliGutData
# ps <- phyloseq
# tax_tb <- as(tax_table(ps),"matrix") %>%
# as.data.frame() %>%
# rownames_to_column("ASV") %>%
# mutate(Genus.Species = ifelse(!is.na(Species), paste0(Genus, ".", Species), Species)) %>%
# select(-Species) %>%
# rename(Species = Genus.Species)
#
# #tax_tb[1:30, 5:9]
# rownames(tax_tb) <- tax_tb$ASV
# tax_tb <- tax_tb[,-1]
#
# tax_table(ps) <- tax_table(as.matrix(tax_tb))
# you can input your phyloseq here
top_genera_w_mean_relabund <- ps |>
aggregate_taxa("Genus") |>
microbiome::transform("compositional") |>
findTopTaxa(top= 30, method="mean")
# check the top five
top_genera_w_mean_relabund[1:5]
# For CLR-based plot
ps.clr <- ps %>%
aggregate_taxa("Genus") |>
microbiome::transform("clr")
# Select top taxa to plot
ps.clr.top.30 <- phyloseq::prune_taxa(top_genera_w_mean_relabund, ps.clr)
plotTidyHeatmap(ps.clr.top.30,
select_taxa = top_genera_w_mean_relabund,
group_samples_by = "ILI",
add_taxa_label = FALSE,
cluster_rows = FALSE,
.scale = "none",
transform = NULL,
palette_value = c("red", "white", "blue"),
# Adjust taxa name size
row_names_gp = grid::gpar(fontsize = 6, fontface="italic"))
Hope this helps.
PS: You should think of cleaning your taxa table for cleaner and clearer outputs.
Cheers,
Sudarshan
from microbiomeutilities.
Related Issues (20)
- get_group_abundances group argument without NULL as default HOT 1
- heatmap HOT 8
- Error with plot_taxa_cv() HOT 3
- Cannot install microbiomeutilities on R, what to do? HOT 6
- rlang::last_error() HOT 3
- Phy_tree not included in the result of format_to_besthit HOT 2
- Relative abundance plot for selected taxa HOT 5
- Taxonomic levels should be either 6 (untill genus) or 7 (until species) level HOT 1
- Problem to install HOT 6
- Error in `check_aesthetics()`: ! plot_ordination_utils HOT 2
- plot_taxa_barplot - HOT 4
- format_to_besthit edit HOT 1
- plot_taxa_boxplot error HOT 2
- Taxonomic_Levels Percent_Classification HOT 2
- Unable to change levels of group variable in plot_paired_abundances
- Plot_spaghetti - same results each result-cell. Idea about why?
- Problem to load HOT 1
- A HOT 8
- error with plot_taxa_heatmap
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 microbiomeutilities.