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 data.frame for expr, or NULL. Must contain at least a row for each expr row, and one or many annotation column. Merging is performed on row names, so rows must be named following the same conventions as expr. Hexadecimal color definitions will be used "as is", other values will be attributed colors according to side.col.

cex.col

Single numeric value, character exapansion factor for column names. NA will compute a value from expr size, similarly to heatmap.

cex.row

Single numeric value, character exapansion factor for row names. NA will compute a value from expr size, similarly to heatmap.

mai.left

Single numeric value, left margin in inches (for row names). Use NA for an automatic value computed from row name lengths. See par.

mai.bottom

Single numeric value, bottom margin in inches (for column names). Use NA for an automatic value computed from column name lengths. See par.

mai.right

Single numeric value, right margin in inches (for higher level functions). See par.

mai.top

Single numeric value, top margin in inches. See par.

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 legend. Default uses a custom palette for few values, and a derivative of rainbow if more than 8 colors are needed.

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 expr values that will be mapped to colors in col.heatmap. Values outside of this range will be rounded to the mearest boundary. Two special values are also allowed : "0 centered" to get a symetrical range around 0 (with the default palette, it enforces 0 as the center color), and "range" to get expr range after normalization.

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" zlim.

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.

norm.robust

Single logical value, if TRUE median and mad will be used for centering and scaling, else mean and sd.

customLayout

Single logical value, as layout does not allow nested calls, set this to TRUE to make your own call to layout and embed this plot in a wider one. See also getLayout.

getLayout

Single logical value, whether to only return the layout arguments that would be used with the set of arguments provided or not. It can prove useful to build custom layouts, e.g. merging this plot to an other. See also customLayout.

font

Integer vector of length two, the font used to draw X and Y axis labels respectively (see par). Default is to print X labels (usually samples) in normal font and Y labels (usually genes) in italic font.

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 zlim argument.

col.heatmap

Final value of the col.heatmap argument.

legend

If side is used, a named character vector of colors used for annotation.

cex.col

Final value of the cex.col argument.

cex.row

Final value of the cex.row argument.

mai.left

Final value of the mai.left argument.

mai.bottom

Final value of the mai.bottom argument.

Author(s)

Sylvain Mareschal

See Also

clusterize, heatmap

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)

[Package LPS version 1.0.16 Index]