How to compute scale bar of the dendrogram for heatmap using heatmap2 ?
1
1
Entering edit mode
7.5 years ago
jack ▴ 950

Hi,

I have created a heatmap for the genes expression across different samples. I need to compute the scale bar of the dendrogram for my heatmaps which shows how the hierarchically clustered samples are similar to each other.

Does anybody knows how can I do that using heatmap2 function in R ?

R • 3.5k views
0
Entering edit mode

0
Entering edit mode
7.5 years ago
alolex ▴ 940

To my knowledge I don't think you can do this AND have the dendrogram scale bar show up in the same figure as the heatmap--at least using the heatmap.2 function.  However, you can plot just the row and/or column dendrogram and it will show you the scale bar on that figure.  See R code below:

M <- matrix(sample.int(20, size=100, replace=TRUE), nrow=10, byrow=TRUE)
figdata <- heatmap.2(M)
names(figdata)
plot(figdata$colDendrogram) plot(figdata$rowDendrogram)


Or, you can see if the aheamap() function from the NMF package (http://cran.r-project.org/web/packages/NMF/NMF.pdf) does what you need.  I just found this function, so haven't had a chance to experiment with it yet.

Traffic: 2688 users visited in the last hour
FAQ
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.