[BioC] Annotate package not working

Ryan C. Thompson rct at thompsonclan.org
Fri Jan 10 18:15:11 CET 2014


I think this might be the problem. I remember checking "as.list" before 
and after installing/loading AnnotationDbi, and I think it was 
sometimes already an S4 generic. I'll experiment a bit more.

On Thu 09 Jan 2014 07:15:47 PM PST, Martin Morgan wrote:
> On 01/09/2014 03:08 PM, Ryan C. Thompson wrote:
>> I've gotten this error before, and I just now randomly fixed it by
>> reinstalling
>> the AnnotationDbi package over and over until I saw the following
>> line in the
>> output:
>>
>> Creating a generic function for ‘as.list’ from package ‘base’ in package
>> ‘AnnotationDbi’
>>
>> I previously did not see this message while installing AnnotationDbi.
>> Afterwards, my example worked fine. I have no explanation for why
>> this keeps
>> happening.
>
> Hopefully this isn't random, but some other uncontrolled variable.
>
> I can reproduce (something like) this by installing AnnotationDbi when
> there is a generic 'as.list' available in the global environment at
> install time, e.g., I added this line to my .Rprofile
>
>   setGeneric("as.list")
>
> Then I installed AnnotationDbi
>
>   R -e "source('http://bioconductor.org/biocLite.R');
> biocLite('AnnotationDbi')"
>
> (maybe you load a package or something similar during an interactive
> session where you subsequently installed AnnotationDbi?). Then when I
> run Ryan's commands in a new R session
>
>   R -f annotation-bug.R
>
> I get
>
> > library(annotate)
> Warning message:
> In namespaceImportMethods(ns, loadNamespace(j <- imp[[1L]], c(lib.loc,  :
>   No generic function found corresponding to requested imported
> methods for "as.list" from package "AnnotationDbi" (malformed exports?)
> > entrez.ids <- as.character(1:10)
> > lookUp(entrez.ids, data="org.Hs.eg", what="SYMBOL")
> Error in as.list.default(envir) :
>   no method for coercing this S4 class to a vector
> Calls: lookUp -> mget -> mget -> as.list -> as.list.default
> Execution halted
>
> (I only see the warning the first time I load annotate...) Maybe
> there's a variation of this where there's a generic available at
> install time but a different generic at run time, e.g., from one
> package masking another?
>
> I think the work-around is to install packages in a new session
> started with
>
>   R --vanilla
>
> and a solution is to create a generic as.list in BiocGenerics
> (AnnotationDbi will see and import this).
>
> Martin
>
>>
>> -Ryan
>>
>>
>> On Thu 09 Jan 2014 02:13:21 PM PST, Dan Tenenbaum wrote:
>>>
>>>
>>> ----- Original Message -----
>>>> From: "Ryan C. Thompson" <rct at thompsonclan.org>
>>>> To: "James W. MacDonald" <jmacdon at uw.edu>
>>>> Cc: "bioconductor" <bioconductor at r-project.org>
>>>> Sent: Thursday, January 9, 2014 12:28:01 PM
>>>> Subject: Re: [BioC] Annotate package not working
>>>>
>>>> Here is a transcript where I start an R session, source my bug
>>>> reproducing script, and then run sessionInfo():
>>>>
>>>> $ R --vanilla
>>>>
>>>> R version 3.0.2 (2013-09-25) -- "Frisbee Sailing"
>>>> Copyright (C) 2013 The R Foundation for Statistical Computing
>>>> Platform: x86_64-unknown-linux-gnu (64-bit)
>>>>
>>>> R is free software and comes with ABSOLUTELY NO WARRANTY.
>>>> You are welcome to redistribute it under certain conditions.
>>>> Type 'license()' or 'licence()' for distribution details.
>>>>
>>>>     Natural language support but running in an English locale
>>>>
>>>> R is a collaborative project with many contributors.
>>>> Type 'contributors()' for more information and
>>>> 'citation()' on how to cite R or R packages in publications.
>>>>
>>>> Type 'demo()' for some demos, 'help()' for on-line help, or
>>>> 'help.start()' for an HTML browser interface to help.
>>>> Type 'q()' to quit R.
>>>>
>>>>   > source("annotation-bug.R")
>>>> Loading required package: AnnotationDbi
>>>> Loading required package: BiocGenerics
>>>> Loading required package: parallel
>>>>
>>>> Attaching package: ‘BiocGenerics’
>>>>
>>>> The following objects are masked from ‘package:parallel’:
>>>>
>>>>       clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
>>>>       clusterExport, clusterMap, parApply, parCapply, parLapply,
>>>>       parLapplyLB, parRapply, parSapply, parSapplyLB
>>>>
>>>> The following object is masked from ‘package:stats’:
>>>>
>>>>       xtabs
>>>>
>>>> The following objects are masked from ‘package:base’:
>>>>
>>>>       anyDuplicated, append, as.data.frame, as.vector, cbind,
>>>>       colnames,
>>>>       duplicated, eval, evalq, Filter, Find, get, intersect,
>>>>       is.unsorted,
>>>>       lapply, Map, mapply, match, mget, order, paste, pmax, pmax.int,
>>>>       pmin, pmin.int, Position, rank, rbind, Reduce, rep.int,
>>>>       rownames,
>>>>       sapply, setdiff, sort, table, tapply, union, unique, unlist
>>>>
>>>> Loading required package: Biobase
>>>> Welcome to Bioconductor
>>>>
>>>>       Vignettes contain introductory material; view with
>>>>       'browseVignettes()'. To cite Bioconductor, see
>>>>       'citation("Biobase")', and for packages 'citation("pkgname")'.
>>>>
>>>> Loading required package: DBI
>>>>
>>>> Error in as.list.default(envir) :
>>>>     no method for coercing this S4 class to a vector
>>>> In addition: Warning message:
>>>> In namespaceImportMethods(ns, loadNamespace(j <- imp[[1L]],
>>>> c(lib.loc,  :
>>>>     No generic function found corresponding to requested imported
>>>>     methods
>>>> for "as.list" from package "AnnotationDbi" (malformed exports?)
>>>>   > sessionInfo()
>>>> R version 3.0.2 (2013-09-25)
>>>> Platform: x86_64-unknown-linux-gnu (64-bit)
>>>>
>>>> locale:
>>>>    [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>>>>    [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>>>>    [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>>>>    [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>>>>    [9] LC_ADDRESS=C               LC_TELEPHONE=C
>>>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>>>
>>>> attached base packages:
>>>> [1] parallel  stats     graphics  grDevices utils     datasets
>>>> methods
>>>> [8] base
>>>>
>>>> other attached packages:
>>>> [1] annotate_1.40.0      org.Hs.eg.db_2.10.1  RSQLite_0.11.4
>>>> [4] DBI_0.2-7            AnnotationDbi_1.24.0 Biobase_2.22.0
>>>> [7] BiocGenerics_0.8.0
>>>>
>>>> loaded via a namespace (and not attached):
>>>> [1] colorspace_1.2-4 IRanges_1.20.6   stats4_3.0.2 XML_3.98-1.1
>>>> [5] xtable_1.7-2
>>>>
>>>
>>> Hmm...it works for me with the following sessionInfo, it seems the only
>>> differences are R version (I'm running R-patched) and version of
>>> xtable, but I
>>> tried a newer one and it still worked. Also, I don't have colorspace
>>> loaded.
>>>
>>> Dan
>>>
>>> R version 3.0.2 Patched (2013-12-18 r64488)
>>> Platform: x86_64-unknown-linux-gnu (64-bit)
>>>
>>> locale:
>>>   [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>>>   [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>>>   [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>>>   [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
>>>   [9] LC_ADDRESS=C               LC_TELEPHONE=C
>>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>>
>>> attached base packages:
>>> [1] parallel  stats     graphics  grDevices utils     datasets  methods
>>> [8] base
>>>
>>> other attached packages:
>>> [1] annotate_1.40.0      org.Hs.eg.db_2.10.1  RSQLite_0.11.4
>>> [4] DBI_0.2-7            AnnotationDbi_1.24.0 Biobase_2.22.0
>>> [7] BiocGenerics_0.8.0
>>>
>>> loaded via a namespace (and not attached):
>>> [1] IRanges_1.20.6 stats4_3.0.2   XML_3.98-1.1   xtable_1.7-1
>>>
>>>
>>>
>>>>
>>>> On Thu 09 Jan 2014 11:45:22 AM PST, James W. MacDonald wrote:
>>>>>
>>>>> Hi Ryan,
>>>>>
>>>>> I can't reproduce your error:
>>>>>
>>>>>>
>>>>>> library(annotate)
>>>>>> entrez.ids <- as.character(1:10)
>>>>>> lookUp(entrez.ids,
>>>>>
>>>>> + data="org.Hs.eg",
>>>>> + what="SYMBOL")
>>>>> $`1`
>>>>> [1] "A1BG"
>>>>>
>>>>> $`2`
>>>>> [1] "A2M"
>>>>>
>>>>> $`3`
>>>>> [1] "A2MP1"
>>>>>
>>>>> $`4`
>>>>> [1] NA
>>>>>
>>>>> $`5`
>>>>> [1] NA
>>>>>
>>>>> $`6`
>>>>> [1] NA
>>>>>
>>>>> $`7`
>>>>> [1] NA
>>>>>
>>>>> $`8`
>>>>> [1] NA
>>>>>
>>>>> $`9`
>>>>> [1] "NAT1"
>>>>>
>>>>> $`10`
>>>>> [1] "NAT2"
>>>>>
>>>>>>
>>>>>> sessionInfo()
>>>>>
>>>>> R version 3.0.2 (2013-09-25)
>>>>> Platform: x86_64-unknown-linux-gnu (64-bit)
>>>>>
>>>>> locale:
>>>>> [1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
>>>>> [3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
>>>>> [5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
>>>>> [7] LC_PAPER=en_US.UTF-8 LC_NAME=C
>>>>> [9] LC_ADDRESS=C LC_TELEPHONE=C
>>>>> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>>>>>
>>>>> attached base packages:
>>>>> [1] parallel stats graphics grDevices utils datasets methods
>>>>> [8] base
>>>>>
>>>>> other attached packages:
>>>>> [1] annotate_1.40.0 org.Hs.eg.db_2.10.1 RSQLite_0.11.4
>>>>> [4] DBI_0.2-7 AnnotationDbi_1.25.2 Biobase_2.22.0
>>>>> [7] BiocGenerics_0.8.0
>>>>>
>>>>> loaded via a namespace (and not attached):
>>>>> [1] IRanges_1.20.6 stats4_3.0.2 XML_3.98-1.1 xtable_1.7-1
>>>>>
>>>>> You might have some package higher in your search path that
>>>>> re-defines
>>>>> mget() somehow.
>>>>>
>>>>> Anyway, you might consider switching to select(), as it is much
>>>>> more
>>>>> powerful/useful than lookUp():
>>>>>
>>>>>>
>>>>>> select(org.Hs.eg.db, entrez.ids, "SYMBOL")
>>>>>
>>>>> ENTREZID SYMBOL
>>>>> 1 1 A1BG
>>>>> 2 2 A2M
>>>>> 3 3 A2MP1
>>>>> 4 4 <NA>
>>>>> 5 5 <NA>
>>>>> 6 6 <NA>
>>>>> 7 7 <NA>
>>>>> 8 8 <NA>
>>>>> 9 9 NAT1
>>>>> 10 10 NAT2
>>>>>
>>>>> Best,
>>>>>
>>>>> Jim
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Thursday, January 09, 2014 2:31:28 PM, Ryan C. Thompson wrote:
>>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> I'm having some trouble using the "lookUp" function in the
>>>>>> "annotate"
>>>>>> package. Every time I try to call it, I get the following error:
>>>>>>
>>>>>> Error in as.list.default(envir) :
>>>>>> no method for coercing this S4 class to a vector
>>>>>>
>>>>>> I can generate this error with the following short test case:
>>>>>>
>>>>>> library(org.Hs.eg.db)
>>>>>> library(annotate)
>>>>>> entrez.ids <- as.character(1:10)
>>>>>> lookUp(entrez.ids,
>>>>>> data="org.Hs.eg",
>>>>>> what="SYMBOL")
>>>>>>
>>>>>> Alternatively, simply running the example from the lookUp help
>>>>>> page
>>>>>> also produces the error.
>>>>>>
>>>>>> Can anyone help me get this working again?
>>>>>>
>>>>>> -Ryan Thompson
>>>>>>
>>>>>> _______________________________________________
>>>>>> 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
>>>>>
>>>>>
>>>>> --
>>>>> James W. MacDonald, M.S.
>>>>> Biostatistician
>>>>> University of Washington
>>>>> Environmental and Occupational Health Sciences
>>>>> 4225 Roosevelt Way NE, # 100
>>>>> Seattle WA 98105-6099
>>>>
>>>> _______________________________________________
>>>> 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
>>
>> _______________________________________________
>> 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
>
>



More information about the Bioconductor mailing list