[BioC] heatmap_plus and distances

Sean Davis sdavis2 at mail.nih.gov
Sat Oct 13 15:42:51 CEST 2007


John Lande wrote:
> Dear BioC,
>
> I need to apply the function heatmap_plus to my matrices and I need to use
> distance which are not euclidean, but something like pearson, or cosine.
> It seems that the field distfun can be fitted with different metrics, but
> none of my needs. do you know any other way to apply these distance in this
> environment?
>   

Hi, John.  I'm not sure what you mean by "none of my needs" for 
distfun.  Here is a simple example using cor().

 > m=matrix(rnorm(1000),nc=20)
 > heatmap_plus(m)
 > heatmap_plus(m,distfun=function(x) {as.dist(1-cor(t(x)))})

Two points require attention.  First, the distfun must return a 
distance-like object.  as.dist() will often do the trick.  Also, some 
functions will require a t() to get the correct results.

Hope this helps.

Sean



More information about the Bioconductor mailing list