Re: [R] Error in heatmap()
You might try posting on the Bioconductor list instead. They might have more suitable tools for what you are trying to do. It shoudn't hurt to ask, anyway ... If you do this and find something there that better meets your needs, please post back that information to this list so that others don't waste time on your query here. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Dec 23, 2015 at 1:30 PM, Tahani Libyawrote: > *Hi,* > > *while I try to analysis my data as the following ,I faced some problem > with (heatmap()):* > > >> dat<-ReadAffy() >> dat > > > AffyBatch object > size of arrays=1164x1164 features (20 kb) > cdf=HG-U133_Plus_2 (54675 affyids) > number of samples=10 > number of genes=54675 > annotation=hgu133plus2 > notes= >> dat2<-rma(dat) > Background correcting > Normalizing > Calculating Expression >> dat.m<-exprs(dat2) > > *The normalized data can be so large that clustering all the genes (or* > *arrays) becomes impossible. Clustering about 23000 genes takes about 1GB > of memory, and clustering 54675 genes would consume about more than 4 GBs > ofmemory, and would not be feasible on a standard Windows workstation.* > > *So I tried to sample the data, and this sample* > *is then clustered. This should convey approximately the same information > asthe clustering of the whole dataset:* >> n<-1:nrow(dat.m) >> n.s<-sample(n, nrow(dat.m)*0.1) >> dat.sample<-dat.m[n.s,] >> library(amap) >> clust.genes<-hcluster(x=dat.sample, method="pearson", > + link="average") >> clust.arrays<-hcluster(x=t(dat.sample), method="pearson", > + link="average") > > *The sample size is here 10% of the original dataset.* > > Ok, then I tried to visualizing the clustering results as a heatmap: >> heatcol<-colorRampPalette(c("Green", "Red"))(32) >> heatmap(x=as.matrix(dat.m), Rowv=as.dendrogram(clust.genes), > + Colv=as.dendrogram(clust.arrays), col=heatcol) > > *Error in .heatmap(x=as.matrix(dat.m), > Rowv=as.dendrogram(clust.genes), :**row dendrogram ordering gave > **index of wrong length* > > *Was that sample of the data make an error with heatmap()??* > > *Cheers,* > > *Tahani.* > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error in heatmap
Using your csv file, I get no error running the following code. SPIV2 - read.csv(C:/Temp/SPI V2.csv) heatmap(as.matrix(SPIV2), na.rm=TRUE) Perhaps you modified SPIV2 in some way prior to running heatmap()? Jean On Tue, Oct 22, 2013 at 10:29 AM, David Romero drom...@mda.cinvestav.mxwrote: Hi Jean ** ** Thank you for helping. No, there is no empty column or row. I join the data base. ** ** Regards ** ** David ** ** ** ** ** ** *De:* Adams, Jean [mailto:jvad...@usgs.gov] *Enviado el:* 22 de octubre de 2013 07:03 *Para:* David Romero *CC:* r-h...@stat.math.ethz.ch *Asunto:* Re: [R] Error in heatmap ** ** Do you have a row or column that is all missing? sum(apply(is.na(as.matrix(SPIV2)), 1, all)) 0 sum(apply(is.na(as.matrix(SPIV2)), 2, all)) 0 ** ** For example, this code m - as.matrix(mtcars) m[8, ] - NA heatmap(m, na.rm=TRUE) throws this error Error in hclustfun(distfun(x)) : NA/NaN/Inf in foreign function call (arg 11) ** ** Jean ** ** ** ** On Mon, Oct 21, 2013 at 1:04 PM, David Romero drom...@mda.cinvestav.mx wrote: Hi, Could you please help? Heatmap doesn't work with: heatmap(as.matrix(SPIV2),na.rm = T) Error in hclustfun(distfun(x)) : NA/NaN/Inf in foreign function call (arg 11) There are no 0 data rows or column Thanks a lot Regards --- David __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ** ** [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error in heatmap
David, You should cc r-help on all correspondence so others can follow the thread. The error appears to be a result of the missing values yielded by the dist() function on your matrix. See https://stat.ethz.ch/pipermail/r-help/2009-July/204443.html. Jean On Thu, Oct 24, 2013 at 1:25 PM, David Romero drom...@mda.cinvestav.mxwrote: Hi, ** ** The difference is: row.names=1 for csv reading. The first column is a numeric row name, it mustn't take part of the heatmap. ** ** I change it to text and try with and without row.names=1 Both give me error. ** ** Regards ** ** David ** ** *De:* Adams, Jean [mailto:jvad...@usgs.gov] *Enviado el:* 24 de octubre de 2013 11:52 *Para:* David Romero *CC:* R help *Asunto:* Re: [R] Error in heatmap ** ** Using your csv file, I get no error running the following code. SPIV2 - read.csv(C:/Temp/SPI V2.csv) heatmap(as.matrix(SPIV2), na.rm=TRUE) Perhaps you modified SPIV2 in some way prior to running heatmap()? ** ** Jean ** ** ** ** ** ** On Tue, Oct 22, 2013 at 10:29 AM, David Romero drom...@mda.cinvestav.mx wrote: Hi Jean Thank you for helping. No, there is no empty column or row. I join the data base. Regards David *De:* Adams, Jean [mailto:jvad...@usgs.gov] *Enviado el:* 22 de octubre de 2013 07:03 *Para:* David Romero *CC:* r-h...@stat.math.ethz.ch *Asunto:* Re: [R] Error in heatmap Do you have a row or column that is all missing? sum(apply(is.na(as.matrix(SPIV2)), 1, all)) 0 sum(apply(is.na(as.matrix(SPIV2)), 2, all)) 0 For example, this code m - as.matrix(mtcars) m[8, ] - NA heatmap(m, na.rm=TRUE) throws this error Error in hclustfun(distfun(x)) : NA/NaN/Inf in foreign function call (arg 11) Jean On Mon, Oct 21, 2013 at 1:04 PM, David Romero drom...@mda.cinvestav.mx wrote: Hi, Could you please help? Heatmap doesn't work with: heatmap(as.matrix(SPIV2),na.rm = T) Error in hclustfun(distfun(x)) : NA/NaN/Inf in foreign function call (arg 11) There are no 0 data rows or column Thanks a lot Regards --- David __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ** ** [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error in heatmap
Hi Jean, Problem result: the 1st column value must be complete for heatmap to run correctly. This solved the same problem I had with vegdist. Thank you for your help. Regards David De: Adams, Jean [mailto:jvad...@usgs.gov] Enviado el: 24 de octubre de 2013 14:12 Para: David Romero CC: R help Asunto: Re: [R] Error in heatmap David, You should cc r-help on all correspondence so others can follow the thread. The error appears to be a result of the missing values yielded by the dist() function on your matrix. See https://stat.ethz.ch/pipermail/r-help/2009-July/204443.html. Jean On Thu, Oct 24, 2013 at 1:25 PM, David Romero drom...@mda.cinvestav.mx wrote: Hi, The difference is: row.names=1 for csv reading. The first column is a numeric row name, it mustn't take part of the heatmap. I change it to text and try with and without row.names=1 Both give me error. Regards David De: Adams, Jean [mailto:jvad...@usgs.gov] Enviado el: 24 de octubre de 2013 11:52 Para: David Romero CC: R help Asunto: Re: [R] Error in heatmap Using your csv file, I get no error running the following code. SPIV2 - read.csv(C:/Temp/SPI V2.csv) heatmap(as.matrix(SPIV2), na.rm=TRUE) Perhaps you modified SPIV2 in some way prior to running heatmap()? Jean On Tue, Oct 22, 2013 at 10:29 AM, David Romero drom...@mda.cinvestav.mx wrote: Hi Jean Thank you for helping. No, there is no empty column or row. I join the data base. Regards David De: Adams, Jean [mailto:jvad...@usgs.gov] Enviado el: 22 de octubre de 2013 07:03 Para: David Romero CC: r-h...@stat.math.ethz.ch Asunto: Re: [R] Error in heatmap Do you have a row or column that is all missing? sum(apply(is.na(as.matrix(SPIV2)), 1, all)) 0 sum(apply(is.na(as.matrix(SPIV2)), 2, all)) 0 For example, this code m - as.matrix(mtcars) m[8, ] - NA heatmap(m, na.rm=TRUE) throws this error Error in hclustfun(distfun(x)) : NA/NaN/Inf in foreign function call (arg 11) Jean On Mon, Oct 21, 2013 at 1:04 PM, David Romero drom...@mda.cinvestav.mx wrote: Hi, Could you please help? Heatmap doesn't work with: heatmap(as.matrix(SPIV2),na.rm = T) Error in hclustfun(distfun(x)) : NA/NaN/Inf in foreign function call (arg 11) There are no 0 data rows or column Thanks a lot Regards --- David __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Error in heatmap
Do you have a row or column that is all missing? sum(apply(is.na(as.matrix(SPIV2)), 1, all)) 0 sum(apply(is.na(as.matrix(SPIV2)), 2, all)) 0 For example, this code m - as.matrix(mtcars) m[8, ] - NA heatmap(m, na.rm=TRUE) throws this error Error in hclustfun(distfun(x)) : NA/NaN/Inf in foreign function call (arg 11) Jean On Mon, Oct 21, 2013 at 1:04 PM, David Romero drom...@mda.cinvestav.mxwrote: Hi, Could you please help? Heatmap doesn't work with: heatmap(as.matrix(SPIV2),na.rm = T) Error in hclustfun(distfun(x)) : NA/NaN/Inf in foreign function call (arg 11) There are no 0 data rows or column Thanks a lot Regards --- David __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.