Learn R Programming

seriation (version 1.0-12)

hmap: Plot heat map reordered by different algorithms

Description

Provides several reordered versions of heat map including dendrogram based reordering with optimal leaf order and matrix seriation based heat maps.

Usage

hmap(x, distfun = dist, hclustfun = hclust,
    method = NULL, control = NULL, options = NULL, ...)

Arguments

x
a matrix.
distfun
function used to compute the distance (dissimilarity) between both rows and columns (default: dist).
hclustfun
function used for hierarchical clustering. If hclustfun = NULL, no hierarchical clustering in performed and matrix based seriation is performed to reorder rows and columns for the heat map.
method
a character strings indicating the used seriation algorithm (see seriate.dist for dendrogram seriation and for matrix based seriation).
control
a list of control options passed on to the seriation algorithm.
options
a list with arguments for plotting. The following arguments are possible: [object Object],[object Object] For matrix based seriation (hclustfun = NULL), the following additional arguments are possible: [object O
...
further arguments. For dendrogram based heat maps the arguments are passed on to heatmap in stats (Note that the following arguments cannot be used: Rowv, Colv, distfun, hclustfun, reorderfun, scale)

Value

  • An invisible list with elements:
  • rowInd, colIndindex permutation vectors.
  • reorder_methodname of the method used to reorder the matrix.
  • For dendrogram = TRUE the list can contain additional elements (see heatmap for details).

Details

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.dist and heatmap in stats.

Examples

Run this code
data("Zoo")
x <- as.matrix(Zoo[, -17])
x <- scale(x, center = FALSE)

## optimally reordered heatmap
hmap(x)

## heatmap with seriated distance matrices
hmap(x, hclustfun = NULL)

## with proportional display
hmap(x, hclustfun = NULL, options = list(prop = TRUE, 
    main = "Zoo Data"))

Run the code above in your browser using DataLab