vmikk / metagMisc

Miscellaneous functions for metagenomic analysis.
MIT License
46 stars 11 forks source link

Prevalence plots (total OTU abundance vs OTU prevalence) #11

Closed mariaasierra closed 4 years ago

mariaasierra commented 4 years ago

Hi, could you share how you created the Prevalence plots (total OTU abundance vs OTU prevalence)? Thanks!

vmikk commented 4 years ago

Hello Maria!

To make prevalence plots you should have data in phyloseq format (with OTU table and taxonomic annotations).

library(ggplot2)
library(phyloseq)
library(metagMisc)

data(GlobalPatterns)
GP <- subset_taxa(GlobalPatterns, Phylum %in% c("Acidobacteria", "Actinobacteria", "Firmicutes", "Verrucomicrobia"))

phyloseq_prevalence_plot(GP, taxcolor = "Phylum", facet = TRUE, point_alpha = 0.5, prev.trh = 0.05)

Or you can estimate prevalence with:

prev <- metagMisc:::prevalence(GP)
head(prev)

and use this data to make a custom plot.

With best regards, Vladimir