Learn R Programming

LPS (version 1.0.4)

heat.map: 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.

Usage

heat.map(expr, customLayout = FALSE, cex.col = NA, cex.row = NA, mai.left = NA,
    mai.bottom = NA, mai.right = 0.1, side = NULL, side.height = 1, side.col = NULL,
    col.heatmap = heat(), zlim = "0 centered", norm = c("rows", "columns", "none"),
    norm.robust = FALSE, plot = TRUE)

Arguments

expr
A numeric matrix, holding features (genes) in columns and observations (samples) in rows. Column and row order will not be altered.
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.
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.
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 c
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
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 c
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
plot
Single logical value, whether to plot the heat map or not. Mainly there for compatibility with higher level functions.

Value

  • Invisibly returns a named list :
  • zlimFinal value of the zlim argument.
  • col.heatmapFinal value of the col.heatmap argument.
  • legendIf side is used, a named character vector of colors used for annotation.
  • cex.colFinal value of the cex.col argument.
  • cex.rowFinal value of the cex.row argument.
  • mai.leftFinal value of the mai.left argument.
  • mai.bottomFinal value of the mai.bottom argument.

See Also

clusterize, heatmap

Examples

Run this code
# 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)

Run the code above in your browser using DataLab