[BioC] Heatmaps and correlation

Kevin R. Coombes kevin.r.coombes at gmail.com
Wed May 11 22:19:51 CEST 2011


This is not really a bioconductor question.... but

You need something that behaves like a "distance".

By the definition of what you mean by 'distance", two things are close 
if and only if the distance is near zero.  The bigger (more positive) 
the distance, the further apart things are. And you cannot measure 
distances as negative; only non-negative values need apply.

Using 1-cor, you are taking two things to be close if the correlation is 
close to 1.
And the things that are furthest apart are the ones where the 
correlation is close to -1.

As an exercise, you might want to think about circumstances where the 
preferred code would be
     1 - abs(cor(*))
instead of
     1 - cor(*)

On 5/11/2011 3:12 PM, john herbert wrote:
> Dear bioconductors,
> > From a google search, I found the following code that confuses me a little.
> As usual, it is probably something really elementary but reading around does
> not solve.
>
> The code was written by James Mcdonald (
> http://www.mail-archive.com/r-help@r-project.org/msg61514.html) and is to
> compute dendograms based on correlation and plot the results on a heatmap as
> follows;
>
> a<- matrix(rnorm(50), ncol=5)
> rowv<- as.dendrogram(hclust(as.dist(1-cor(t(a)))))
> colv<- as.dendrogram(hclust(as.dist(1-cor(a))))
> heatmap.2(a, scale="row", Rowv=rowv, Colv=colv)
>
>
> Why the *1*-cor(a)?
>
>
> Orig.cor Adjusted cor	
> 1	0
> 0.9	0.1
> 0.8	0.2
> 0.7	0.3
> 0.6	0.4
> 0.5	0.5
> 0.4	0.6
> 0.3	0.7
> 0.2	0.8
> 0.1	0.9
> 0	1
> -0.1	1.1
> -0.2	1.2
> -0.3	1.3
> -0.4	1.4
> -0.5	1.5
> -0.6	1.6
> -0.7	1.7
> -0.8	1.8
> -0.9	1.9
> -1	2
>
>
> This removes negative numbers? What is the reason for doing this?
>
> 	[[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



More information about the Bioconductor mailing list