Learn R Programming

LPS (version 1.0.4)

clusterize: Hierarchical clustering heat maps

Description

This function draws a heat map ordered according to hierarchical clusterings, similarly to heatmap. It offers more control on layout and allows multiple row annotations. hclust.ward is derivated from 'stats' package hclust, with an alternative default (as arguments can not be passed to it). dist.COR mimics 'stats' package dist, computing distances as 1 - Pearson's correlation coefficient.

Usage

clusterize(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.clust = TRUE, norm.robust = FALSE, plot = TRUE, widths = c(1, 4),
    heights = c(1, 4), order.genes = NULL, order.samples = NULL, fun.dist = dist.COR,
    fun.hclust = hclust.ward)
  dist.COR(input)
  hclust.ward(input)

Arguments

expr
A numeric matrix, holding features (genes) in columns and observations (samples) in rows. Rows and columns will be ordered according to hierarchical clustering results.
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
To be passed to heat.map.
cex.row
To be passed to heat.map.
mai.left
To be passed to heat.map.
mai.bottom
To be passed to heat.map.
mai.right
To be passed to heat.map.
side
To be passed to heat.map.
side.height
To be passed to heat.map.
side.col
To be passed to heat.map.
col.heatmap
To be passed to heat.map.
zlim
To be passed to heat.map.
norm
To be passed to heat.map.
norm.clust
Single logical value, whether to apply normalization before clustering or after. Normalization applied depends on norm.
norm.robust
To be passed to heat.map.
plot
To be passed to heat.map.
widths
To be passed to layout.
heights
To be passed to layout.
order.genes
A function taking the gene dendrogram and expr as arguments, and returning the same dendrogram ordered in a custom way.
order.samples
A function taking the sample dendrogram and expr as arguments, and returning the same dendrogram ordered in a custom way.
fun.dist
A function to be used for distance computation in clustering. Default value uses 1 - Pearson's correlation as distance. See dist for further details.
fun.hclust
A function to be used for agglomeration in clustering. See hclust for further details.
input
See hclust and dist respectively for further details.

Value

  • clusterize invisibly returns the same list as heat.map, plus :
  • genesThe gene dendrogram.
  • samplesThe sample dendrogram.
  • See hclust and dist respectively for the other functions.

See Also

heat.map, heatmap, hclust, dist

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
  clusterize(expr)
  
  # With annotation (row named data.frame)
  side <- data.frame(group, row.names=rownames(expr))
  clusterize(expr, side=side)

Run the code above in your browser using DataLab