Tools for producing flexible heatmaps, inclduding zooming, splitting, picket plots, etc.
The package has a number of tools supporting more flexible heatmaps. The graphics is grid-like using the old graphics system. The main function is \code{heatmap.n2}, which is a wrapper around the various functions constructing individual parts of the heatmap, like sidebars, picket plots, legends etc. The function supports zooming and splitting, i.e., having (unlimited) small heatmaps underneath each other in one plot deriving from the same data set, e.g., clustered and ordered by a supervised clustering method.
install.packages("heatmapFlex")
install.packages("devtools")
devtools::install_github("vfey/heatmapFlex")
Generate a random 10x10 matrix and plot it using default values (which admittedly is not pretty):
mat <- matrix(rnorm(100), nrow = 10)
dl <- heatmap.n2(mat)
Generate a random 10x10 matrix with two distinct sets, order it using default clustering methods, split it into each two groups along both rows and columns and adjust colour palette and dendrogram dimensions:
mat <- matrix(c(rnorm(50, mean = 1), rnorm(50, mean = -1)), nrow = 10)
dl <- heatmap.n2(mat, col = "BuWtRd", rowMembers=rep(1:2, each=5), colMembers=rep(1:2, each=5),
labRow=paste0("gene-", 1:10), labCol=paste0(c("A", "B"), rep(1:5, 2)), r.cex=0.8,
dendroheight = lcm(2.2), dendrowidth = lcm(2.4))
Generate a random 10x10 matrix with two distinct sets and plot it using the same colour palette and adjustments as in the previous example. After it has been plotted to a screen graphics device and calling \code{zoom_heatmap} it can be zoomed into by clicking two distinct points inside the plot.
mat <- matrix(c(rnorm(50, mean = 1), rnorm(50, mean = -1)), nrow = 10)
# IMPORTANT: Assign the plot parameters to an object that may be used by 'zoom_heatmap'.
dl <- heatmap.n2(mat, col = "BuWtRd", labRow=paste0("gene-", 1:10), labCol=paste0(c("A", "B"), rep(1:5, 2)),
r.cex=0.8, dendroheight = lcm(2.2), dendrowidth = lcm(2.4))
zoom_heatmap(dl)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.