Skip to content

[Bioc-devel] mget and AnnDbBimap problem

5 messages · Steve Lianoglou, Benilton Carvalho, Paul Shannon +1 more

#
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
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
#
Hi Paul,

Two guesses/comments:

On Tue, Oct 4, 2011 at 3:21 PM, Paul Shannon
<pshannon at systemsbiology.org> wrote:
Are you sure `name.map` is what you think it is in your method? Maybe
you can drop a call to `browser()` in your code to make sure name.map
is a bimap thing?

If `name.map` is what you expect it to be, maybe doing something like
`AnnotationDbi::mget(toupper(..), name.map, ...)` would work?

-steve
#
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:

  
    
#
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?  

 - Paul
On Oct 4, 2011, at 12:32 PM, Benilton Carvalho wrote:

            
#
On 10/04/2011 12:42 PM, Paul Shannon wrote:
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