Arne
I don't have the exact code to hand, but as I recall heatmap() either
takes data and does the clustering itself, or it takes two pre-
computed
trees, as from the output of hclust(). Therefore, you need to do two
hclust() operations to produce two trees, and then pass those trees as
arguments to heatmap().
Mick
-----Original Message-----
From: Arne.Muller@aventis.com [mailto:Arne.Muller@aventis.com]
Sent: 20 July 2004 15:28
To: bioconductor@stat.math.ethz.ch
Subject: [BioC] heatmaps and pearson correlation
Hello,
I'm trying to construct a heatmap by clustering two dimensions
(genes, treatments) using pearson correlation for both the distances
(1
- correlation). Unfortinately the hclust and dist methods don't
provide
the pearson as a metric for distances (is there any reason for this?).
Has anyone a hint on how to make hclust and heatmap to cluster
both dimensions via pearson correlation?
thanks a lot for help,
Arne
[[alternative HTML version deleted]]
Hi!
If your data are in the matrix use cor.
cor returns you the correlation matrix.
use ?t (transpose)
to compute the simmilarities either for rows or for columns.
mydist<-as.dist(1-cor(mymatrix))
now you can pass it to hclust.
Hope it helps.
*********** REPLY SEPARATOR ***********
On 7/20/2004 at 4:27 PM Arne.Muller@aventis.com wrote:
Hello,
I'm trying to construct a heatmap by clustering two dimensions (genes,
treatments) using pearson correlation for both the distances (1 -
correlation). Unfortinately the hclust and dist methods don't provide
the pearson as a metric for distances (is there any reason for this?).
Has anyone a hint on how to make hclust and heatmap to cluster both
dimensions via pearson correlation?
thanks a lot for help,
Arne
Dipl. bio-chem. Eryk Witold Wolski @ MPI-Moleculare Genetic
Ihnestrasse 63-73 14195 Berlin 'v'
tel: 0049-30-83875219 / \
mail: wolski@molgen.mpg.de ---W-W----
http://www.molgen.mpg.de/~wolski
[[alternative HTML version deleted]]
Thanks for your help, this is exactly what I was looking for. However,
now I've a problem with the colors of the heatmap.
Tme values in the heatmap matrix range from 0 to 17 were 1 is neutral.
I'd like to have a gradient from blue (values 0 to >1) to grey
(neutral, here 1) and red (value >1 to 17). I've tried maPalette from
the marray package, the colors don't seem to be assigned as I'd like
them (the value range from 0 to 17 of my data matrix gets distributed
evenly overthe color range).
I'm happy for any suggestions, on how to construct the gradients,
maybe there's already a package available ...
thanks again for your help,
Arne
-----Original Message-----
From: Wolski [mailto:wolski@molgen.mpg.de]
Sent: 20 July 2004 16:45
To: Muller, Arne PH/FR; bioconductor@stat.math.ethz.ch
Subject: Re: [BioC] heatmaps and pearson correlation
Hi!
If your data are in the matrix use cor.
cor returns you the correlation matrix.
use ?t (transpose)
to compute the simmilarities either for rows or for columns.
mydist<-as.dist(1-cor(mymatrix))
now you can pass it to hclust.
Hope it helps.
*********** REPLY SEPARATOR ***********
On 7/20/2004 at 4:27 PM Arne.Muller@aventis.com wrote:
Hello,
I'm trying to construct a heatmap by clustering two dimensions (genes,
treatments) using pearson correlation for both the distances (1 -
correlation). Unfortinately the hclust and dist methods don't provide
the pearson as a metric for distances (is there any reason for this?).
Has anyone a hint on how to make hclust and heatmap to cluster both
dimensions via pearson correlation?
thanks a lot for help,
Arne
Dipl. bio-chem. Eryk Witold Wolski @ MPI-Moleculare Genetic
Ihnestrasse 63-73 14195 Berlin 'v'
tel: 0049-30-83875219 / \
mail: wolski@molgen.mpg.de ---W-W----
http://www.molgen.mpg.de/~wolski
Arne.Muller@aventis.com wrote:
>
> Tme values in the heatmap matrix range from 0 to 17 were 1 is
neutral.
> I'd like to have a gradient from blue (values 0 to >1) to grey
(neutral,
> ere 1) and red (value >1 to 17). I've tried maPalette from the
marray
> package, the colors don't seem to be assigned as I'd like them
> he value range from 0 to 17 of my data matrix gets distributed
evenly
> overthe color range).>
Assuming that your data doesn't really start at 0 but at some small
positive value, you could log-transform them:
nx <- log(x)
nx <- nx / max(abs(nx)) + 0.5
and then they live in the interval [0,1] with 0.5 in the middle.
For color maps, you may also try geneplotter::colorRamp and the
RColorBrewer packages.
Bw
Wolfgang
-------------------------------------
Wolfgang Huber
Division of Molecular Genome Analysis
German Cancer Research Center
Heidelberg, Germany
Phone: +49 6221 424709
Fax: +49 6221 42524709
Http: www.dkfz.de/abt0840/whuber