View source: R/plot_consensus.R
plot_consensus | R Documentation |
This function displays pairwise consensus cluster distances as a heatmap.
plot_consensus( cc, k, group = NULL, covar = NULL, hclustfun = "complete", pal_clust = "d3", pal_group = "npg", pal_covar = "Blues", pal_tiles = "RdBu", title = "Consensus Matrix" )
cc |
A list created by a call to |
k |
Integer specifying number of clusters to visualize. |
group |
Optional character or factor vector of length equal to sample size. Alternatively, a data frame or list of such vectors, optionally named. |
covar |
Optional continuous covariate of length equal to sample size. Alternatively, a data frame or list of such vectors, optionally named. |
hclustfun |
The agglomeration method to be used for hierarchical
clustering. Supports any method available in |
pal_clust |
String specifying the color palette to use for cluster
assignments. Options include |
pal_group |
String specifying the color palette to use if |
pal_covar |
String specifying the color palette to use if |
pal_tiles |
String specifying the color palette to use for heatmap
tiles. Options include the complete collection of |
title |
Optional plot title. |
Consensus clustering is a resampling procedure to evaluate cluster stability.
A user-specified proportion of samples are held out on each run of the
algorithm to test how often the remaining samples do or do not cluster
together. The result is a square consensus matrix for each value of cluster
numbers k. Each cell of the matrix mat[i, j]
represents the
proportion of all runs including samples i
and j
in which the
two were clustered together.
plot_consensus
converts a consensus matrix into a distance matrix by
taking the complement of all values and visualising the result as a heatmap.
These figures are similar to those presented in the original consensus
cluster paper by Monti et al.
Monti, S., Tamayo, P., Mesirov, J., & Golub, T. (2003). Consensus Clustering: A Resampling-Based Method for Class Discovery and Visualization of Gene Expression Microarray Data. Machine Learning, 52: 91-118.
# Load libraries library(ConsensusClusterPlus) # Import, filter, transform data data(airway) mat <- assay(airway) mads <- apply(mat, 1, mad) keep <- order(mads, decreasing = TRUE)[seq_len(1000)] mat <- mat[keep, ] mat <- log2((mat + 1L) / 1e6L) # Run consensus clustering, plot results cc <- ConsensusClusterPlus(mat) plot_consensus(cc, k = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.