-
Notifications
You must be signed in to change notification settings - Fork 63
Heatmap
Hierarchical clustering with heatmap can give us a holistic view of the data. Using the transformed data, iDEP first ranks all genes by standard deviation across all samples. By default, the top 1000 genes are used in hierarchical clustering using the heatmap.2 function. The data is centered by subtracting the average expression level for each gene. The distance matrix is 1- r, where r is Pearson’s correlation coefficient. The average linkage is used. Note that sample groups are not used in hierarchical clustering; they are just shown as color bars.
The correlation matrix is computed using the cor function in R and does not use the bottom 25% of genes regarding expression level. The graph is generated using ggplot2 as demonstrated here.
The following is the R code used for the heatmap:
hclust2 <- function(x,
method=”average“, …)
hclust(x, method=method, …)
dist2 <- function(x, …)
as.dist(1-cor(t(x), method=”pearson“))
groups = detectGroups(colnames(x) )
groups.colors = rainbow(length(unique(groups)) )
lmat = rbind(c(5,4),c(0,1),c(3,2))
lwid = c(1.5,6)
lhei = c(1,.2,8)
heatmap.2(x, distfun = dist2,hclustfun=hclust2
,col=greenred(75), density.info=”none”,trace=”none”
,scale=”none”, keysize=.5
,key=T, symkey=F
,ColSideColors=groups.colors[ as.factor(groups)]
,labRow=””
,margins=c(10,0)
,srtCol=45
,lmat= lmat, lwid = lwid, lhei = lhei
)