Learn R Programming

RAM (version 1.2.1.3)

group.heatmap.simple: Plot a Heatmap Showing OTU Abundance by Taxonomic Classification

Description

This function consumes an OTU table and a rank, as well as some optional parameters, and creates a heatmap showing the abundance of the OTUs at the given taxonomic rank for each sample.

Usage

group.heatmap.simple(data, is.OTU=TRUE, meta=NULL, rank, row.factor=NULL, top=NULL, count=FALSE, drop.unclassified=FALSE, dendro="none", file=NULL, ext=NULL, width=9, height=8, leg.x=-0.08, leg.y=0)

Arguments

data
the OTU table to be used.
is.OTU
logical. Whether or not the data is an OTU table.
meta
the metadata table to be used.
rank
the taxonomic rank to use (see ?RAM.rank.formatting for formatting details).
row.factor
a factor from the metadata to show along the rows of the heatmap. (see Details below).
dendro
a character vector specifying on which axes (if any) a dendrogram should be plotted. Must be one of "none", "both", "column", or "row".
top
the number of groups to select, starting with the most abundant. If NULL, all are selected.
count
logical. Should the actual count of each OTU be shown, or should the relative abundances be shown?
drop.unclassified
logical. Should OTUs labelled "unclassified" or missing classification at the given taxonomic rank be excluded?
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).
leg.x
how far the legend should be inset, on the x axis.
leg.y
how far the legend should be inset, on the y axis.

Details

row.factor should be a named character vector specifying the name of the row to be used from meta (see RAM.factors).

It should also be a factor; if it is not, a warning is raised and it is coerced to a factor (see factor). A warning is also raised when a factor has more than 8 levels, as that is the most colours the current palettes support. The factor must also correspond to the OTU table; i.e. they should have the same samples. If not, an error is raised.

See Also

factor, heatmap.2, RAM.factors

Examples

Run this code
data(ITS1, meta)
# plot the abundance of all observed classes for each sample, 
# displaying it to the screen and adding a dendrogram on the 
# column and the Collector on the row
group.heatmap.simple(ITS1, is.OTU=TRUE, meta=meta,
                     row.factor=c(Crop="Crop"), dendro="row",
                     rank="g", top=10, drop.unclassified=TRUE,
                     leg.x=-0.06)
## Not run: 
# # plot the genus for all OTUs, add a dendrogram to the row and 
# # column, and save the plot in path.tiff
# group.heatmap.simple(ITS1, is.OTU=TRUE, meta=meta, rank="genus",
#                      dendro="both", file="my/file/path")## End(Not run)

Run the code above in your browser using DataLab