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()
dir.create(tmp)
meta <- stageObject(sce, tmp, "sce")
.writeMetadata(meta, tmp)
## $type
## [1] "local"
## 
## $path
## [1] "sce/experiment.json"
list.files(tmp, recursive=TRUE)
## [1] "sce/assay-1/array.h5"       "sce/assay-1/array.h5.json" 
## [3] "sce/assay-2/array.h5"       "sce/assay-2/array.h5.json" 
## [5] "sce/experiment.json"        "sce/reddim-1/array.h5"     
## [7] "sce/reddim-1/array.h5.json" "sce/reddim-2/array.h5"     
## [9] "sce/reddim-2/array.h5.json"

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

meta <- acquireMetadata(tmp, "sce/experiment.json")
roundtrip <- loadObject(meta, tmp)
class(roundtrip)
## [1] "SingleCellExperiment"
## attr(,"package")
## [1] "SingleCellExperiment"

More details on the metadata and on-disk layout are provided in the schema.

Session information

sessionInfo()
## R version 4.3.0 RC (2023-04-13 r84269)
## Platform: x86_64-pc-linux-gnu (64-bit)
## Running under: Ubuntu 22.04.2 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.17-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.0.0         alabaster.base_1.0.0       
##  [3] SingleCellExperiment_1.22.0 SummarizedExperiment_1.30.0
##  [5] Biobase_2.60.0              GenomicRanges_1.52.0       
##  [7] GenomeInfoDb_1.36.0         IRanges_2.34.0             
##  [9] S4Vectors_0.38.0            BiocGenerics_0.46.0        
## [11] MatrixGenerics_1.12.0       matrixStats_0.63.0         
## [13] BiocStyle_2.28.0           
## 
## loaded via a namespace (and not attached):
##  [1] sass_0.4.5              bitops_1.0-7            lattice_0.21-8         
##  [4] alabaster.se_1.0.0      jsonvalidate_1.3.2      digest_0.6.31          
##  [7] evaluate_0.20           grid_4.3.0              bookdown_0.33          
## [10] fastmap_1.1.1           jsonlite_1.8.4          Matrix_1.5-4           
## [13] alabaster.schemas_1.0.0 BiocManager_1.30.20     HDF5Array_1.28.0       
## [16] jquerylib_0.1.4         cli_3.6.1               rlang_1.1.0            
## [19] XVector_0.40.0          cachem_1.0.7            DelayedArray_0.26.0    
## [22] yaml_2.3.7              tools_4.3.0             Rhdf5lib_1.22.0        
## [25] GenomeInfoDbData_1.2.10 alabaster.ranges_1.0.0  alabaster.matrix_1.0.0 
## [28] curl_5.0.0              R6_2.5.1                rhdf5_2.44.0           
## [31] zlibbioc_1.46.0         V8_4.3.0                bslib_0.4.2            
## [34] Rcpp_1.0.10             xfun_0.39               knitr_1.42             
## [37] rhdf5filters_1.12.0     htmltools_0.5.5         rmarkdown_2.21         
## [40] compiler_4.3.0          RCurl_1.98-1.12