Hi All
How can I possibly extract the clusters by rows from a heatmap
generated by
heatmap.2 function. i.e. the heatmap is generated with colouring for
every
cluster of rows and I want to retrieve the members of each cluster.
Any clue would be much appreciated
Thank you very much
Alyaa
KAUST/AUC Marine Genomics Project
American University in Cairo
Egypt
2918
--
Alyaa Mahmoud
"Love all, trust a few, do wrong to none"- Shakespeare
--
Alyaa Mahmoud
"Love all, trust a few, do wrong to none"- Shakespeare
[[alternative HTML version deleted]]
Hi, Alyaa
Assuming that you have an object "hr" which clusters rows by spearman
correlation as distance method,
hr <- hclust(as.dist(1-cor(t(y), method="spearman")),
method="complete"), y is your matrix here.
hr$labels[hr$order]
it will print the row labels in the order they appear in the tree.
I donot know if this is what you want.
Best
Li
________________________________________
From: bioconductor-bounces@r-project.org [bioconductor-
bounces@r-project.org] On Behalf Of Alyaa Mahmoud
[alyamahmoud@gmail.com]
Sent: Thursday, May 24, 2012 10:04 AM
To: bioconductor at r-project.org
Subject: [BioC] Fwd: heatmap.2 question
Hi All
How can I possibly extract the clusters by rows from a heatmap
generated by
heatmap.2 function. i.e. the heatmap is generated with colouring for
every
cluster of rows and I want to retrieve the members of each cluster.
Any clue would be much appreciated
Thank you very much
Alyaa
KAUST/AUC Marine Genomics Project
American University in Cairo
Egypt
2918
--
Alyaa Mahmoud
"Love all, trust a few, do wrong to none"- Shakespeare
--
Alyaa Mahmoud
"Love all, trust a few, do wrong to none"- Shakespeare
[[alternative HTML version deleted]]
_______________________________________________
Bioconductor mailing list
Bioconductor at r-project.org
https://stat.ethz.ch/mailman/listinfo/bioconductor
Search the archives:
http://news.gmane.org/gmane.science.biology.informatics.conductor
Hi Alyaa,
On 5/24/2012 11:04 AM, Alyaa Mahmoud wrote:
> Hi All
>
> How can I possibly extract the clusters by rows from a heatmap
generated by
> heatmap.2 function. i.e. the heatmap is generated with colouring for
every
> cluster of rows and I want to retrieve the members of each cluster.
Note that heatmap.2() uses hclust() to create the clusters. There is a
function cutree() that can be used to get the groups from the output
of
hclust().
Also note that heatmap.2() invisibly returns a list that includes both
the row and column dendrograms (by returning the list invisibly, you
don't get a bunch of junk printed out to your console. However, if you
use the assignment function (<-) to assign the output to an object,
you
can then extract whichever dendrogram you want.).
Best,
Jim
>
>
> Any clue would be much appreciated
>
> Thank you very much
> Alyaa
>
> KAUST/AUC Marine Genomics Project
> American University in Cairo
> Egypt
> 2918
>
--
James W. MacDonald, M.S.
Biostatistician
University of Washington
Environmental and Occupational Health Sciences
4225 Roosevelt Way NE, # 100
Seattle WA 98105-6099
Also: Someone correct me if I'm wrong, as I often turn myself around
on this one, but also note that the y-axis you see on the heatmap.2 is
"flipped." So the "first" row (`result$rowInd[1]`) is at the bottom of
the heatmap, not the top.
-steve
On Thu, May 24, 2012 at 11:18 AM, James W. MacDonald <jmacdon at="" uw.edu=""> wrote:
> Hi Alyaa,
>
>
> On 5/24/2012 11:04 AM, Alyaa Mahmoud wrote:
>>
>> Hi All
>>
>> How can I possibly extract the clusters by rows from a heatmap
generated
>> by
>> heatmap.2 function. i.e. the heatmap is generated with colouring
for every
>> cluster of rows and I want to retrieve the members of each cluster.
>
>
> Note that heatmap.2() uses hclust() to create the clusters. There is
a
> function cutree() that can be used to get the groups from the output
of
> hclust().
>
> Also note that heatmap.2() invisibly returns a list that includes
both the
> row and column dendrograms (by returning the list invisibly, you
don't get a
> bunch of junk printed out to your console. However, if you use the
> assignment function (<-) to assign the output to an object, you can
then
> extract whichever dendrogram you want.).
>
> Best,
>
> Jim
>
>
>
>>
>>
>> Any clue would be much appreciated
>>
>> Thank you very much
>> Alyaa
>>
>> KAUST/AUC Marine Genomics Project
>> American University in Cairo
>> Egypt
>> 2918
>>
>
> --
> James W. MacDonald, M.S.
> Biostatistician
> University of Washington
> Environmental and Occupational Health Sciences
> 4225 Roosevelt Way NE, # 100
> Seattle WA 98105-6099
>
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at r-project.org
> https://stat.ethz.ch/mailman/listinfo/bioconductor
> Search the archives:
> http://news.gmane.org/gmane.science.biology.informatics.conductor
--
Steve Lianoglou
Graduate Student: Computational Systems Biology
?| Memorial Sloan-Kettering Cancer Center
?| Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact
Yep. The heatmap itself is created using image(), which plots the
matrix
from the bottom up, so the [1,1] position of the matrix is at the
lower
left of the image.
Best,
Jim
On 5/24/2012 11:29 AM, Steve Lianoglou wrote:
> Also: Someone correct me if I'm wrong, as I often turn myself around
> on this one, but also note that the y-axis you see on the heatmap.2
is
> "flipped." So the "first" row (`result$rowInd[1]`) is at the bottom
of
> the heatmap, not the top.
>
> -steve
>
> On Thu, May 24, 2012 at 11:18 AM, James W. MacDonald<jmacdon at="" uw.edu=""> wrote:
>> Hi Alyaa,
>>
>>
>> On 5/24/2012 11:04 AM, Alyaa Mahmoud wrote:
>>> Hi All
>>>
>>> How can I possibly extract the clusters by rows from a heatmap
generated
>>> by
>>> heatmap.2 function. i.e. the heatmap is generated with colouring
for every
>>> cluster of rows and I want to retrieve the members of each
cluster.
>>
>> Note that heatmap.2() uses hclust() to create the clusters. There
is a
>> function cutree() that can be used to get the groups from the
output of
>> hclust().
>>
>> Also note that heatmap.2() invisibly returns a list that includes
both the
>> row and column dendrograms (by returning the list invisibly, you
don't get a
>> bunch of junk printed out to your console. However, if you use the
>> assignment function (<-) to assign the output to an object, you can
then
>> extract whichever dendrogram you want.).
>>
>> Best,
>>
>> Jim
>>
>>
>>
>>>
>>> Any clue would be much appreciated
>>>
>>> Thank you very much
>>> Alyaa
>>>
>>> KAUST/AUC Marine Genomics Project
>>> American University in Cairo
>>> Egypt
>>> 2918
>>>
>> --
>> James W. MacDonald, M.S.
>> Biostatistician
>> University of Washington
>> Environmental and Occupational Health Sciences
>> 4225 Roosevelt Way NE, # 100
>> Seattle WA 98105-6099
>>
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives:
>> http://news.gmane.org/gmane.science.biology.informatics.conductor
>
>
--
James W. MacDonald, M.S.
Biostatistician
University of Washington
Environmental and Occupational Health Sciences
4225 Roosevelt Way NE, # 100
Seattle WA 98105-6099
Thanks to all of you, this was really helpful :)
Alyaa
On Thu, May 24, 2012 at 6:42 PM, James W. MacDonald <jmacdon@uw.edu>
wrote:
> Yep. The heatmap itself is created using image(), which plots the
matrix
> from the bottom up, so the [1,1] position of the matrix is at the
lower
> left of the image.
>
>
> Best,
>
> Jim
>
>
> On 5/24/2012 11:29 AM, Steve Lianoglou wrote:
>
>> Also: Someone correct me if I'm wrong, as I often turn myself
around
>> on this one, but also note that the y-axis you see on the heatmap.2
is
>> "flipped." So the "first" row (`result$rowInd[1]`) is at the bottom
of
>> the heatmap, not the top.
>>
>> -steve
>>
>> On Thu, May 24, 2012 at 11:18 AM, James W.
MacDonald<jmacdon@uw.edu>
>> wrote:
>>
>>> Hi Alyaa,
>>>
>>>
>>> On 5/24/2012 11:04 AM, Alyaa Mahmoud wrote:
>>>
>>>> Hi All
>>>>
>>>> How can I possibly extract the clusters by rows from a heatmap
generated
>>>> by
>>>> heatmap.2 function. i.e. the heatmap is generated with colouring
for
>>>> every
>>>> cluster of rows and I want to retrieve the members of each
cluster.
>>>>
>>>
>>> Note that heatmap.2() uses hclust() to create the clusters. There
is a
>>> function cutree() that can be used to get the groups from the
output of
>>> hclust().
>>>
>>> Also note that heatmap.2() invisibly returns a list that includes
both
>>> the
>>> row and column dendrograms (by returning the list invisibly, you
don't
>>> get a
>>> bunch of junk printed out to your console. However, if you use the
>>> assignment function (<-) to assign the output to an object, you
can then
>>> extract whichever dendrogram you want.).
>>>
>>> Best,
>>>
>>> Jim
>>>
>>>
>>>
>>>
>>>> Any clue would be much appreciated
>>>>
>>>> Thank you very much
>>>> Alyaa
>>>>
>>>> KAUST/AUC Marine Genomics Project
>>>> American University in Cairo
>>>> Egypt
>>>> 2918
>>>>
>>>> --
>>> James W. MacDonald, M.S.
>>> Biostatistician
>>> University of Washington
>>> Environmental and Occupational Health Sciences
>>> 4225 Roosevelt Way NE, # 100
>>> Seattle WA 98105-6099
>>>
>>>
>>> ______________________________**_________________
>>> Bioconductor mailing list
>>> Bioconductor@r-project.org
>>> https://stat.ethz.ch/mailman/**listinfo/bioconductor<https: stat.="" ethz.ch="" mailman="" listinfo="" bioconductor="">
>>> Search the archives:
>>> http://news.gmane.org/gmane.**science.biology.informatics.**conduc
tor<http: news.gmane.org="" gmane.science.biology.informatics.conductor="">
>>>
>>
>>
>>
> --
> James W. MacDonald, M.S.
> Biostatistician
> University of Washington
> Environmental and Occupational Health Sciences
> 4225 Roosevelt Way NE, # 100
> Seattle WA 98105-6099
>
>
--
Alyaa Mahmoud
"Love all, trust a few, do wrong to none"- Shakespeare
[[alternative HTML version deleted]]