[BioC] Using annotation maps as environments in packages

Antti Honkela antti.honkela at tkk.fi
Thu Mar 4 19:18:25 CET 2010


Hi all,

I have a weird problem when I try to write a function in a package  
that would use annotation maps (e.g. mouse430a2SYMBOL) as an  
environment that the function works on its own breaks when moved into  
a package.

The maps can usually be used as environments without problems and the  
following works fine:
 > library(mouse430a2.db)
 > get("1419728_at", env=mouse430a2SYMBOL)

The same is true if I define an own function to access the map, and  
this runs without problems:
 > getAnnotation <- function(gene, env) { return (get(gene, env=env)) }
 > getAnnotation("1419728_at", env=mouse430a2SYMBOL)

However, if I move the same function definition to an independent  
package, the same call results in an error:
 > getAnnotation("1419728_at", env=mouse430a2SYMBOL)
Error in get(gene, env = env) : invalid 'envir' argument

Any ideas how to fix or circumvent this?

(Note that in the sessionInfo below, testpkg is a minimal package only  
containing the above function definition.)


Best regards,

Antti

---------------------------------------------------------
 > sessionInfo()
R version 2.10.1 (2009-12-14)
i386-apple-darwin9.8.0

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] mouse430a2.db_2.3.5 org.Mm.eg.db_2.3.6  RSQLite_0.7-3        
DBI_0.2-4           AnnotationDbi_1.8.1 Biobase_2.6.0
[7] testpkg_0.0-1

loaded via a namespace (and not attached):
[1] affy_1.24.2          affyio_1.14.0        preprocessCore_1.8.0


-- 
Antti Honkela
Antti.Honkela at tkk.fi   -   http://www.cis.hut.fi/ahonkela/



More information about the Bioconductor mailing list