Learn R Programming

seriation (version 1.2-0)

hmap: Plot Heat Map Reordered Using Seriation

Description

Provides heat maps reordered using several different seriation methods. This includes dendrogram based reordering with optimal leaf order and matrix seriation based heat maps.

Usage

hmap(x, distfun = dist, method = "OLO", control = NULL, zlim = NULL, ...)

Arguments

x
a matrix or a dissimilarity matrix of class dist. If a dissimilarity matrix is used, then the distfun is ignored.
distfun
function used to compute the distance (dissimilarity) between both rows and columns (default: dist).
method
a character strings indicating the used seriation algorithm (see seriate.dist). If the method results in a dendrogram then heatmap in stats is used to show the dendrograms, otherwise reordered distan
control
a list of control options passed on to the seriation algorithm specified in method.
zlim
range of values to display (defaults to the range of x).
...
further arguments.

Value

  • An invisible list with elements:
  • rowInd, colIndindex permutation vectors.
  • reorder_methodname of the method used to reorder the matrix.
  • The list may contain additional elements (dendrograms, colors, etc).

Details

For dendrogram based heat maps the arguments are passed on to heatmap.2 in gplots. See for example margins and col. The following arguments for heatmap.2 cannot be used: Rowv, Colv, hclustfun, reorderfun. For seriation-based heat maps further arguments include: [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]

For dendrogram = TRUE, seriate.hclust with the default method "optimal" is used for arranging the dendrograms and x. heatmap is used for plotting.

For dendrogram = FALSE, seriate.dist with the default method "tsp" (a traveling salesperson solver) for arranging x is used. grid code implemented in this package is used to produce the plot.

Note that unlike the default behavior of heatmap, scaling is not automatically applied. The data have to be scaled before using hmap.

See Also

seriate, pimage, dissplot, heatmap.2 in gplots.

Examples

Run this code
data("Wood")

## default heatmap does Euclidean distance, hierarchical clustering with
## average-link and optimal leaf ordering
hmap(Wood)  
  
## heatmap with correlation-based distance, green-red color (greenred is 
## predefined) and optimal leaf ordering and no row label
dist_cor <- function(x) as.dist(1-cor(t(x)))
  
hmap(Wood, method="OLO", distfun = dist_cor, col=greenred(100), labRow=FALSE)
  
## order-based heatmap
hmap(Wood, method="MDS_angle", distfun = dist_cor, col=greenred(100))  

## order-based with dissimilarity matrices
hmap(Wood, method="MDS_angle", distfun = dist_cor, showdist = "both", 
  col=greenred(100))

Run the code above in your browser using DataLab