hmap {seriation}R Documentation

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:

main

title for the plot.

col

colors used for the plot (default: gray colors).

For matrix based seriation (hclustfun = NULL), the following additional arguments are possible:

gp

an object of class gpar containing graphical parameters (see gpar in package grid).

newpage

a logical indicating whether to start plot on a new page (see gpar in package grid).

prop

a logical indicating whether the height and width of x should be plotted proportional to its dimensions.

...

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).

For dendrogram = FALSE further arguments are used as options (see above).

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.

Value

An invisible list with elements:

rowInd, colInd

index permutation vectors.

reorder_method

name of the method used to reorder the matrix.

For dendrogram = TRUE the list can contain additional elements (see heatmap for details).

See Also

seriate.dist and heatmap in stats.

Examples

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"))

[Package seriation version 1.0-6 Index]