taxa.mean.plot: Plot mean taxa abundance

Description Usage Arguments Value Examples

View source: R/taxa.mean.plot.R

Description

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

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#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

metamicrobiomeR documentation built on Nov. 9, 2020, 5:06 p.m.