I am trying to make a heatmap and the was able to achieve the one I wanted. However, I have a feeling it looks clumpsy. Y
is a 4 column matrix with expression values
y<-ave_scaledCounts[Gene_Markers,]
hr <- hclust(as.dist(1-cor(t(y), method="pearson")), method="centroid");
hc <- hclust(as.dist(1-cor(y, method="spearman")), method="centroid")
# Cuts the tree and creates color vector for clusters.
mycl <- cutree(hr,k=4, h=max(hr$height)/2);
mycolhc <- rainbow(length(unique(mycl)), start=0.1, end=0.9); mycolhc <- mycolhc[as.vector(mycl)]
myheatcol <- bluered(75)
pdf("Hierarchial_Clustering/Final_HeatMap Hierarchial clustering.pdf",width=9,height=7)
heatmap.2(y, Rowv=as.dendrogram(hr), Colv=as.dendrogram(hc), col=myheatcol, scale="row", density.info="none", trace="none",
+ RowSideColors= mycolhc,margins=c(10,10),keep.dendro=FALSE)
dev.off()
. I would like the heatmap in itself to be smaller in area... preferable like a tile!! The dendograms are not neccessary and the color key could be even thinner! ANy help would be great! Thanks!
EDIT: Would it just be possible to make a better heatmap if I just have the clusters in order already?? May be ggplot2
package
clearly this scale is not appropriate for correlations. wouldn't you normally calculate some kind of distance value?
I thought I was doing it here
as.dist(1-cor(t(y)
Do you mean the color scale is not appropriate? If you dont mind could you expand a bit more??
have you tried just euclidean distances on the raw data?
This just made a huge square with same color, I mean the clusters cannot be seen. I added
col=myheatcol"