[Bioc-devel] Importing get() method from GO.db

Hervé Pagès hpages at fhcrc.org
Thu Jul 2 02:02:01 CEST 2009


Hi Jim,

James MacDonald wrote:
> Hi,
> 
> My package is erroring out on a call to get(goid, GOTERM) because it doesn't know about the 'GOTermsAnnDbBimap' method for get(), and I am not sure how to import it. The error can be created by
> 
> library(affycoretools)
> debug(affycoretools:::houtSel)
> source("tmp.r")
> 
> using the attached file. Nothing but affycoretools is required for the tmp.r file.

I didn't get any attached file. Are you sure this mailing list allows them?

> 
> On a clean start of R, I get:
> 
>> library(GO.db)
>> showMethods(get)
> Function: get (package base)
> x="ANY", pos="ANY", envir="ANY"
> x="ANY", pos="ANY", envir="AnnDbBimap"
> x="ANY", pos="AnnDbBimap", envir="missing"
> x="character", pos="character", envir="missing"
>     (inherited from: x="ANY", pos="ANY", envir="ANY")
> x="character", pos="missing", envir="environment"
>     (inherited from: x="ANY", pos="ANY", envir="ANY")
> 
>> get(Lkeys(GOTERM)[5], GOTERM)
> GOID: GO:0000007
> Term: low-affinity zinc ion transmembrane transporter activity
> Ontology: MF
> Definition: Catalysis of the transfer of a solute or solutes from one
>     side of a membrane to the other according to the reaction: Zn2+ =
>     Zn2+, probably powered by proton motive force. In low affinity
>     transport the transporter is able to bind the solute only if it is
>     present at very high concentrations.
>> showMethods(get)
> Function: get (package base)
> x="ANY", pos="ANY", envir="ANY"
> x="ANY", pos="ANY", envir="AnnDbBimap"
> x="ANY", pos="AnnDbBimap", envir="missing"
> x="character", pos="GOTermsAnnDbBimap", envir="missing"
>     (inherited from: x="ANY", pos="AnnDbBimap", envir="missing")
> x="character", pos="character", envir="missing"
>     (inherited from: x="ANY", pos="ANY", envir="ANY")
> x="character", pos="missing", envir="environment"
>     (inherited from: x="ANY", pos="ANY", envir="ANY")
> 
> But even trying the above trick to get the GOTermsAnnDbBimap method from within a function in my package results in the error:
> 
> Error in get(Lkeys(GOTERM)[5], GOTERM) : 
>   use of NULL environment is defunct
> 

I don't know why but it looks like you are calling the get() function
defined in base:

   > base::get(keys(GOTERM)[5], GOTERM)
   Error in base::get(keys(GOTERM)[5], GOTERM) :
     use of NULL environment is defunct

which is not a generic function:

   > base::get
   function (x, pos = -1, envir = as.environment(pos), mode = "any",
       inherits = TRUE)
   .Internal(get(x, envir, mode, inherits))
   <environment: namespace:base>

Try calling the get() defined in AnnotationDbi:

   > AnnotationDbi::get(keys(GOTERM)[5], GOTERM)
   GOID: GO:0000007
   Term: low-affinity zinc ion transmembrane transporter activity
   Ontology: MF
   Definition: Catalysis of the transfer of a solute or solutes from one
       side of a membrane to the other according to the reaction: Zn2+ =
       Zn2+, probably powered by proton motive force. In low affinity
       transport the transporter is able to bind the solute only if it is
       present at very high concentrations.

This one is the generic function that knows about the 'GOTermsAnnDbBimap'
method:

   > AnnotationDbi::get
   standardGeneric for "get" defined from package "base"

   function (x, pos = -1, envir = as.environment(pos), mode = "any",
       inherits = TRUE)
   standardGeneric("get")
   <environment: 0xe72d88>
   Methods may be defined for arguments: x, pos, envir, mode, inherits
   Use  showMethods("get")  for currently available ones.

   > showMethods("get")
   Function: get (package base)
   x="ANY", pos="AnnDbBimap", envir="missing"
   x="ANY", pos="ANY", envir="AnnDbBimap"
   x="ANY", pos="ANY", envir="ANY"
   x="ANY", pos="GOTermsAnnDbBimap", envir="ANY"
       (inherited from: x="ANY", pos="ANY", envir="ANY")
   x="character", pos="GOTermsAnnDbBimap", envir="missing"
       (inherited from: x="ANY", pos="AnnDbBimap", envir="missing")
   x="character", pos="missing", envir="environment"
       (inherited from: x="ANY", pos="ANY", envir="ANY")

Cheers,

H.

 > sessionInfo()
R version 2.10.0 Under development (unstable) (2009-06-15 r48781)
x86_64-unknown-linux-gnu

locale:
  [1] LC_CTYPE=en_CA.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=en_CA.UTF-8        LC_COLLATE=en_CA.UTF-8
  [5] LC_MONETARY=C              LC_MESSAGES=en_CA.UTF-8
  [7] LC_PAPER=en_CA.UTF-8       LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_CA.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

other attached packages:
[1] GO.db_2.3.0         RSQLite_0.7-1       DBI_0.2-4
[4] AnnotationDbi_1.7.7 Biobase_2.5.4



> TIA,
> 
> Jim
> 
> 
> 
> James W. MacDonald, M.S.
> Biostatistician
> Douglas Lab
> 5912 Buhl
> 1241 E. Catherine St.
> Ann Arbor MI 48109-5618
> 734-615-7826
> **********************************************************
> Electronic Mail is not secure, may not be read every day, and should not be used for urgent or sensitive issues
> 
> _______________________________________________
> Bioc-devel at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/bioc-devel

-- 
Hervé Pagès

Program in Computational Biology
Division of Public Health Sciences
Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N, M2-B876
P.O. Box 19024
Seattle, WA 98109-1024

E-mail: hpages at fhcrc.org
Phone:  (206) 667-5791
Fax:    (206) 667-1319



More information about the Bioc-devel mailing list