Question: Gene Expression Data Hierarchical Clustering, Plot Heat Map With Ggplot
gravatar for k.nirmalraman
5.9 years ago by
k.nirmalraman980 wrote:

I have expression data, filtered based on DE analysis.

I would like to do hierachical clustering.

y<-ExpressionMatrix_filtered   # n*4 matrix with rownames=genenames
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)/1.5); 
mycolhc <- rainbow(length(unique(mycl)), start=0.1, end=0.9); mycolhc <- mycolhc[as.vector(mycl)] ; myheatcol <- bluered(75)

One can ofcourse plot the clusters as follows,

`heatmap.2(y, Rowv=as.dendrogram(hr), Colv=as.dendrogram(hc), col=myheatcol, scale="row","none", trace="none", RowSideColors=mycolhc,margins=c(10,10))'

however, I'd like ggplot package geom_tile type of visualization. I have two questions in this regard.

  1. How can I plot the clusters? I know the order of the genes are in hr$order. How can I get this to the same order for ggplot?
  2. Is it also possible to get the dendogram for rowV and colV

Any help would be really great. Thanks!

clustering heatmap • 8.4k views
ADD COMMENTlink modified 5.9 years ago by Neilfws48k • written 5.9 years ago by k.nirmalraman980
gravatar for Neilfws
5.9 years ago by
Sydney, Australia
Neilfws48k wrote:

These may be useful:

ADD COMMENTlink written 5.9 years ago by Neilfws48k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1513 users visited in the last hour