Last data update: 2014.03.03

R: Multiple matrices heatmap visualization
mcheatmapsR Documentation

Multiple matrices heatmap visualization

Description

mcheatmaps serves to visualize multiple different symmetric matrices and matrix clusters in a single figure using a dendogram, two half heatmaps and various color labels.

Usage

mcheatmaps(matA = NULL, matB = NULL, matC = NULL, pdfname = "a", flabels = NULL,
aliases = NULL, datapts = TRUE, hminB = NULL, hmaxB = NULL, hminC = NULL, hmaxC = NULL,
ncolors = 10, legA = "", legB = "", legC = "", switchcls = FALSE, cmet = NULL,
ccol = NULL, cellines = FALSE, Bwhole = FALSE, Cwhole = FALSE, diag = NULL,
inverseColorScaleB = 0, inverseColorScaleC = 0)

Arguments

matA

Symetric matrix used to create the dendrogram and order the data. This matrix needs to be a distance matrix to create the correct dendrogram. The column and row names must be the same between all three matrices. Order of columns and row must also be the same.

matB

Symetric matrix used to create the bottom half of the heatmap. If matC is not used, a complete heatmap will be created from matB. The column and row names must be the same between all three matrices. Order of columns and row must also be the same.

matC

Symetric matrix used to create the top half of the heatmap. If matB is not used, a complete heatmap will be created from matC. The column and row names must be the same between all three matrices. Order of columns and row must also be the same.

pdfname

Name of the image you want to create without extensions, can include path. Default ("a").

flabels

Matrix of the same length as the matrices and of n rows. n being the number of supplementary information you want to add to the matrix. Each row corresponds to a row of colored labels between the dendogram and the heatmaps. Data in this matrix can be text or numbers and a color will be assigned to each different information. Columns must be in the same order as those in the matrices, row names should be a short name giving information on the annotation. Using this argument will create a second image called pdfname_labels.pdf containing the correspondances between color labels and information.

aliases

A two column matrix with n rows. Same n as for flabels. The first column is the short name used in flabels while the second is a longer name for the same row. Rows must be in the same order as the flabels matrix.

datapts

Set to false if the data values should not be printed in the heatmaps. (Default TRUE)

hminB

sets the minimal value of the heatscale of matB

hmaxB

sets the maximal value of the heatscale of matB

hminC

sets the minimal value of the heatscale of matC

hmaxC

sets the maximal value of the heatscale of matC

ncolors

Number of colors you want in the heatscales. (Default 10)

legA

Title associated with matA

legB

Title associated with matB

legC

Title associated with matC

switchcls

Switches the top and bottom heatscale colors

cmet

list of methods you want to use to calculate the dendogram. It uses the one that gives the best correlation. (By default it uses c('ward','single','complete','average','mcquitty'))

ccol

Is a vector and it's length must be equal to the number of different colors necessary to show flabels. It must contain a list of colors in a format recognizable by R.

cellines

Set to true if the cells of the heatmap should be outlined (Default FALSE)

Bwhole

Set to true if all values from matB should be printed as whole numbers (Default FALSE)

Cwhole

Set to true if all values from matC should be printed as whole numbers (Default FALSE)

diag

Vector containing the elements to be printed in the diagonal between the heatmaps

inverseColorScaleB

Set to true to inverse the order of the heatscale of matB.

inverseColorScaleC

Set to true to inverse the order of the heatscale of matC.

Author(s)

Thierry Chenard thierry.chenard@usherbrooke.ca, Rafael Najmanovich rafael.najmanovich@usherbrooke.ca

Examples

library(mcheatmaps)
mpg=matrix(nrow=nrow(mtcars),ncol=nrow(mtcars))
rownames(mpg)=rownames(mtcars)
colnames(mpg)=rownames(mtcars)
hp=matrix(nrow=nrow(mtcars),ncol=nrow(mtcars))
rownames(hp)=rownames(mtcars)
colnames(hp)=rownames(mtcars)
wt=matrix(nrow=nrow(mtcars),ncol=nrow(mtcars))
rownames(wt)=rownames(mtcars)
colnames(wt)=rownames(mtcars)
for(i in 1:nrow(mtcars)){
  for(j in 1:nrow(mtcars)){
    mpg[i,j]=abs(mtcars$mpg[i]-mtcars$mpg[j])
    hp[i,j]=abs(mtcars$hp[i]-mtcars$hp[j])
    wt[i,j]=abs(mtcars$wt[i]-mtcars$wt[j])
  }
}
label=t(mtcars[,colnames(mtcars) == "cyl" | colnames(mtcars) == "gear", drop=FALSE])
aliases=matrix(c("cyl","gear","number of cylinders","number of gears"),2,2)
mcheatmaps(matA=mpg,matB=hp,matC=wt,flabels=label,aliases=aliases,pdfname="CarStats",
legA="Difference in gas consumtion (mpg)",legB="Difference in HorsePower",
legC="Weight Difference (tonne)")

Results