[BioC] gdata affects LumiBatch::combine method
Martin Morgan
mtmorgan at fhcrc.org
Thu Oct 11 06:33:59 CEST 2012
On 10/10/2012 09:25 PM, Mark Cowley wrote:
> Thanks Martin,
> Unfortunately, explicitly specifying lumi::combine seems to interfere with the S4 calling mechanism in an interactive session:
>
> ### only lumi
> library(lumi)
> load("Rmisc/n525.RDa")
> load("Rmisc/s217.RDa")
> load("Rmisc/s295.RDa")
> a <- lumi::combine(s217, n525, s295)
> Error in callGeneric(x, do.call(callGeneric, list(y, ...))) :
> 'callGeneric' must be called from a generic function or method
I can replicate that with example(LumiBatch) and then
lumi::combine(example.lumi[,1], example.lumi[,2], example.lumi[,3])
I'd say this was an issue in methods, and the work-around (again!) would be to
make the recursion here
> lumi::combine
nonstandardGenericFunction for "combine" defined from package "BiocGenerics"
function (x, y, ...)
{
if (length(list(...)) > 0L) {
callGeneric(x, do.call(callGeneric, list(y, ...)))
}
else {
standardGeneric("combine")
}
}
<environment: 0x1f53748>
into an iteration:
res = example.lumi[,1]
for (i in 2:3)
res = combine(res, example.lumi[,i])
Martin
>
> a <- combine(s217, n525, s295)
> class(a)
> # [1] "LumiBatch"
>
> ##### gdata then lumi
> library(gdata)
> library(lumi)
> load("Rmisc/n525.RDa")
> load("Rmisc/s217.RDa")
> load("Rmisc/s295.RDa")
> a <- lumi::combine(s217, n525, s295)
> Error in callGeneric(x, do.call(callGeneric, list(y, ...))) :
> 'callGeneric' must be called from a generic function or method
>
> a <- combine(s217, n525, s295)
> class(a)
> # [1] "LumiBatch"
>
> #### lumi then gdata
> library(lumi)
> library(gdata)
> load("Rmisc/n525.RDa")
> load("Rmisc/s217.RDa")
> load("Rmisc/s295.RDa")
> a <- lumi::combine(s217, n525, s295)
> Error in callGeneric(x, do.call(callGeneric, list(y, ...))) :
> 'callGeneric' must be called from a generic function or method
>
> a <- combine(s217, n525, s295)
> class(a)
> # [1] "data.frame"
>
>> sessionInfo()
> R version 2.15.1 (2012-06-22)
> Platform: x86_64-unknown-linux-gnu (64-bit)
>
> locale:
> [1] LC_CTYPE=en_AU.UTF-8 LC_NUMERIC=C
> [3] LC_TIME=en_AU.UTF-8 LC_COLLATE=en_AU.UTF-8
> [5] LC_MONETARY=en_AU.UTF-8 LC_MESSAGES=en_AU.UTF-8
> [7] LC_PAPER=C LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_AU.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods
> [7] base
>
> other attached packages:
> [1] gdata_2.11.0 lumi_2.8.0 nleqslv_1.9.3
> [4] methylumi_2.2.0 ggplot2_0.9.1 reshape2_1.2.1
> [7] 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
> [3] annotate_1.34.1 AnnotationDbi_1.18.1
> [5] bigmemory_4.2.11 BiocInstaller_1.4.7
> [7] Biostrings_2.24.1 bitops_1.0-4.1
> [9] BSgenome_1.24.0 colorspace_1.1-1
> [11] DBI_0.2-5 dichromat_1.2-4
> [13] digest_0.5.2 DNAcopy_1.30.0
> [15] GenomicRanges_1.8.12 genoset_1.6.0
> [17] grid_2.15.1 gtools_2.7.0
> [19] hdrcde_2.16 IRanges_1.14.4
> [21] KernSmooth_2.23-8 labeling_0.1
> [23] lattice_0.20-10 MASS_7.3-20
> [25] Matrix_1.0-6 memoise_0.1
> [27] mgcv_1.7-20 munsell_0.3
> [29] nlme_3.1-104 plyr_1.7.1
> [31] preprocessCore_1.18.0 proto_0.3-9.2
> [33] RColorBrewer_1.0-5 RCurl_1.91-1
> [35] Rsamtools_1.8.6 RSQLite_0.11.1
> [37] rtracklayer_1.16.3 stats4_2.15.1
> [39] stringr_0.6.1 tools_2.15.1
> [41] XML_3.9-4 xtable_1.7-0
> [43] zlibbioc_1.2.0
>
>
> Reordering my package loads so that lumi is last, and just using 'combine' works.
>
> cheers,
> Mark
>
> On 10/10/2012, at 7:06 AM, Martin Morgan <mtmorgan at fhcrc.org> wrote:
>
>> On 10/08/2012 09:40 PM, Mark Cowley wrote:
>>> Dear list,
>>> i'm trying to combine two LumiBatch objects, using the S4 combine("LumiBatch","LumiBatch") method, defined originally in BiocGenerics, and enhanced within lumi.
>>> In a fresh session, with just lumi loaded, everything works fine, i.e. I get a LumiBatch object.
>>> As soon as I load gdata, this breaks the combine method, instead returning a data.frame with very odd dimensions. This is true if I load gdata before, or after lumi. Note that showMethods("lumi") doesn't change after loading gdata. Any ideas?
>>
>> Hi Mark -- unfortunately, this is not easily avoidable. gdata (a CRAN package) defines its own function combine that masks the version used by lumi and other Bioconductor packages. The work-around is to invoke lumi's combine with, e.g.,
>>
>> lumi::combine(x = example.lumi[, 1], y = example.lumi[, 3])
>>
>> If gdata were in Bioconductor, we could coerce the author into writing a method for combine, as defined in BiocGenerics. If you were writing a package, then you could importMethodsFrom(lumi, combine) and use combine safely in your own package code whether or not gdata was on the search path.
>>
>> Martin
>>
>>> cheers,
>>> Mark
>>>
>>> ### lumi, then gdata
>>>> suppressPackageStartupMessages(library(lumi))
>>> Warning messages:
>>> 1: found methods to import for function ‘eapply’ but not the generic itself
>>> 2: replacing previous import ‘image’ when loading ‘graphics’
>>>> load("Rmisc/n525.RDa")
>>>> load("Rmisc/s295.RDa")
>>>> showMethods("combine")
>>> Function: combine (package BiocGenerics)
>>> x="AnnotatedDataFrame", y="AnnotatedDataFrame"
>>> x="ANY", y="missing"
>>> x="AssayData", y="AssayData"
>>> x="data.frame", y="data.frame"
>>> x="eSet", y="eSet"
>>> x="ExpressionSet", y="LumiBatch"
>>> x="LumiBatch", y="ExpressionSet"
>>> x="LumiBatch", y="LumiBatch"
>>> x="matrix", y="matrix"
>>> x="MethyLumiM", y="MethyLumiM"
>>> x="MethyLumiQC", y="MethyLumiQC"
>>> x="MethyLumiSet", y="MethyLumiSet"
>>> x="MIAME", y="MIAME"
>>>
>>>> a <- combine(n525, s295)
>>>> class(a)
>>> [1] "LumiBatch"
>>> attr(,"package")
>>> [1] "lumi"
>>> ## the expected output
>>>
>>>> suppressPackageStartupMessages(library(gdata))
>>>> showMethods("combine")
>>> Function: combine (package BiocGenerics)
>>> x="AnnotatedDataFrame", y="AnnotatedDataFrame"
>>> x="ANY", y="missing"
>>> x="AssayData", y="AssayData"
>>> x="data.frame", y="data.frame"
>>> x="environment", y="environment"
>>> (inherited from: x="AssayData", y="AssayData")
>>> x="eSet", y="eSet"
>>> x="ExpressionSet", y="LumiBatch"
>>> x="LumiBatch", y="ExpressionSet"
>>> x="LumiBatch", y="LumiBatch"
>>> x="matrix", y="matrix"
>>> x="MethyLumiM", y="MethyLumiM"
>>> x="MethyLumiQC", y="MethyLumiQC"
>>> x="MethyLumiSet", y="MethyLumiSet"
>>> x="MIAME", y="MIAME"
>>>
>>>> a <- combine(n525, s295)
>>>> class(a)
>>> [1] "data.frame"
>>>>
>>>
>>>
>>> #### gdata then lumi
>>>> suppressPackageStartupMessages(library(gdata))
>>>> suppressPackageStartupMessages(library(lumi))
>>> Warning messages:
>>> 1: found methods to import for function ‘eapply’ but not the generic itself
>>> 2: replacing previous import ‘image’ when loading ‘graphics’
>>>> load("Rmisc/n525.RDa")
>>>> load("Rmisc/s295.RDa")
>>>> showMethods("combine")
>>> Function: combine (package BiocGenerics)
>>> x="AnnotatedDataFrame", y="AnnotatedDataFrame"
>>> x="ANY", y="missing"
>>> x="AssayData", y="AssayData"
>>> x="data.frame", y="data.frame"
>>> x="eSet", y="eSet"
>>> x="ExpressionSet", y="LumiBatch"
>>> x="LumiBatch", y="ExpressionSet"
>>> x="LumiBatch", y="LumiBatch"
>>> x="matrix", y="matrix"
>>> x="MethyLumiM", y="MethyLumiM"
>>> x="MethyLumiQC", y="MethyLumiQC"
>>> x="MethyLumiSet", y="MethyLumiSet"
>>> x="MIAME", y="MIAME"
>>>
>>>> a <- combine(n525, s295)
>>>> class(a)
>>> [1] "LumiBatch"
>>> attr(,"package")
>>> [1] "lumi"
>>>
>>>
>>>> sessionInfo()
>>> R version 2.15.1 (2012-06-22)
>>> Platform: i386-apple-darwin9.8.0/i386 (32-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.10.0 nleqslv_1.9.4 Biobase_2.18.0 BiocGenerics_0.4.0
>>> [5] gdata_2.12.0
>>>
>>> loaded via a namespace (and not attached):
>>> [1] affy_1.36.0 affyio_1.26.0 annotate_1.36.0
>>> [4] AnnotationDbi_1.20.0 BiocInstaller_1.8.1 colorspace_1.1-1
>>> [7] DBI_0.2-5 grid_2.15.1 gtools_2.7.0
>>> [10] IRanges_1.16.2 KernSmooth_2.23-8 lattice_0.20-10
>>> [13] MASS_7.3-22 Matrix_1.0-9 methylumi_2.4.0
>>> [16] mgcv_1.7-21 nlme_3.1-104 parallel_2.15.1
>>> [19] preprocessCore_1.20.0 RSQLite_0.11.2 stats4_2.15.1
>>> [22] XML_3.95-0.1 xtable_1.7-0 zlibbioc_1.4.0
>>>
>>> _______________________________________________
>>> 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
>
--
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