taxa.mean.plot {metamicrobiomeR}R Documentation

Plot mean taxa abundance

Description

This function visualize mean relative abundance by group as stacked plots.

Usage

taxa.mean.plot(
  tabmean,
  sumvar = "taxa",
  tax.select = "none",
  tax.lev = "l2",
  comvar,
  groupvar,
  mean.filter = 0.005,
  pallete.by.phylum = FALSE,
  show.taxname = "full",
  legend.position = "right",
  xlab = "",
  ylab = "Relative abundance"
)

Arguments

tabmean

table of mean abundance generated from taxa.meansdn.

sumvar

variable to be plotted. Options are c("taxa","path"). Default is "taxa"

tax.select

list of selected taxa/pathways to be plotted. Default is "none" or plot all taxa/pathways.

tax.lev

taxa level to be visualized. Options are from "l2" (phylum) to "l7" (species). Default is "l2". If sumvar="path", all pathways will be visualized.

comvar

main variable for comparison.

groupvar

variable for stratifying.

mean.filter

mean abundance filtering threshold (only plot those with mean abundance>threshold and plot all those with mean abundance <threshold as "other").

pallete.by.phylum

whether each pallete of color for each phylum. Default is FALSE (plot distinc colors).

show.taxname

whether show "full" taxa name or "short" name. Default is "full".

legend.position

position of legend. Options are c("right", "left","bottom","top","none") as in ggplot2. Default is "right".

xlab

label for x-axis. Default is "Chronological age (month)".

ylab

label for y-axis. Default is "Relative abundance".

Value

a list of ggplot2 object and list of taxa/pathways plotted (those with mean abundance >mean.filter).

Examples

#Load summary tables of bacterial taxa relative abundance from Bangladesh data
data(taxtab6)
taxlist.rm<-taxa.filter(taxtab=taxtab6, percent.filter = 0.05, relabund.filter = 0.00005)
taxa.meansdn.rm<-taxa.meansdn(taxtab=taxtab6,sumvar="bf",groupvar="age.sample")
taxa.meansdn.rm<-taxa.meansdn.rm[taxa.meansdn.rm$bf!="No_BF",]
taxa.meansdn.rm$bf<-gdata::drop.levels(taxa.meansdn.rm$bf,reorder=FALSE)
#phylum
p.bf.l2<-taxa.mean.plot(tabmean=taxa.meansdn.rm, tax.lev="l2",
comvar="bf", groupvar="age.sample",mean.filter=0.005, show.taxname="short")
p.bf.l2$p

[Package metamicrobiomeR version 1.2 Index]