[Bioc-devel] problem with class definitions between S4Vectors and RNeXML in using Summarized Experiment
Michael Lawrence
lawrence.michael at gene.com
Thu Apr 12 19:27:28 CEST 2018
Yea it's basically
library(S4Vectors)
library(RNeXML)
is(1:5, "Annotated")
# Found more than one class "Annotated" in cache; using the first,
from namespace 'S4Vectors'
# Also defined by ‘RNeXML’
# [1] FALSE
But can be worked around:
> is(1:5, getClass("Annotated", where=getNamespace("S4Vectors"))
# [1] FALSE
Of course, using class objects instead of class names in every call to
is() is not very palatable, but that's how it's done in all other
languages, as far as I know.
There is an inconsistency between new() and is() when resolving the
class name. new() looks into the calling package's namespace, while
is() looks at the package for the class of the 'object'. The new()
approach seems sensible for that function, since packages should be
abstracting the construction of their objects with constructors. The
is() approach is broken though, because it's easy to imagine cases
like where some foreign object is passed to a function, and the
function checks the type with is().
I can change is() to use the calling package as the fallback, so
DataFrame(1:5) no longer produces a message. But calling it from
another package, or global env, will still break, just like new(). How
does that sound?
On the other hand, maybe we should be more careful with calls to is()
and use class objects. That's a good workaround in this case, anyway,
since I probably can't get the change into R before release.
Michael
On Thu, Apr 12, 2018 at 9:03 AM, Aaron Lun <alun at wehi.edu.au> wrote:
> Well, it's not really SingleCellExperiment's problem, either.
>
> library(S4Vectors)
> DataFrame(1:5) # Silent, okay.
> library(RNeXML)
> DataFrame(1:5) # Prints out the message
> ## Found more than one class "Annotated" in cache; using the first,
> from namespace 'S4Vectors'
> ## Also defined by ‘RNeXML’
>
> Session information attached below.
>
> -Aaron
>
>> sessionInfo()
> R Under development (unstable) (2018-03-26 r74466)
> Platform: x86_64-pc-linux-gnu (64-bit)
> Running under: Ubuntu 16.04.4 LTS
>
> Matrix products: default
> BLAS: /home/cri.camres.org/lun01/Software/R/trunk/lib/libRblas.so
> LAPACK: /home/cri.camres.org/lun01/Software/R/trunk/lib/libRlapack.so
>
> locale:
> [1] LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
> [3] LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
> [5] LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
> [7] LC_PAPER=en_GB.UTF-8 LC_NAME=C
> [9] LC_ADDRESS=C LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] parallel stats4 stats graphics grDevices
> utils datasets
> [8] methods base
>
> other attached packages:
> [1] RNeXML_2.0.8 ape_5.1 S4Vectors_0.17.41
> [4] BiocGenerics_0.25.3
>
> loaded via a namespace (and not attached):
> [1] Rcpp_0.12.16 compiler_3.6.0 pillar_1.2.1
> [4] plyr_1.8.4 bindr_0.1.1 iterators_1.0.9
> [7] tools_3.6.0 uuid_0.1-2 jsonlite_1.5
> [10] tibble_1.4.2 nlme_3.1-137 lattice_0.20-35
> [13] pkgconfig_2.0.1 rlang_0.2.0 foreach_1.4.4
> [16] crul_0.5.2 curl_3.2 bindrcpp_0.2.2
> [19] httr_1.3.1 stringr_1.3.0 dplyr_0.7.4
> [22] xml2_1.2.0 grid_3.6.0 reshape_0.8.7
> [25] glue_1.2.0 data.table_1.10.4-3 R6_2.2.2
> [28] XML_3.98-1.10 purrr_0.2.4 reshape2_1.4.3
> [31] tidyr_0.8.0 magrittr_1.5 codetools_0.2-15
> [34] assertthat_0.2.0 bold_0.5.0 taxize_0.9.3
> [37] stringi_1.1.7 lazyeval_0.2.1 zoo_1.8-1
>
>
> On Thu, 2018-04-12 at 17:40 +0200, Elizabeth Purdom wrote:
>> Just to follow up on my previous post. I am able to replicate the
>> problem in the problem like in the github post from 2 years ago (http
>> s://github.com/epurdom/clusterExperiment/issues/66
>> <https://github.com/epurdom/clusterExperiment/issues/66>) only now it
>> is not the SummarizedExperiment class but the SingleCellExperiment
>> class that has the problem. [And I was incorrect, the problem does
>> occur in development version 2018-03-22 r74446].
>>
>> So this is actually a problem with the SingleCellExperiment package —
>> sorry for the incorrect subject line.
>>
>> All of the best,
>> Elizabeth
>>
>> >
>> > >
>> > > library(SingleCellExperiment)
>> > > SingleCellExperiment()
>> > class: SingleCellExperiment
>> > dim: 0 0
>> > metadata(0):
>> > assays(0):
>> > rownames: NULL
>> > rowData names(0):
>> > colnames: NULL
>> > colData names(0):
>> > reducedDimNames(0):
>> > spikeNames(0):
>> > >
>> > > library(RNeXML)
>> > Loading required package: ape
>> > >
>> > >
>> > > SingleCellExperiment()
>> > Found more than one class "Annotated" in cache; using the first,
>> > from namespace 'S4Vectors'
>> > Also defined by ‘RNeXML’
>> > Found more than one class "Annotated" in cache; using the first,
>> > from namespace 'S4Vectors'
>> > Also defined by ‘RNeXML’
>> > class: SingleCellExperiment
>> > dim: 0 0
>> > metadata(0):
>> > assays(0):
>> > rownames: NULL
>> > rowData names(0):
>> > colnames: NULL
>> > colData names(0):
>> > reducedDimNames(0):
>> > spikeNames(0):
>>
>>
>>
>> >
>> > >
>> > > sessionInfo()
>> > R Under development (unstable) (2018-03-22 r74446)
>> > Platform: x86_64-apple-darwin15.6.0 (64-bit)
>> > Running under: OS X El Capitan 10.11.6
>> >
>> > Matrix products: default
>> > BLAS:
>> > /System/Library/Frameworks/Accelerate.framework/Versions/A/Framewor
>> > ks/vecLib.framework/Versions/A/libBLAS.dylib
>> > LAPACK:
>> > /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapa
>> > ck.dylib
>> >
>> > locale:
>> > [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8
>> >
>> > attached base packages:
>> > [1] parallel stats4 stats graphics grDevices
>> > utils datasets methods base
>> >
>> > other attached packages:
>> > [1]
>> > RNeXML_2.0.8 ape_5.1 SingleCellE
>> > xperiment_1.1.2
>> > [4] SummarizedExperiment_1.9.16
>> > DelayedArray_0.5.30 BiocParallel_1.13.3
>> > [7]
>> > matrixStats_0.53.1 Biobase_2.39.2 GenomicRang
>> > es_1.31.23
>> > [10]
>> > GenomeInfoDb_1.15.5 IRanges_2.13.28 S4Vectors_0
>> > .17.41
>> > [13] BiocGenerics_0.25.3
>> >
>> > loaded via a namespace (and not attached):
>> > [1]
>> > Rcpp_0.12.16 pillar_1.2.1 bindr_0.1.1
>> > compiler_3.5.0
>> > [5]
>> > plyr_1.8.4 XVector_0.19.9 iterators_1.0.9
>> > bitops_1.0-6
>> > [9] tools_3.5.0 zlibbioc_1.25.0 uuid_0.1-
>> > 2 tibble_1.4.2
>> > [13] jsonlite_1.5 nlme_3.1-137 lattice_0.20-
>> > 35 pkgconfig_2.0.1
>> > [17] rlang_0.2.0 Matrix_1.2-
>> > 14 foreach_1.4.4 crul_0.5.2
>> > [21]
>> > curl_3.2 bindrcpp_0.2.2 GenomeInfoDbData_1.1.
>> > 0 dplyr_0.7.4
>> > [25]
>> > httr_1.3.1 stringr_1.3.0 xml2_1.2.0
>> > grid_3.5.0
>> > [29]
>> > glue_1.2.0 reshape_0.8.7 data.table_1.10.4-
>> > 3 R6_2.2.2
>> > [33] XML_3.98-
>> > 1.10 purrr_0.2.4 tidyr_0.8.0 reshape
>> > 2_1.4.3
>> > [37] magrittr_1.5 codetools_0.2-
>> > 15 assertthat_0.2.0 bold_0.5.0
>> > [41]
>> > taxize_0.9.3 stringi_1.1.7 lazyeval_0.2.1
>> > RCurl_1.95-4.10
>> > [45] zoo_1.8-1
>>
>> >
>> > On Apr 11, 2018, at 10:25 AM, Elizabeth Purdom <epurdom at stat.Berkel
>> > ey.EDU> wrote:
>> >
>> > Hello,
>> >
>> > Our package clusterExperiment has suddenly started producing errors
>> > in the bioconductor devel branch because our unit tests are
>> > failing, even though we haven’t pushed any changes and they passed
>> > previously. We first noticed this on April 5th.
>> >
>> > I believe the source of these errors likely do to calls to
>> > SummarizedExperiment() creating the following messages due to
>> > conflicts in ‘RNeXML’ and ’S4Vectors’ both defining class
>> > ‘Annotated':
>> >
>> > >
>> > > Found more than one class "Annotated" in cache; using the first,
>> > > from namespace 'S4Vectors'
>> > > Also defined by ‘RNeXML’
>> > This is killing a vast number of our tests where we repeatedly use
>> > ‘expect_silent’ calls in our unit tests and SummarizedExperiment
>> > calls underlie everything.
>> >
>> > We had this message issue two years ago (https://github.com/epurdom
>> > /clusterExperiment/issues/66
>> > <https://github.com/epurdom/clusterExperiment/issues/66>), when it
>> > appeared to be a problem with two definitions of the ‘Annotated’
>> > class in two packages that are both dependencies of packages we
>> > call. At that time, Michael Lawrence posted that he would fix the
>> > problem, and it was then fixed in later versions of bioconductor/R.
>> > But it appears to be back. I am unfortunately unable to get the
>> > RNeXML package to compile from source on my computer with the
>> > current Mac OS X development binary which I just downloaded (2018-
>> > 04-05 r74542), so I haven’t been able to completely redo the code
>> > that we presented in that earlier github issue to confirm it is the
>> > exact same problem. I am having to rely on the error reports/logs
>> > from both Bioconductor and TravisCI (e.g. 2018-04-07 r74551), where
>> > this message shows up everywhere and didn’t before. Thus I’m
>> > guessing that since they are the same messages from before that the
>> > source is again the call to SummarizedExperiment.
>> >
>> > I would note that in development version 2018-03-22 r74446, where I
>> > was able to install all of the packages, I was not getting these
>> > messages.
>> >
>> > Thanks,
>> > Elizabeth Purdom
>>
>> [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> Bioc-devel at r-project.org mailing list
>> https://stat.ethz.ch/mailman/listinfo/bioc-devel
>
More information about the Bioc-devel
mailing list