[BioC] Error : package slot missing from signature for generic

Martin Morgan mtmorgan at fhcrc.org
Mon Aug 6 01:26:15 CEST 2012


Hi again Mark --

On 08/04/2012 01:15 PM, Martin Morgan wrote:
> Hi Mark --
>
> On 08/03/2012 12:14 AM, Mark Cowley wrote:
>> any ideas fellow bioconductors?
>> cheers, Mark
>> On 01/08/2012, at 9:41 AM, Mark Cowley wrote:
>>
>>> Dear guRu's,
>>> please help me escape dependency hell...
>>> in my package foo, i'm trying to replace the 'sampleNames<-' method
>>> from package lumi. This works well, ie I can install foo, and execute
>>> the updated code.
>>>
>>> However, if my package foo imports oligoClasses, (or as it turns out,
>>> a chain of dependencies which lead to oligoClasses), I get this error
>>> during INSTALL
>>> * installing to library
>>> Œ/Library/Frameworks/R.framework/Versions/2.15/Resources/library‚
>>> * installing *source* package Œfoo‚ ...
>>> ** R
>>> ** preparing package for lazy loading
>>> Warning: replacing previous import Œimage‚ when loading Œgraphics‚
>>> Warning: replacing previous import Œdensity‚ when loading Œstats‚
>>> Warning: replacing previous import Œresiduals‚ when loading Œstats‚
>>> ** help
>>> *** installing help indices
>>> ** building package indices
>>> ** testing if installed package can be loaded
>>> *** arch - i386
>>> Warning: replacing previous import Œimage‚ when loading Œgraphics‚
>>> Warning: replacing previous import Œdensity‚ when loading Œstats‚
>>> Warning: replacing previous import Œresiduals‚ when loading Œstats‚
>>> Error : package slot missing from signature for generic ŒsampleNames<-‚
>>> and classes LumiBatch, ANY
>>> cannot use with duplicate class names (the package may need to be
>>> re-installed)
>>> Error: loading failed
>>> Execution halted
>>> *** arch - x86_64
>>> Warning: replacing previous import Œimage‚ when loading Œgraphics‚
>>> Warning: replacing previous import Œdensity‚ when loading Œstats‚
>>> Warning: replacing previous import Œresiduals‚ when loading Œstats‚
>>> Error : package slot missing from signature for generic ŒsampleNames<-‚
>>> and classes LumiBatch, ANY
>>> cannot use with duplicate class names (the package may need to be
>>> re-installed)
>>> Error: loading failed
>>> Execution halted
>>> ERROR: loading failed for Œi386‚, Œx86_64‚
>>> * removing
>>> Œ/Library/Frameworks/R.framework/Versions/2.15/Resources/library/foo‚
>>> * restoring previous
>>> Œ/Library/Frameworks/R.framework/Versions/2.15/Resources/library/foo‚
>>>
>>> The message tells me its a problem with my 'sampleNames<-' method,
>>> however it looks fine to me:
>>> 1) foo installs just fine when I don't import oligoClasses
>>> 2) My sampleNames<- code can be pasted into an R session just fine
>
> This strongly suggests that it is an imports issue. I'd guess that you
> need to importFrom(Biobase, "sampleNames<-") or importMethodFrom(oligo,
> "sampleNames<-")
>
> I think this is likely an error in the methods package, and will try to
> generate a reproducible example.

I looked at this more closely, and do think that this is an error in the 
methods package. I don't think changing the imports directives will 
help, and don't have another workaround to offer; I'll report this to 
the R-devel mailing list.

If it is any consolation (?), I don't think it's a good idea to redefine 
and export an existing method. Someone will eventually load your package 
and wonder why sampleNames<- is behaving differently. If you think the 
method has an error (which I'm inferring from your documentation 
string), then much better to contact the 
packageDescription("lumi")$Maintainer and introduce the fix at the 
source. Or to define and use a new generic.

Martin

> Martin
>
>
>>> 3) the error appears as soon as I add a import(oligoClasses) or
>>> importFrom(oligoClasses,'sampleNames<-') to foo's NAMESPACE
>>>
>>> I've had a look at oligoClasses, and it seems to be playing by the
>>> rules: it importMethodsFrom(Biobase, "sampleNames<-") and
>>> exportMethods("sampleNames<-") for a 'RangedDataCNV' class. It
>>> doesn't import lumi, nor does it know about
>>> sampleNames<-,LumiBatch,ANY-method
>>>
>>> i've spent a few days trying to work this one out, so can anyone
>>> point me in the right direction?
>>>
>>> cheers,
>>> Mark
>>>
>>> foo/R/LumiBatch-methods.R:
>>> #' @name LumiBatch-methods
>>> #' @title a collection of LumiBatch manipulators
>>> #' @description \code{sampleNames<-}: set sampleNames in LumiBatch
>>> objects,
>>> #' including the QC, vstParameter, transformFun and controlData slots
>>> #'
>>> #' @note code came from lumi_2.8.0 & modified by MJC to set the
>>> controlData slot
>>> #'  properly
>>> #'
>>> #' @param object an \code{LumiBatch} object
>>> #' @param value a character vector of column names
>>> #' @return a \code{LumiBatch} object
>>> #' @rdname LumiBatch-methods
>>> #' @aliases sampleNames<-,LumiBatch,ANY-method
>>> #' @export
>>> #' @importMethodsFrom Biobase "sampleNames<-"
>>> #' @importMethodsFrom lumi "sampleNames<-"
>>> #' @import oligoClasses
>>> setMethod("sampleNames<-",
>>>     signature=signature("LumiBatch", "ANY"),
>>>     function(object, value) {
>>>         object <- callNextMethod()
>>>         ddim <- dim(object)
>>>         if (!is.null(object at QC)) {
>>>             QC <- object at QC
>>>             if (!is.null(QC$sampleSummary))
>>>                 if (ncol(QC$sampleSummary) == ddim[2])
>>>                     colnames(QC$sampleSummary) <- value
>>>             if (!is.null(QC$BeadStudioSummary))
>>>                 if (nrow(QC$BeadStudioSummary) == ddim[2])
>>>                     rownames(QC$BeadStudioSummary) <- value
>>>             object at QC <- QC
>>>         }
>>>         if (!is.null(attr(object, "vstParameter"))) {
>>>             vstParameter <- attr(object, "vstParameter")
>>>             if (!is.null(nrow(vstParameter))) {
>>>                 if (nrow(vstParameter) == ddim[2]) {
>>>                     rownames(vstParameter) <- value
>>>                     transformFun <- attr(object, "transformFun")
>>>                     names(transformFun) <- value
>>>                     attr(object, "vstParameter") <- vstParameter
>>>                     attr(object, "transformFun") <- transformFun
>>>                 }
>>>             }
>>>         }
>>>         if (nrow(object at controlData) > 0) {
>>>             # modified by MJC
>>>             colnames(controlData(object)) <- c("controlType",
>>> "ProbeID", value)
>>>         }
>>>         return(object)
>>>     }
>>> )
>>>
>>>
>>> foo/NAMESPACE:
>>> exportMethods("sampleNames<-")
>>> import(oligoClasses)
>>> importMethodsFrom(Biobase,"sampleNames<-")
>>> importMethodsFrom(lumi,"sampleNames<-")
>>>
>>>
>>> foo/DESCRIPTION:
>>> Package: foo
>>> Maintainer: Mark Cowley <m.cowley at garvan.org.au>
>>> License: GPL-2
>>> Title: Quicktest package for rapid development with testthat facilities
>>> Author: Mark Cowley <m.cowley at garvan.org.au>
>>> Description: A lightweight library for rapid iterative development of
>>> new
>>>     code and test suites. Once code is confirmed to work, you should
>>> move it out
>>>     to a dedicated package.
>>> Version: 0.1
>>> Date: 2012-08-01
>>> Depends:
>>>     R (>= 2.0),
>>>     methods,
>>>     Biobase,
>>>     lumi
>>> Suggests:
>>>     roxygen2,
>>>     testthat,
>>> Imports:
>>>     Biobase,
>>>     lumi,
>>>     oligoClasses
>>> Collate:
>>>     'LumiBatch-methods.R'
>>>
>>>
>>>> sessionInfo()
>>> R version 2.15.1 (2012-06-22)
>>> Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
>>>
>>> locale:
>>> [1] en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8
>>>
>>> attached base packages:
>>> [1] stats     graphics  grDevices utils     datasets  methods   base
>>>
>>> other attached packages:
>>> [1] lumi_2.8.0         nleqslv_1.9.3      methylumi_2.2.0
>>> ggplot2_0.9.1
>>> [5] reshape2_1.2.1     scales_0.2.1       Biobase_2.16.0
>>> BiocGenerics_0.2.0
>>>
>>> loaded via a namespace (and not attached):
>>> [1] affy_1.34.0           affyio_1.24.0         annotate_1.34.1
>>> [4] AnnotationDbi_1.18.1  bigmemory_4.2.11      BiocInstaller_1.4.7
>>> [7] Biostrings_2.24.1     bitops_1.0-4.1        BSgenome_1.24.0
>>> [10] colorspace_1.1-1      DBI_0.2-5             dichromat_1.2-4
>>> [13] digest_0.5.2          DNAcopy_1.30.0        GenomicRanges_1.8.9
>>> [16] genoset_1.6.0         grid_2.15.1           hdrcde_2.16
>>> [19] IRanges_1.14.4        KernSmooth_2.23-8     labeling_0.1
>>> [22] lattice_0.20-6        MASS_7.3-19           Matrix_1.0-6
>>> [25] memoise_0.1           mgcv_1.7-19           munsell_0.3
>>> [28] nlme_3.1-104          plyr_1.7.1            preprocessCore_1.18.0
>>> [31] proto_0.3-9.2         RColorBrewer_1.0-5    RCurl_1.91-1
>>> [34] Rsamtools_1.8.5       RSQLite_0.11.1        rtracklayer_1.16.3
>>> [37] stats4_2.15.1         stringr_0.6.1         tools_2.15.1
>>> [40] XML_3.9-4             xtable_1.7-0          zlibbioc_1.2.0
>>>
>>>
>>>
>>>     [[alternative HTML version deleted]]
>>>
>>> _______________________________________________
>>> Bioconductor mailing list
>>> Bioconductor at r-project.org
>>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>>> Search the archives:
>>> http://news.gmane.org/gmane.science.biology.informatics.conductor
>>
>> _______________________________________________
>> Bioconductor mailing list
>> Bioconductor at r-project.org
>> https://stat.ethz.ch/mailman/listinfo/bioconductor
>> Search the archives:
>> http://news.gmane.org/gmane.science.biology.informatics.conductor
>>
>
>


-- 
Computational Biology / Fred Hutchinson Cancer Research Center
1100 Fairview Ave. N.
PO Box 19024 Seattle, WA 98109

Location: Arnold Building M1 B861
Phone: (206) 667-2793



More information about the Bioconductor mailing list