Contents

1 Overview

The alabaster.se package implements methods to save SummarizedExperiment 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)SummarizedExperiment, we can use saveObject() to save it inside a staging directory:

# Example taken from ?SummarizedExperiment
library(SummarizedExperiment)
nrows <- 200
ncols <- 6
counts <- matrix(rpois(nrows * ncols, 10), nrows, ncols)
rowRanges <- GRanges(
    rep(c("chr1", "chr2"), c(50, 150)),
    IRanges(floor(runif(200, 1e5, 1e6)), width=100),
    strand=sample(c("+", "-"), 200, TRUE)
)
colData <- DataFrame(
    Treatment=rep(c("ChIP", "Input"), 3), 
    row.names=LETTERS[1:6]
)
rse <- SummarizedExperiment(
    assays=SimpleList(counts=counts),
    rowRanges=rowRanges, 
    colData=colData
)
rownames(rse) <- sprintf("GENE_%03d", 1:200)
rse
## class: RangedSummarizedExperiment 
## dim: 200 6 
## metadata(0):
## assays(1): counts
## rownames(200): GENE_001 GENE_002 ... GENE_199 GENE_200
## rowData names(0):
## colnames(6): A B ... E F
## colData names(1): Treatment
library(alabaster.se)
tmp <- tempfile()
saveObject(rse, tmp)

list.files(tmp, recursive=TRUE)
##  [1] "OBJECT"                                 
##  [2] "assays/0/OBJECT"                        
##  [3] "assays/0/array.h5"                      
##  [4] "assays/names.json"                      
##  [5] "column_data/OBJECT"                     
##  [6] "column_data/basic_columns.h5"           
##  [7] "row_data/OBJECT"                        
##  [8] "row_data/basic_columns.h5"              
##  [9] "row_ranges/OBJECT"                      
## [10] "row_ranges/ranges.h5"                   
## [11] "row_ranges/sequence_information/OBJECT" 
## [12] "row_ranges/sequence_information/info.h5"

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

roundtrip <- readObject(tmp)
roundtrip
## class: RangedSummarizedExperiment 
## dim: 200 6 
## metadata(0):
## assays(1): counts
## rownames(200): GENE_001 GENE_002 ... GENE_199 GENE_200
## rowData names(0):
## colnames(6): A B ... E F
## colData names(1): Treatment

Session information

sessionInfo()
## R version 4.4.1 (2024-06-14)
## Platform: x86_64-pc-linux-gnu
## Running under: Ubuntu 24.04.1 LTS
## 
## Matrix products: default
## BLAS:   /home/biocbuild/bbs-3.20-bioc/R/lib/libRblas.so 
## LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.12.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.se_1.6.0          alabaster.base_1.6.0       
##  [3] SummarizedExperiment_1.36.0 Biobase_2.66.0             
##  [5] GenomicRanges_1.58.0        GenomeInfoDb_1.42.0        
##  [7] IRanges_2.40.0              S4Vectors_0.44.0           
##  [9] BiocGenerics_0.52.0         MatrixGenerics_1.18.0      
## [11] matrixStats_1.4.1           BiocStyle_2.34.0           
## 
## loaded via a namespace (and not attached):
##  [1] Matrix_1.7-1            jsonlite_1.8.9          compiler_4.4.1         
##  [4] BiocManager_1.30.25     crayon_1.5.3            Rcpp_1.0.13            
##  [7] rhdf5filters_1.18.0     alabaster.matrix_1.6.0  jquerylib_0.1.4        
## [10] yaml_2.3.10             fastmap_1.2.0           lattice_0.22-6         
## [13] R6_2.5.1                XVector_0.46.0          S4Arrays_1.6.0         
## [16] knitr_1.48              DelayedArray_0.32.0     bookdown_0.41          
## [19] GenomeInfoDbData_1.2.13 bslib_0.8.0             rlang_1.1.4            
## [22] HDF5Array_1.34.0        cachem_1.1.0            xfun_0.48              
## [25] alabaster.ranges_1.6.0  sass_0.4.9              SparseArray_1.6.0      
## [28] cli_3.6.3               Rhdf5lib_1.28.0         zlibbioc_1.52.0        
## [31] digest_0.6.37           grid_4.4.1              alabaster.schemas_1.6.0
## [34] rhdf5_2.50.0            lifecycle_1.0.4         evaluate_1.0.1         
## [37] abind_1.4-8             rmarkdown_2.28          httr_1.4.7             
## [40] tools_4.4.1             htmltools_0.5.8.1       UCSC.utils_1.2.0