How to use distance functions from hopach package in a heatmap?
1
0
Entering edit mode
@lourdes-pena-castillo-1305
Last seen 10.2 years ago
Hello, I am trying to get a heatmap from gene expression data using a different distance function rather than the default (dist with euclidean distance). Specifically, I was trying to use disscosangle available in the hopach package setting distfun as follows: >heatmap(t(probesExp), col = mypalette, distfun = disscosangle, labCol = "", scale = "none"); but I get this error: Error in if (n < 2) stop("must have n >= 2 objects to cluster") : argument is of length zero I checked whether disscosangle could be used at all using: as.dist(disscosangle(probesExp)) and it works fine. However, I could not find the right way to give it as a parameter to heatmap. Somebody knows how to do this? In addition, how can I add to the image of the heatmap a map between the colors used and the values of the data? I mean how to have the color palette in one side of the image with the corresponding value each color represents. Thanks! Lourdes
• 1.1k views
ADD COMMENT
0
Entering edit mode
@stecalzatiscaliit-259
Last seen 10.2 years ago
Hi, assuming cols of probExp are samples, you can do something like this: ydist = as.dist(disscosangle(probesExp)) yclust = as.dendrogram(hclust(ydist,...)) heatmap(probesExp,...,Colv=yclust) HIH Stefano On Tue, Jun 21, 2005 at 04:18:32PM -0400, Lourdes Pe?a Castillo wrote: <lourdes>Hello, <lourdes> <lourdes>I am trying to get a heatmap from gene expression data using a <lourdes>different distance function rather than the default (dist with <lourdes>euclidean distance). <lourdes> <lourdes>Specifically, I was trying to use disscosangle available in the <lourdes>hopach package setting distfun as follows: <lourdes> <lourdes>>heatmap(t(probesExp), col = mypalette, distfun = disscosangle, labCol <lourdes>= "", scale = "none"); <lourdes> <lourdes>but I get this error: <lourdes> <lourdes>Error in if (n < 2) stop("must have n >= 2 objects to cluster") : <lourdes> argument is of length zero <lourdes> <lourdes>I checked whether disscosangle could be used at all using: <lourdes>as.dist(disscosangle(probesExp)) <lourdes>and it works fine. <lourdes>However, I could not find the right way to give it as a parameter to <lourdes>heatmap. Somebody knows how to do this? <lourdes> <lourdes>In addition, how can I add to the image of the heatmap a map between <lourdes>the colors used and the values of the data? I mean how to have the <lourdes>color palette in one side of the image with the corresponding value <lourdes>each color represents. <lourdes> <lourdes>Thanks! <lourdes> <lourdes>Lourdes <lourdes> <lourdes>_______________________________________________ <lourdes>Bioconductor mailing list <lourdes>Bioconductor at stat.math.ethz.ch <lourdes>https://stat.ethz.ch/mailman/listinfo/bioconductor -- Stefano Calza, PhD Sezione di Statistica Medica e Biometria Dip. di Scienze Biomediche e Biotecnologie Universit? degli Studi di Brescia - Italia Viale Europa, 11 25123 Brescia email: calza at med.unibs.it Telefono/Phone: +390303717532 Fax: +390303717488 Section of Medical Statistics and Biometry Dept. Biomedical Sciences and Biotechnology University of Brescia - Italy
ADD COMMENT

Login before adding your answer.

Traffic: 552 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6