[BioC] Extracting dendogram information from Heatmaps

Michael Dondrup Michael.Dondrup at CeBiTec.Uni-Bielefeld.DE
Thu Dec 13 17:24:52 CET 2007


Hi Alison,

to get a matrix of clustered objects you could also simply use cutree on 
the hclust object.
something like:
myclust = hclust(dist(mymatrix))
cutree(myclust, k=2:10)
see ?cutree
And use the method below to determine the desited number of clusters

regards,
Michael

James W. MacDonald wrote:
> Hi Alison,
> 
> alison waller wrote:
>> Hello Everyone,
>>
>>  
>>
>> I've been using heatmap and heatmap.2 to draw heatmaps for my experiments.  
>>
>>  
>>
>> I have a heatmap of the M values of 6 arrays for the spots with pvalues were
>> <0.005 (from eBayes).
>>
>> However, I would like to see which spots it has grouped together in the row
>> dendogram.  Is there a way I can extract the information about the spots
>> that are clustered together.  I cannot read the row names, and even if I
>> could I was hoping there would be some way to list the clusters and save it
>> to a file.
> 
> There are two ways to do this that I know of. And either can be a pain, 
> depending on how big the dendrogram is.
> 
> Both methods require you to construct your dendrogram first. You can 
> then choose the clusters with the mouse. This might be more difficult if 
> you have some gigantic dendrogram and have ingested too much coffee ;-D.
> 
> Normally, one would simply do
> 
> heatmap(mymatrix, otherargs)
> 
> and accept the default clustering method. However, you can always 
> pre-construct the dendrograms and then feed those to heatmap().
> 
> Rowv <- as.dendrogram(hclust(dist(mymatrix)))
> Colv <- as.dendrogram(hclust(dist(t(mymatrix))))
> 
> heatmap(mymatrix, Rowv=Rowv, Colv=Colv, otherargs)
> 
> Now if you do something like that, then you can try
> 
> plot(Rowv)
> a.cluster <- identify(Rowv)
> 
> and then use your mouse to choose the upper left corner of a rectangle 
> that encompasses the cluster you are interested in. Here is where the 
> size of the dendrogram and the amount of coffee comes in. If the 
> dendrogram is really large then identify() may not be able to figure out 
> what you are trying to select, or may decide you are choosing the upper 
> right corner.
> 
> You can choose as many clusters as you want, and they will be in the 
> list a.cluster, in the order you selected.
> 
> A more programmatic method is to use rect.hclust() and either choose the 
> height at which to make the cuts, or the number of clusters, etc. Again, 
> depending on the size of your dendrogram, this may work well or it may 
> be painful.
> 
> Best,
> 
> Jim
> 
> 
>>  
>>
>> Thanks,
>>
>>  
>>
>> Alison  
>>
>>  
>>
>> ******************************************
>> Alison S. Waller  M.A.Sc.
>> Doctoral Candidate
>> awaller at chem-eng.utoronto.ca
>> 416-978-4222 (lab)
>> Department of Chemical Engineering
>> Wallberg Building
>> 200 College st.
>> Toronto, ON
>> M5S 3E5
>>
>>   
>>
>>  
>>
>>
>> 	[[alternative HTML version deleted]]
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor at stat.math.ethz.ch
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
>



More information about the Bioconductor mailing list