Heatmap
2
0
Entering edit mode
@johan-lindberg-581
Last seen 10.3 years ago
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
• 1.5k views
ADD COMMENT
0
Entering edit mode
Laurent Gautier ★ 2.3k
@laurent-gautier-29
Last seen 10.3 years ago
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@stat.math.ethz.ch > https://www.stat.math.ethz.ch/mailman/listinfo/bioconductor
ADD COMMENT
0
Entering edit mode
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=a s.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=a s.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@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
ADD REPLY
0
Entering edit mode
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@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@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
ADD REPLY
0
Entering edit mode
@martin-maechler-2
Last seen 5.3 years ago
Switzerland
I'm diverting this to the more appropriate mailing list, R-help, since heatmap() is standard R function. >>>>> "Johan" == Johan Lindberg <johanl@kiev.biotech.kth.se> >>>>> on Fri, 02 Jan 2004 10:04:14 +0100 writes: Johan> I am trying to plot a matrix of m-values in a heatmap Johan> with "average linkage". The rows are M-values of Johan> genes and the columns are my slides. I do the Johan> following and get the following error message: >> heatmap(Matrix[,],Rowv=as.dendrogram(gclus),Colv=as.dendrogram( sclus),col=rbg) Johan> Error in match.fun(FUN) : evaluation is Johan> nested too deeply: infinite recursion? Error: Johan> evaluation is nested too deeply: infinite recursion? The problem happens when trying to plot a large dendrogram. The "dendrogam" class is implemented as an S-level "tree", i.e., a nested list and plot.dendrogram() uses recursion for plotting. To avoid infinite recursion (which would typically "freeze" your computer), there's a limit in R (and S), options(expressions = 500) for how deeply recursions are allowed to go. The limit is currently too low for the typical dendrograms that people consider in microarray analysis of several thousand genes. Setting options(expressions = 10000) should solve the problems for these data sizes. [when replying to this, please do *drop* bioconductor@.. now; it's a n R topic] Regards, Martin Maechler <maechler@stat.math.ethz.ch> http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16 Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 <><
ADD COMMENT

Login before adding your answer.

Traffic: 782 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