[BioC] Building a package: R CMD check problems

Kasper Daniel Hansen khansen at stat.Berkeley.EDU
Tue Aug 30 19:57:39 CEST 2005


1) Drop all the stuff with .First.lib and so on.

You just put the required libraries in the DESCRIPTION file, like

Depends: methods, Biobase

2) You just put your class definitions in standard file in the /R  
directory. If you have a problem with methods having the same name as  
other packages, you can do one of the following
  a) not loading the conflicting package (not a good solution)
  b) rename your methods
  c) resolve them: let us say that package XY has a method  
getSomething with argument "object" - the defintion will look  
something like
      SetGeneric("getSomething", function(object) ....)
then your method can only have the "object"a rgument which may or may  
not be possible.
d) use namespaces, see the article in R-news some time ago by Luke  
Tierny, that has a good explanation.

Kasper


On Aug 30, 2005, at 7:29 AM, Raffaele Calogero wrote:

> Since we have started to use Applied Biosystem ABI 1700 arrays we have
> build a set of functions to handle these array data and we want now to
> build a package.
> The ABI 1700 data are stored in a S4 class called applera.
> We created a zzz.R file with:
> .First.lib <- function(libname, pkgname, where){
>             if(!require(methods)) stop("We require methods for package
> Applera")
>         where <- match(paste("package:", pkgname, sep=""), search())
>         .initApplera(where)
> }
>
> And we embedded the class and methods in the following way:
> .initApplera <- function(where){
> require("Biobase") || stop("cannot load applera without Biobase")
> require("affy") || stop("cannot load applera without affy")
> setClass("applera", representation(Organism="character",
> Geneid="character", Signal="exprSet", Sdev="exprSet", Cv="exprSet",
> Sn="exprSet", Flags="exprSet", Ctrl="list"), contains="exprSet",
> where=where)
> #Organism slot
> if(is.null(getGeneric("organism"))) setGeneric("organism",
> function(object) standardGeneric("organism"))
> setMethod("organism", signature(object="applera"), function(object)
> {object at Organism})
> #Primary geneId slot
> if(is.null(getGeneric("geneid")))setGeneric("geneid", function(object)
> standardGeneric("geneid"))
> setMethod("geneid", signature(object="applera"), function(object) {
> primaryId <- as.vector(object at Geneid)
> names(primaryId) <- geneNames(object at Signal)
> return(primaryId) })
> ...
> }
>
> The problem comes during the R CMD check applera.
> Everything work  fine until I run examples for the class object and  
> for
> methods having a name already defined in other packages (e.g. organism
> is already defined in "chromLocation") as instead I get the error
> Error: cannot find the function "geneid"
> Esecution halted
>  if I run an example using the method "geneid" that was not previously
> defined.
> I do not understand where is the error since the "organism" method and
> the "geneid" method have been defined in the same way.
> Any suggestion?
>
> Raffaele
>
> -- 
>
> ----------------------------------------
> Prof. Raffaele A. Calogero
> Bioinformatics and Genomics Unit
> Dipartimento di Scienze Cliniche e Biologiche
> c/o Az. Ospedaliera S. Luigi
> Regione Gonzole 10, Orbassano
> 10043 Torino
> tel.   ++39 0116705420
> Lab.   ++39 0116705408
> Fax    ++39 0119038639
> Mobile ++39 3333827080
> email: raffaele.calogero at unito.it
> www:   www.bioinformatica.unito.it
>
> _______________________________________________
> Bioconductor mailing list
> Bioconductor at stat.math.ethz.ch
> https://stat.ethz.ch/mailman/listinfo/bioconductor
>



More information about the Bioconductor mailing list