[BioC] heatmap questions

Wang, Li li.wang at ttu.edu
Fri Nov 30 21:57:51 CET 2012


Dear List members

I used the following command to generate heatmap of expression value of differentially expressed genes. 

 library("RColorBrewer")

d <- read.delim("DE4018.txt", header=TRUE)
x <- as.matrix(d)
X_scaled <- t(apply(x, 1, scale))
hr <- hclust(as.dist(1-cor(t(X_scaled), method="spearman")), method="complete")
hc <- hclust(as.dist(1-cor(X_scaled, method="spearman")), method="complete")
hmcol<-brewer.pal(11,"RdBu")
pdf(file = "heatmap20120517_4.pdf", height = 14, width = 7)
heatmap(X_scaled, Rowv=as.dendrogram(hr), Colv=as.dendrogram(hc), col=hmcol, scale="row")
dev.off()

The generated map can not satisfy me fully. Because with using the dendrogram, samples of the same condition do not cluster together. In other words, samples from two conditions mixed up. My intention is to get the replicates from one condition cluster together. Could anyone please help me modify this code?

Best regards
Li


More information about the Bioconductor mailing list