[BioC] Heatmap

Johan Lindberg johanl at kiev.biotech.kth.se
Fri Jan 2 14:38:24 MET 2004


Sorry, I noticed that I had the wrong name on the matrix :(
Here comes the correct version.

I have a matrix of M-values that I want to visualize with the heatmap function.
Since I get the best cophenetic correlation between my slides (my columns 
in the matrix) with euclidean distance and average linkage I want to use 
that in my plot.

#########This works:
#The distance between the columns.
sampdist <- dist(t(matrix[,]), method="euclidean")
sclus <- hclust(sampdist, method="complete")
#The distance between the rows.
genedist <- dist(Matrix[,], method="euclidean")
gclus <- hclust(genedist, method="complete")
heatmap(Matrix[,],Rowv=as.dendrogram(gclus),Colv=as.dendrogram(sclus))

#########But this does not work???
sampdist <- dist(t(matrix[,]), method="euclidean")
sclus <- hclust(sampdist, method="average")
#The distance between the rows.
genedist <- dist(Matrix[,], method="euclidean")
gclus <- hclust(genedist, method="average")
heatmap(Matrix[,],Rowv=as.dendrogram(gclus),Colv=as.dendrogram(sclus))
Error in match.fun(FUN) : evaluation is nested too deeply: infinite recursion?
Error: evaluation is nested too deeply: infinite recursion?

#But this works??
plot(glus) #from gclus <- hclust(genedist, method="average")
plot(sclus) #from sclus <- hclust(sampdist, method="average")
#Obviously I can plot the dendograms seperately but not together in a Heatmap.

What am I doing wrong? Once again, I really appreciate any help I can get.

/ Johan


At 14:29 2004-01-02 +0100, you wrote:
>Ok, sorry, I guess I have to take it from the beginning :)
>I have a matrix of M-values that I want to visualize with the heatmap 
>function.
>Since I get the best cophenetic correlation between my slides (my columns 
>in the matrix) with euclidean distance and average linkage I want to use 
>that in my plot.
>
>#########This works:
>#The distance between the columns.
>sampdist <- dist(t(matrix[,]), method="euclidean")
>sclus <- hclust(sampdist, method="complete")
>#The distance between the rows.
>genedist <- dist(Matrix[,], method="euclidean")
>gclus <- hclust(genedist, method="complete")
>heatmap(MatrixwithoutentirerowofNA[,],Rowv=as.dendrogram(gclus),Colv=as.dendrogram(sclus))
>
>#########But this does not work???
>sampdist <- dist(t(matrix[,]), method="euclidean")
>sclus <- hclust(sampdist, method="average")
>#The distance between the rows.
>genedist <- dist(Matrix[,], method="euclidean")
>gclus <- hclust(genedist, method="average")
>heatmap(MatrixwithoutentirerowofNA[,],Rowv=as.dendrogram(gclus),Colv=as.dendrogram(sclus))
>Error in match.fun(FUN) : evaluation is nested too deeply: infinite recursion?
>Error: evaluation is nested too deeply: infinite recursion?
>
>#But this works??
>plot(glus) #from gclus <- hclust(genedist, method="average")
>plot(sclus) #from sclus <- hclust(sampdist, method="average")
>#Obviously I can plot the dendograms seperately but not together in a Heatmap.
>
>What am I doing wrong? Once again, I really appreciate any help I can get.
>
>/ Johan
>
>
>1CC2:30 2004-01-02 +0100, you wrote:
>>You may want to tell us what are 'gclus' and 'sclus'... the problem
>>might be there...
>>(Note that 'Matrix[,]' can be replaced elegantly by 'Matrix'.)
>>
>>Otherwise apparently it works (R-1.8.1):
>>m <- matrix(rnorm(100), 20, 5)
>>heatmap(m, Rowv=as.dendrogram(hclust(dist(m))), 
>>Colv=as.dendrogram(hclust(dist(t(m)))))
>>
>>
>>Regards,
>>
>>
>>L.
>>
>>
>>--
>>--------------------------------------------------------------
>>Laurent Gautier                 CBS, Building 208, DTU
>>PhD. Student                    DK-2800 Lyngby,Denmark
>>tel: +45 45 25 24 89            http://www.cbs.dtu.dk/laurent
>>
>>
>>On Fri, Jan 02, 2004 at 10:04:14AM +0100, Johan Lindberg wrote:
>> > I am trying to plot a matrix of m-values in a heatmap with "average
>> > linkage". The rows are M-values of genes and the columns are my slides.
>> > I do the following and get the following error message:
>> >
>> > > heatmap(Matrix[,],Rowv=as.dendrogram(gclus),Colv=as.dendrogram(sclus),
>> > col=rbg)
>> > Error in match.fun(FUN) : evaluation is nested too deeply: infinite
>> > recursion?
>> > Error: evaluation is nested too deeply: infinite recursion?
>> > #But this is not the case since I can plot the rows (genes) if I plot them
>> > without my columns (slides).
>> > plot(sclus, main = paste("Dendrogram: Coph = " , round(coph1columns, 2)))
>> > #This works, why?????????? Strange????
>> > And even more strange, it works if I choose another distance method like
>> > "single" or "complete" linkage.
>> >
>> > I would really appreciate som help :)
>> >
>> > / Johan
>> >
>> >
>> > 
>> *******************************************************************************************
>> > Johan Lindberg
>> > Royal Institute of Technology
>> > AlbaNova University Center
>> > Stockholm Center for Physics, Astronomy and Biotechnology
>> > Department of Molecular Biotechnology
>> > 106 91 Stockholm, Sweden
>> >
>> > Phone (office): +46 8 553 783 45
>> > Fax: + 46 8 553 784 81
>> > Visiting adress: Roslagstullsbacken 21, Floor 3
>> > Delivery adress: Roslagsvägen 30B
>> >
>> > _______________________________________________
>> > Bioconductor mailing list
>> > Bioconductor at stat.math.ethz.ch
>> > https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor
>
>*******************************************************************************************
>Johan Lindberg
>Royal Institute of Technology
>AlbaNova University Center
>Stockholm Center for Physics, Astronomy and Biotechnology
>Department of Molecular Biotechnology
>106 91 Stockholm, Sweden
>
>Phone (office): +46 8 553 783 45
>Fax: + 46 8 553 784 81
>Visiting adress: Roslagstullsbacken 21, Floor 3
>Delivery adress: Roslagsvägen 30B
>
>_______________________________________________
>Bioconductor mailing list
>Bioconductor at stat.math.ethz.ch
>https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor

*******************************************************************************************
Johan Lindberg
Royal Institute of Technology
AlbaNova University Center
Stockholm Center for Physics, Astronomy and Biotechnology
Department of Molecular Biotechnology
106 91 Stockholm, Sweden

Phone (office): +46 8 553 783 45
Fax: + 46 8 553 784 81
Visiting adress: Roslagstullsbacken 21, Floor 3
Delivery adress: Roslagsvägen 30B



More information about the Bioconductor mailing list