[Bioc-devel] importing packages without a name space

Seth Falcon sfalcon at fhcrc.org
Tue Apr 17 18:17:15 CEST 2007

"Laurent Gatto" <L.Gatto at dnavision.be> writes:
> You are right. I started to write the code using simpleaffy as an
> example, as it does similar things. Everything worked fine (and still
> does) without the NAMESPACE file.

In general, that just isn't a good moel for how to do things.  I am
not surprised that you've encountered difficulties with using a
NAMESPACE given that setup.

>> So I'm guessing that .initClassesAndMethods() contains all of your
>> setClass and setMethod calls.  Can you try just putting those at the
>> package level in your R code?  
> All the setClass and SetMethods are in the main R file.
>> What does .createYAQCEnvironment do?
> The function creates a new environment and loads some data that is
> stored in a file in the data directory of the package:
> .createYAQCEnvironment <- function() {
>   if(!exists(".yaqcEnv")) {
>     .yaqcEnv <- new.env()
>      data(morespikes,envir =.yaqcEnv )
>      assign(".yaqcEnv",.yaqcEnv,envir=globalenv())
>   }
> }

It would be much cleaner to put this environment in your package name
space and not muck with the globalenv.  How about putting this in one
of your .R files:

   .yaqcEnv <- new.env(parent=emptyenv(), hash=TRUE)
   data(morespikes, envir = .yaqcEnv)

And then you can decide whether this is something the user should have
access to by exporting this object in the NAMESPACE file or not.

>> Have you exported all classes and methods in your NAMESPACE file?
> Yes, I export the class with 'exportClasses("YAQCStats")', the formal
> methods with exportMethods() and the other function with export().


>> Perhaps you want to post your DESCRIPTION file as well, R is fairly
>> picky about the syntax and I'd like to rule that out.
> Package: yaqcaffy
> Title: Affymetrix expression data quality control and reproducibility
> analysis
> Version: 0.0.12
> Author: Laurent Gatto
> Description: Quality control of Affymetrix GeneChip expression data  
>              and reproducibility analysis of human whole genome chips 
>              with the MAQC reference datasets. 
> Maintainer: Laurent Gatto <l.gatto at dnavision.be>
> Depends: R (>= 2.0), simpleaffy, methods
> Imports: geneplotter
> biocViews: Microarray,OneChannel,QualityControl
> License: The Artistic License, Version 2.0
> URL: http://www.bioconductor.org

That looks reasonable.  Are you still seeing the same error messages
or are things working better/different now?

+ seth

Seth Falcon | Computational Biology | Fred Hutchinson Cancer Research Center

More information about the Bioc-devel mailing list