Question: Extract Dendrogram Information From Heatmap Generated By Heatmap.2
gravatar for Ming Tang
7.3 years ago by
Ming Tang2.6k
Houston/MD Anderson Cancer Center
Ming Tang2.6k wrote:

Hi all,

I am having a hard time to extract the corresponding subgroup members in the heatmap generated by heatmap.2 in gplots. I have looked here: and and here

I have a matrix m, the heatmap can be generated by

heatmap.2(m, colv=FALSE, dendrogram= "row", trace="none")

it gave me very good looking heatmap, now I want to extract the subgroup members.

I know I can use hclust and cutree to extract the information:

hc.rows<- hclust(dist(m))

plot(hc.rows) # it gives me just the dendrogram, and it looks the same as the dendrogram appeared in the heatmap, only differ in the order. it seems to me the order is reversed.

I can cut the tree based on either the number of group (k), or the height (h)

ct<- cutree(hc.rows, h=10) # it gives me 6 groups

rect.hclust(hc.rows, h=10) # draw red rectangles to mark the subgroups



1 2 3 4 5 6

196 248 294 119 42 4

I can get the labels of each row, and the assigned the group number by:

tableclust<- data.frame(m,ct)

my question is that how do I map the cluster number here back to the dendrogram? cluster 6 has 4 members, but it looks like to me cluster 6 appears in the most left of the dendrogram, cluster 5 has 42 members, it appears in the second most left (based on the width of the red rectangle in the dendrogram), cluster 4 has 119 members, but it appears not next to cluster 5....

enter image description here

I am confused.....

Thanks for your advice.

Tommy Tang

heatmap • 17k views
ADD COMMENTlink modified 4.8 years ago by kanika.15180 • written 7.3 years ago by Ming Tang2.6k
gravatar for kanika.151
4.8 years ago by
kanika.15180 wrote:

use svg(width=50) option. Increase it for bigger width. How To Get The Clear Values At The Bottom Of A Dendrogram In Clustering In R?

ADD COMMENTlink modified 10 months ago by RamRS30k • written 4.8 years ago by kanika.15180
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: 1176 users visited in the last hour