I installed SingleCellExperiment_1.12.0.
I am unable to store records in the SingleCellExperiment reduceDims metadata slot using accessors; that is, I want to store the information in
...
..@ int_colData :Formal class 'DFrame' [package "S4Vectors"] with 6 slots
.. .. ..@ rownames : NULL
.. .. ..@ nrows : int 0
.. .. ..@ listData :List of 3
.. .. .. ..$ reducedDims:Formal class 'DFrame' [package "S4Vectors"] with 6 slots
.. .. .. .. .. ..@ rownames : NULL
.. .. .. .. .. ..@ nrows : int 0
.. .. .. .. .. ..@ listData : Named list()
.. .. .. .. .. ..@ elementType : chr "ANY"
.. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. ..@ metadata : list() <----------------------------------------- here
.. .. .. ..$ altExps :Formal class 'DFrame' [package "S4Vectors"] with 6 slots
.. .. .. .. .. ..@ rownames : NULL
.. .. .. .. .. ..@ nrows : int 0
.. .. .. .. .. ..@ listData : Named list()
.. .. .. .. .. ..@ elementType : chr "ANY"
.. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..$ colPairs :Formal class 'DFrame' [package "S4Vectors"] with 6 slots
.. .. .. .. .. ..@ rownames : NULL
.. .. .. .. .. ..@ nrows : int 0
.. .. .. .. .. ..@ listData : Named list()
.. .. .. .. .. ..@ elementType : chr "ANY"
.. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. ..@ metadata : list()
.. .. ..@ elementType : chr "ANY"
.. .. ..@ elementMetadata: NULL
.. .. ..@ metadata : list()
...
== I try to store information using
> library(SingleCellExperiment)
> sce<-SingleCellExperiment()
> str(reducedDims(sce))
Formal class 'SimpleList' [package "S4Vectors"] with 4 slots
..@ listData : Named list()
..@ elementType : chr "ANY"
..@ elementMetadata: NULL
..@ metadata : list()
> metadata(reducedDims(sce))[['e_a']] <- 'a'
> str(metadata(reducedDims(sce))[['e_a']])
NULL
> str(metadata(reducedDims(sce)))
list()
== I can sneak information in directly
> sce@int_colData@listData$reducedDims@metadata[['e_a']] <- 'a'
> metadata(reducedDims(sce))
$e_a
[1] "a"
== The following fails too
> sce <- SingleCellExperiment()
> reducedDims(sce)@metadata[['e_a']] <- 'a'
> str(reducedDims(sce))
Formal class 'SimpleList' [package "S4Vectors"] with 4 slots
..@ listData : Named list()
..@ elementType : chr "ANY"
..@ elementMetadata: NULL
..@ metadata : list()
> str(metadata(reducedDims(sce)))
list()
I wonder how I am erring.
I re-installed Bioconductor 3.12 as a precaution.
> BiocManager::version()
[1] ‘3.12’
The sessionInfo is
> sessionInfo()
R version 4.0.3 (2020-10-10)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux 10 (buster)
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.8.0
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.8.0
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] parallel stats4 stats graphics grDevices utils datasets methods base
other attached packages:
[1] SingleCellExperiment_1.12.0 SummarizedExperiment_1.20.0 Biobase_2.50.0 GenomicRanges_1.42.0 GenomeInfoDb_1.26.2 IRanges_2.24.1
[7] S4Vectors_0.28.1 BiocGenerics_0.36.0 MatrixGenerics_1.2.0 matrixStats_0.57.0
loaded via a namespace (and not attached):
[1] lattice_0.20-41 bitops_1.0-6 grid_4.0.3 zlibbioc_1.36.0 XVector_0.30.0 Matrix_1.3-2 tools_4.0.3
[8] RCurl_1.98-1.2 DelayedArray_0.16.1 compiler_4.0.3 GenomeInfoDbData_1.2.4
Thank you.
Before we get onto solutions: why do you want to do this? Why not just put things in the
metadata
of the SCE?Hi,
I want to store a dimensional reduction model, in this case, I want to store a uwot::umap model. It's possible that I will need to store additional model information in other metadata locations. So I am trying to organize the storage.
I wonder why I would not want to store information in the reducedDims metadata?
Thank you!