Learn R Programming

bvbiome (version 0.99.18)

cooccurplot: Heatmap-style plot of species co-occurrence across samples.

Description

Calculate the correlation between taxonomic counts (possibly transformed), and display a clustered heatmap-style image summarizing distances between taxonomic groups.

Usage

cooccurplot(x, ..., lbl = rownames(x), distfun = dist,
    hclustfun = function(...) hclust(..., method = "average"),
    method = "pearson", text.cex = 1, colschm = brewer.pal(8, "OrRd"))

Arguments

x
An instance of class Community.
...
Additional arguments, ignored.
lbl
Names used to label taxa. Default: row names of x.
distfun
Function used to calculate distances between sample correlations, like dist.
hclustfun
Function used to cluster samples, like hclust.
method
Method for calculating correlations; see cor.
text.cex
Size of diagonal labels, in the manner of text.
colschm
Color scheme for image plot; the default is a color-blind safe divergent pallete from RColorBrewer.

Value

  • The function is evaluated for its side effect, an image with appropriate annotations.

Details

This function takes the transpose of the communities matrix and calucates pairwise correlation coefficients using cor with method method. The correlation matrix is converted to a distance matrix using distfun, then clustered with hclustfun, transformed to a dendrogram ordered by the row or column means of the correlation matrix. The dendrogram order is used to present the correlation matrix as a (lower triangular) heat map, with intensity reflecting strength of correlation.

The strength of correlation between two taxa can be found by identifying the taxa on the diagonals, and finding the intersection of the taxa in the heatmap.

Examples

Run this code
## data input, 20% most abundant taxa, asinh-transformed counts
data(cc)
cc1 <- trimq(normalize(cc, transform=asinh), taxonQ=.8)

## plot
cooccurplot(cc1)

Run the code above in your browser using DataLab