Provides heat maps reordered using several different seriation methods.
This includes dendrogram based reordering with optimal leaf order and matrix seriation based heat maps.
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 distance matrices are shown instead.
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.
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:
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.
showdist
Display seriated dissimilarity matrices? Values are "none", "both",
"rows" or "columns".
key
logical; show a colorkey?.
key.lab
string plotted next to the color key.
axes
one of "auto" (default; show axis
labels if there are
less than 25 labels), "x", "y",
"both" and "none".
margins
bottom and right-hand-side margins are
calculated automatically or can be specifies as a vector
of two numbers (in lines).
zlim
range of values displayed.
col, col_dist
color palettes used.
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.
The list may contain additional elements (dendrograms, colors, etc).
Author(s)
Michael Hahsler
See Also
seriate,
pimage,
dissplot,
heatmap.2 in gplots.
Examples
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))