Question: GenomicRanges functions unlist(GRangesList(x)) throw an error when used from an installed package
0
gravatar for Simon Coetzee
7.8 years ago by
USA Cedars-Sinai Medical Center
Simon Coetzee50 wrote:
When I install a package of my own creation that uses the GenomicRanges package,?I get an error: Error in unlist(x) : argument not a list the example function that throws this error is: TestFunction <- function (z) { ? ? x <- GRangesList(z) ? ? y <- unlist(x) ? ? return(list(x, y)) } I have created a package that contains this function, and an example dataset where this occurs. It resides at http://dl.dropbox.com/u/1196228/TestingGRangesListUnlist_1.0.tar.gz There is no problem when I enter the above commands, outside of the context of the function, or if I load the function into R through the source() command. It only occurs if I install the package, and load it in via the library() command. example steps to recreate the issue: 1. Install package: R CMD INSTALL TestingGRangesListUnlist_1.0.tar.gz 2. Start R 3. library(TestingGRangesListUnlist) 4. data(test.data) 5. TestFunction(test.data) Error in unlist(x) : argument not a list output of traceback(): 2: unlist(x) 1: TestFunction(test.data) output of sessionInfo(): R version 2.14.0 (2011-10-31) Platform: x86_64-unknown-linux-gnu (64-bit) locale: [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 [6] LC_MESSAGES=en_US.UTF-8 LC_PAPER=C LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] TestingGRangesListUnlist_1.0 GenomicRanges_1.6.4 IRanges_1.12.5 setwidth_0.9-4 colorout_0.9-9 loaded via a namespace (and not attached): [1] tools_2.14.0 Thanks for reading. Simon Coetzee -- No trees were killed to send this message, but a large number of electrons were terribly inconvenienced.
• 1.5k views
ADD COMMENTlink modified 7.8 years ago by Vincent J. Carey, Jr.6.3k • written 7.8 years ago by Simon Coetzee50
Answer: GenomicRanges functions unlist(GRangesList(x)) throw an error when used from an
0
gravatar for Vincent J. Carey, Jr.
7.8 years ago by
United States
Vincent J. Carey, Jr.6.3k wrote:
You are not getting the desired unlist() method. You can put importFrom(IRanges, unlist) in your NAMESPACE if that's the unlist you intend to use throughout your package. Or you can disambiguate in line, with IRanges::unlist in the function code. (A hint is that the error message is precisely the one issued by base::unlist, but this might not be probative.) On Mon, Jan 16, 2012 at 7:41 PM, Simon Coetzee <scoetzee at="" gmail.com=""> wrote: > When I install a package of my own creation that uses the > GenomicRanges package,?I get an error: > > Error in unlist(x) : argument not a list > > the example function that throws this error is: > > TestFunction <- function (z) > { > ? ? x <- GRangesList(z) > ? ? y <- unlist(x) > ? ? return(list(x, y)) > } > > I have created a package that contains this function, and an example > dataset where this occurs. ?It resides at > http://dl.dropbox.com/u/1196228/TestingGRangesListUnlist_1.0.tar.gz > > There is no ?problem when I enter the above commands, outside of the > context of the function, or if I load the function into R through the > source() command. ?It only occurs if I install the package, and load > it in via the library() command. > > example steps to recreate the issue: > 1. Install package: > R CMD INSTALL TestingGRangesListUnlist_1.0.tar.gz > 2. Start R > 3. library(TestingGRangesListUnlist) > 4. data(test.data) > 5. TestFunction(test.data) > Error in unlist(x) : argument not a list > > output of traceback(): > 2: unlist(x) > 1: TestFunction(test.data) > > output of sessionInfo(): > R version 2.14.0 (2011-10-31) > Platform: x86_64-unknown-linux-gnu (64-bit) > > locale: > ?[1] LC_CTYPE=en_US.UTF-8 ? ? ? LC_NUMERIC=C > LC_TIME=en_US.UTF-8 ? ? ? ?LC_COLLATE=en_US.UTF-8 > LC_MONETARY=en_US.UTF-8 > ?[6] LC_MESSAGES=en_US.UTF-8 ? ?LC_PAPER=C ? ? ? ? ? ? ? ? LC_NAME=C > ? ? ? ? ? ? ? LC_ADDRESS=C ? ? ? ? ? ? ? LC_TELEPHONE=C > [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C > > attached base packages: > [1] stats ? ? graphics ?grDevices utils ? ? datasets ?methods ? base > > other attached packages: > [1] TestingGRangesListUnlist_1.0 GenomicRanges_1.6.4 > IRanges_1.12.5 ? ? ? ? ? ? ? setwidth_0.9-4 > colorout_0.9-9 > > loaded via a namespace (and not attached): > [1] tools_2.14.0 > > Thanks for reading. > > Simon Coetzee > -- > > No trees were killed to send this message, > but a large number of electrons were terribly inconvenienced. > > _______________________________________________ > Bioconductor mailing list > Bioconductor at r-project.org > https://stat.ethz.ch/mailman/listinfo/bioconductor > Search the archives: http://news.gmane.org/gmane.science.biology.informatics.conductor
ADD COMMENTlink written 7.8 years ago by Vincent J. Carey, Jr.6.3k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 16.09
Traffic: 370 users visited in the last hour