[Bioc-devel] mget and AnnDbBimap problem

Martin Morgan mtmorgan at fhcrc.org
Tue Oct 4 21:59:07 CEST 2011


On 10/04/2011 12:42 PM, Paul Shannon wrote:
> Thanks to both of you!
>
> This from Steve worked:
>
>      name.lookup = AnnotationDbi::mget (toupper (node.names), name.map, ifnotfound=NA)
>
> and this from Benilton:
>
>     importClassesFrom(AnnotationDbi)
>     importMethodsFrom(AnnotationDbi, mget)
>
> I assume the latter is recommended?

yes; no need for AnnotationDbi in the NAMESPACE (from what you've said 
so far, I guess the 'user' will library(org.Hs.eg.db)...)

Martin
>
>   - Paul
>
>
> On Oct 4, 2011, at 12:32 PM, Benilton Carvalho wrote:
>
>> import AnnotationDbi to your RCytoscape package (on both DESCRIPTION
>> and NAMESPACE files)
>>
>> b
>>
>> On 4 October 2011 20:21, Paul Shannon<pshannon at systemsbiology.org>  wrote:
>>> There is a function in my RCytoscape package which fails on a call to mget when passed an AnnDbBimap ('org.Hs.egSYMBOL2EG').  The same mget call works fine in client code.   I figure this is caused by package structure, NAMESPACE, or something related.  But I cannot figure it out.
>>>
>>>            client code:  tbls.trompeter<- read.interactions ('trompeter.tsv', org.Hs.egSYMBOL2EG)
>>>     error from package:  Error in mget(toupper(node.names), name.map, ifnotfound = NA):  second argument must be an environment
>>>         executing this:  name.lookup.tbl<- mget (toupper (node.names), name.map, ifnotfound=NA)
>>>   from function defined:  read.interactions<- function (filename, name.map)
>>>
>>> However, if I call mget (toupper (node.names), org.Hs.egSYMBOL2EG) directly in the client code, it works fine.
>>>
>>> Confused by this, and not sure whether AnnDbBimap can be construed as an environment, I tried showMethods, to no avail:
>>>
>>>    >  showMethods("mget")
>>>      Function: mget (package base)
>>>      x="ANY", envir="AnnDbBimap"
>>>      x="ANY", envir="ANY"
>>>
>>> So I guessed that RCytoscape does not know about the AnnotationDbi class, so when it executes in its namespace, it does not know that org.Hs.egSYMBOL2EG can be construed as an environment; it is therefore not a legal second argument to mget.
>>>
>>> So I tried adding AnnotationDbi to the Depends line of DESCRIPTION, but that did not help.
>>>
>>> There is something basic I am missing here.
>>>
>>> Can anyone help?
>>>
>>>   - Paul
>>>
>>>
>>>> sessionInfo ()
>>> R version 2.13.0 (2011-04-13)
>>> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
>>>
>>> locale:
>>> [1] en_US.utf-8/en_US.utf-8/C/C/en_US.utf-8/en_US.utf-8
>>>
>>> attached base packages:
>>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>>
>>> other attached packages:
>>>   [1] yeastMetabolism_1.0.41 RCurl_1.6-7            bitops_1.0-4.1         genefilter_1.34.0      org.Hs.eg.db_2.5.0
>>>   [6] RSQLite_0.9-4          DBI_0.2-5              KEGGgraph_1.9.2        XML_3.4-0              RCytoscape_1.3.22
>>> [11] AnnotationDbi_1.14.1   Biobase_2.12.1         XMLRPC_0.2-4           graph_1.30.0           RUnit_0.4.26
>>>
>>> loaded via a namespace (and not attached):
>>> [1] annotate_1.30.0 splines_2.13.0  survival_2.36-5 tools_2.13.0    xtable_1.5-6
>>>
>>> _______________________________________________
>>> Bioc-devel at r-project.org mailing list
>>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>>>
>>
>>
>>
>> --
>> Successful people ask better questions, and as a result, they get
>> better answers. (Tony Robbins)
>
> _______________________________________________
> Bioc-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel


-- 
Computational Biology
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N. PO Box 19024 Seattle, WA 98109

Location: M1-B861
Telephone: 206 667-2793



More information about the Bioc-devel mailing list