heat.map {LPS} | R Documentation |
Enhanced heat map ploting
Description
This function draws a heatmap from a matrix, similarly to image
. It also offers normalization and annotation features, with more control than heatmap
.
side
can provide multiple sample annotations, and are handled differently depending on their class :
- numeric
are attributed grey shades from the minimum to the maximum, which are provided in the legend
- factor
have their levels attributed colors using a default or custom palette. Hexadecimal color codes starting with
#
and color names known by R are used "as is".- character
are printed as is in a blank cell. Hexadecimal color codes starting with
#
and color names known by R are used as background colors instead of text.- logical
are ploted in dark (TRUE) or light (FALSE) gray, leaving NAs in white.
Usage
heat.map(expr, side = NULL, cex.col = NA, cex.row = NA, mai.left = NA,
mai.bottom = NA, mai.right = 0.1, mai.top = 0.1, side.height = 1, side.col = NULL,
side.srt = 0, side.cex = 1, col.heatmap = heat(), zlim = "0 centered",
zlim.trim = 0.02, norm = c("rows", "columns", "none"), norm.robust = FALSE,
customLayout = FALSE, getLayout = FALSE, font = c(1, 3), xaxt = "s", yaxt = "s")
Arguments
expr |
A numeric matrix, holding features (genes) in columns and observations (samples) in rows. Column and row order will not be altered. |
side |
An annotation |
cex.col |
Single numeric value, character exapansion factor for column names. |
cex.row |
Single numeric value, character exapansion factor for row names. |
mai.left |
Single numeric value, left margin in inches (for row names). Use |
mai.bottom |
Single numeric value, bottom margin in inches (for column names). Use |
mai.right |
Single numeric value, right margin in inches (for higher level functions). See |
mai.top |
Single numeric value, top margin in inches. See |
side.height |
Single numeric value, scaling factor for annotation track. |
side.col |
A function returning as many colors as requested by its sole argument, defining the colors to be used for |
side.srt |
Single numeric value, determining the string rotation angle when writing character side columns (default is 0, horizontal, 90 is suggested for vertical text on busy heat maps). |
side.cex |
Single numeric value, the character expansion factor to use for character side columns. |
col.heatmap |
Character vector of colors, to be used for the cells of the heat map. |
zlim |
Numeric vector of length two, defining minimal and maximal |
zlim.trim |
Single numeric value between 0 and 1, defining the proportion of extreme values (equally split on both sides) to remove before computing "0 centered" or "range" |
norm |
Single character value, normalization to be performed (use "none" to perform no normalization). "rows" will center and scale genes, while "columns" will center and scale samples. The functions used depend on |
norm.robust |
Single logical value, if |
customLayout |
Single logical value, as |
getLayout |
Single logical value, whether to only return the |
font |
Integer vector of length two, the |
xaxt |
Single letter, whether to print column labels ("s") or not ("n"). |
yaxt |
Single letter, whether to print row labels ("s") or not ("n"). |
Value
Invisibly returns a named list :
zlim |
Final value of the |
col.heatmap |
Final value of the |
legend |
If |
cex.col |
Final value of the |
cex.row |
Final value of the |
mai.left |
Final value of the |
mai.bottom |
Final value of the |
Author(s)
Sylvain Mareschal
See Also
Examples
# Data with features in columns
data(rosenwald)
group <- rosenwald.cli$group
expr <- t(rosenwald.expr)[,1:100]
# NA imputation (feature's mean to minimize impact)
f <- function(x) { x[ is.na(x) ] <- round(mean(x, na.rm=TRUE), 3); x }
expr <- apply(expr, 2, f)
# Simple heat map
heat.map(expr)
# With annotation (row named data.frame)
side <- data.frame(group, row.names=rownames(expr))
heat.map(expr, side=side)