Learn R Programming

RAM (version 1.2.1.3)

group.OTU: Plot Distribution of OTUs

Description

This function plot the distributon of otus in each level of a given metadata variable. The plot can be boxplot of barplot. The boxplot shows the range of relative abundance of a given otuID in each level of metadata category. The barplot shows the relative abundance of the total counts of a given otuID in each level of metadata category.

Usage

group.OTU(otu, rank="g", otuIDs="", meta, meta.factor="", boxplot=TRUE, main="", file=NULL, ext=NULL, height=8, width=16)

Arguments

otu
the OTU table to be analyzed.
rank
optional. if NULL, the lca of the OTUs will be retrieved; otherwise, the user should provide a valid taxonomic rank that an otu being classified to (see ?RAM.rank.formatting for formatting details).
otuIDs
an vector of otuIDs in the OTU table
meta
the metadata table to be analyzed.
meta.factor
the metadata qualitative variable
boxplot
logical. If TRUE, generate boxplot; otherwise generate barplot.
main
title of the plot.
file
the file path where the image should be created (see ?RAM.plotting).
ext
the file type to be used; one of "pdf", "png", "tiff", "bmp", "jpg", or "svg".
height
the height of the image to be created (in inches).
width
the width of the image to be created (in inches).

Value

group.OTU returns boxplot or barplot for the distribution of a list of otuIDs.

See Also

ggplot

Examples

Run this code
data(ITS1, meta)
# otuIDs
otuIDs=rownames(ITS1)[1:10]
# names(meta)
theme <- RAM.color()
group.OTU(otu=ITS1, rank="g", otuIDs=otuIDs,
        meta=meta, meta.factor="City", boxplot=TRUE,
        file=NULL, ext=NULL) + theme
## Not run: 
# group.OTU(otu=ITS1, rank="g", otuIDs=otuIDs,
#                meta=meta, meta.factor="City", boxplot=FALSE,
#                file=NULL) + theme
# ## End(Not run)

Run the code above in your browser using DataLab