Contents

1 Overview

The alabaster.sce package implements methods to save SingleCellExperiment objects to file artifacts and load them back into R. Check out the alabaster.base for more details on the motivation and concepts of the alabaster framework.

2 Quick start

Given a (Ranged)SingleCellExperiment, we can use stageObject() to save it inside a staging directory:

library(SingleCellExperiment)
example(SingleCellExperiment, echo=FALSE) # can't be bothered to copy it here.
sce
## class: SingleCellExperiment 
## dim: 200 100 
## metadata(0):
## assays(2): counts logcounts
## rownames: NULL
## rowData names(0):
## colnames: NULL
## colData names(0):
## reducedDimNames(2): PCA tSNE
## mainExpName: NULL
## altExpNames(0):
library(alabaster.sce)
tmp <- tempfile()
saveObject(sce, tmp)

list.files(tmp, recursive=TRUE)
##  [1] "OBJECT"                        "assays/0/OBJECT"              
##  [3] "assays/0/array.h5"             "assays/1/OBJECT"              
##  [5] "assays/1/array.h5"             "assays/names.json"            
##  [7] "reduced_dimensions/0/OBJECT"   "reduced_dimensions/0/array.h5"
##  [9] "reduced_dimensions/1/OBJECT"   "reduced_dimensions/1/array.h5"
## [11] "reduced_dimensions/names.json"

We can then load it back into the session with loadObject().

roundtrip <- readObject(tmp)
class(roundtrip)
## [1] "SingleCellExperiment"
## attr(,"package")
## [1] "SingleCellExperiment"

Session information

sessionInfo()
## R Under development (unstable) (2023-11-11 r85510)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 22.04.3 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.19-bioc/R/lib/libRblas.so 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.10.0
## 
## locale:
##  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
##  [3] LC_TIME=en_GB              LC_COLLATE=C              
##  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
##  [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
##  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
## [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       
## 
## time zone: America/New_York
## tzcode source: system (glibc)
## 
## attached base packages:
## [1] stats4    stats     graphics  grDevices utils     datasets  methods  
## [8] base     
## 
## other attached packages:
##  [1] alabaster.sce_1.3.3         alabaster.base_1.3.14      
##  [3] SingleCellExperiment_1.25.0 SummarizedExperiment_1.33.1
##  [5] Biobase_2.63.0              GenomicRanges_1.55.1       
##  [7] GenomeInfoDb_1.39.5         IRanges_2.37.0             
##  [9] S4Vectors_0.41.3            BiocGenerics_0.49.1        
## [11] MatrixGenerics_1.15.0       matrixStats_1.2.0          
## [13] BiocStyle_2.31.0           
## 
## loaded via a namespace (and not attached):
##  [1] sass_0.4.8              SparseArray_1.3.2       bitops_1.0-7           
##  [4] lattice_0.22-5          alabaster.se_1.3.3      digest_0.6.33          
##  [7] evaluate_0.23           grid_4.4.0              bookdown_0.37          
## [10] fastmap_1.1.1           jsonlite_1.8.8          Matrix_1.6-4           
## [13] alabaster.schemas_1.3.1 BiocManager_1.30.22     HDF5Array_1.31.1       
## [16] jquerylib_0.1.4         abind_1.4-5             cli_3.6.2              
## [19] rlang_1.1.2             crayon_1.5.2            XVector_0.43.0         
## [22] cachem_1.0.8            DelayedArray_0.29.0     yaml_2.3.8             
## [25] S4Arrays_1.3.1          tools_4.4.0             Rhdf5lib_1.25.1        
## [28] GenomeInfoDbData_1.2.11 alabaster.ranges_1.3.2  alabaster.matrix_1.3.5 
## [31] R6_2.5.1                lifecycle_1.0.4         rhdf5_2.47.1           
## [34] zlibbioc_1.49.0         bslib_0.6.1             Rcpp_1.0.11            
## [37] xfun_0.41               knitr_1.45              rhdf5filters_1.15.1    
## [40] htmltools_0.5.7         rmarkdown_2.25          compiler_4.4.0         
## [43] RCurl_1.98-1.13