Learn R Programming

monogeneaGM (version 1.1)

heatmapAnnot: Annotated heat map

Description

This function produces a heat map with hierarchical clustering of samples using multivariate size or shape data.

Usage

heatmapAnnot(x, labcol, xlab = "", ylab = "", genus = "", rowlab = TRUE, pt = 0, dist.method = "manhattan", clust.method = "ward.D")

Arguments

x
a matrix with rows representing species samples and columns representing morphometrical variables of interest
labcol
a character vector giving the color annotation for the species
xlab
title for x-axis
ylab
title for y-axis
genus
single character abbreviation for genus
rowlab
if FALSE, suppresses row labels on the heat map
pt
if the rows have been ranked, two lines are drawn - one at the ptx100th percentile (bottom), the other at the (1-pt)x100th percentile (top); set to 0 to disable
dist.method
a distance metric implemented in the dist function; defaults to manhattan
clust.method
a clustering algorithm implemented in the hclust function; defaults to ward.D

Details

This function customizes the heatmap.2 function in the gplots package (Version 2.17.0). Row standardization is switched on, and a color legend for species is given in the left panel.

References

Khang TF, Soo OYM, Tan WB, Lim LHS. (2016). Monogenean anchor morphometry: systematic value, phylogenetic signal, and evolution. PeerJ 4:e1668.

Warnes GR, Bolker B, Bonebakker L, Gentleman R, Huber W, Liaw A, Lumley T,Maechler M, Magnusson M, Moeller S, Schwartz M, Venables B. (2015). gplots:Various R programming tools for plotting data. R package version 2.17.0. Available at: http://CRAN.R-project.org/package=gplots.

See Also

dist, hclust

Examples

Run this code
library(gplots)

data(ligophorus_shape)
data(spcolmap)

dendrogram <- hclust(dist(ligophorus_shape))

#check dendrogram and note cut-off for the two main clades
plot(dendrogram)

clade_id <- cutree(dendrogram, h=0.5)

f_s <- numeric(ncol(ligophorus_shape))

for(i in 1:ncol(ligophorus_shape)){
dat <- stack(ligophorus_shape[,i])
#replace species label with clade label
dat[,2] <- clade_id
f_s[i] <- t.test(values~ind, data=dat)$statistic
}

rank_s <- order(f_s, decreasing=TRUE)

heatmapAnnot(ligophorus_shape[,rank_s],labcol=spcolmap$color,
xlab="Specimens", genus="L. ")

Run the code above in your browser using DataLab