[Bioc-devel] SummarizedExperiments not equal after serialisation
Martin Morgan
mtmorg@n@b|oc @end|ng |rom gm@||@com
Sat May 11 14:07:51 CEST 2019
I think it has to do with the use of reference classes in the assay slot, which have different environments
se = SummarizedExperiment()
saveRDS(se, fl <- tempfile())
se1 = readRDS(fl)
and then
> all.equal(se using assays, se1 using assays)
[1] "Class definitions are not identical"
> all.equal(se using assays@.xData, se1 using assays@.xData)
[1] "Component \".self\": Class definitions are not identical"
> se using assays@.xData
<environment: 0x7fb1de1ede90>
> se1 using assays@.xData
<environment: 0x7fb1fc2bca78>
Martin
On 5/11/19, 6:38 AM, "Bioc-devel on behalf of Laurent Gatto" <bioc-devel-bounces using r-project.org on behalf of laurent.gatto using uclouvain.be> wrote:
I would appreciate some background about the following:
> suppressPackageStartupMessages(library("SummarizedExperiment"))
> set.seed(1L)
> m <- matrix(rnorm(16), ncol = 4, dimnames = list(letters[1:4], LETTERS[1:4]))
> rowdata <- DataFrame(X = 1:4, row.names = letters[1:4])
> se1 <- SummarizedExperiment(m, rowData = rowdata)
> se2 <- SummarizedExperiment(m, rowData = rowdata)
> all.equal(se1, se2)
[1] TRUE
But after serialising and reading se2, the two instances aren't equal any more:
> saveRDS(se2, file = "se2.rds")
> rm(se2)
> se2 <- readRDS("se2.rds")
> all.equal(se1, se2)
[1] "Attributes: < Component “assays”: Class definitions are not identical >"
Session information provided below.
Thank you in advance,
Laurent
R version 3.6.0 RC (2019-04-21 r76417)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.2 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/libf77blas.so.3.10.3
LAPACK: /usr/lib/x86_64-linux-gnu/atlas/liblapack.so.3.10.3
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=fr_FR.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=fr_FR.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=fr_FR.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=fr_FR.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] parallel stats4 stats graphics grDevices utils datasets
[8] methods base
other attached packages:
[1] SummarizedExperiment_1.14.0 DelayedArray_0.10.0
[3] BiocParallel_1.18.0 matrixStats_0.54.0
[5] Biobase_2.44.0 GenomicRanges_1.36.0
[7] GenomeInfoDb_1.20.0 IRanges_2.18.0
[9] S4Vectors_0.22.0 BiocGenerics_0.30.0
loaded via a namespace (and not attached):
[1] lattice_0.20-38 bitops_1.0-6 grid_3.6.0
[4] zlibbioc_1.30.0 XVector_0.24.0 Matrix_1.2-17
[7] tools_3.6.0 RCurl_1.95-4.12 compiler_3.6.0
[10] GenomeInfoDbData_1.2.1
_______________________________________________
Bioc-devel using r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/bioc-devel
More information about the Bioc-devel
mailing list