clusterize function

Hierarchical clustering heat maps

Hierarchical clustering heat maps

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.

clusterize(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.clust = TRUE, norm.robust = FALSE, customLayout = FALSE, getLayout = 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, clust.genes = NULL, clust.samples = NULL) 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.
  • side: To be passed to heat.map.
  • 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.
  • mai.top: To be passed to heat.map.
  • side.height: To be passed to heat.map.
  • side.col: To be passed to heat.map.
  • side.srt: To be passed to heat.map.
  • side.cex: To be passed to heat.map.
  • col.heatmap: To be passed to heat.map.
  • zlim: To be passed to heat.map.
  • zlim.trim: 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.
  • 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.
  • 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.
  • 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.
  • clust.genes: If not NULL, an object coercible to the dendrogram class (typically the output from hclust()) to use instead of a fresh hierarchical clustering of genes. The FALSE value can also be used to disable computation and/or plotting of the dendrogram.
  • clust.samples: If not NULL, an object coercible to the dendrogram class (typically the output from hclust()) to use instead of a fresh hierarchical clustering of samples. The FALSE value can also be used to disable computation and/or plotting of the dendrogram.
  • input: See hclust and dist respectively for further details.

Returns

clusterize invisibly returns the same list as heat.map, plus : - genes: The gene dendrogram.

  • samples: The sample dendrogram.

See hclust and dist respectively for the other functions.

Author(s)

Sylvain Mareschal

See Also

heat.map, heatmap, hclust, dist

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 clusterize(expr) # With annotation (row named data.frame) side <- data.frame(group, row.names=rownames(expr)) clusterize(expr, side=side)
  • Maintainer: Sylvain Mareschal
  • License: GPL (>= 3)
  • Last published: 2021-05-29