Contents

1 Overview

The alabaster.mae package implements methods to save MultiAssayExperiment 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

Let’s create a mildly complicated MAE containing RNA-seq and ChIP-seq data with partial overlaps:

library(SummarizedExperiment)
rna.counts <- matrix(rpois(60, 10), ncol=6)
colnames(rna.counts) <- c("disease1", "disease2", "disease3", "control1", "control2", "control3")
rownames(rna.counts) <- c("ENSMUSG00000000001", "ENSMUSG00000000003", "ENSMUSG00000000028", 
    "ENSMUSG00000000031", "ENSMUSG00000000037", "ENSMUSG00000000049",  "ENSMUSG00000000056", 
    "ENSMUSG00000000058", "ENSMUSG00000000078",  "ENSMUSG00000000085")
rna.se <- SummarizedExperiment(list(counts=rna.counts))
colData(rna.se)$disease <- rep(c("disease", "control"), each=3)

chip.counts <- matrix(rpois(100, 10), ncol=4)
colnames(chip.counts) <- c("disease1", "disease2", "control1", "control3")
chip.peaks <- GRanges("chr1", IRanges(1:25*100+1, 1:25*100+100))
chip.se <- SummarizedExperiment(list(counts=chip.counts), rowRanges=chip.peaks)

library(MultiAssayExperiment)
mapping <- DataFrame(
    assay = rep(c("rnaseq", "chipseq"), c(ncol(rna.se), ncol(chip.se))), # experiment name
    primary = c(colnames(rna.se), colnames(chip.se)), # sample identifiers
    colname = c(colnames(rna.se), colnames(chip.se)) # column names inside each experiment
)
mae <- MultiAssayExperiment(list(rnaseq=rna.se, chipseq=chip.se), sampleMap=mapping)

We can use saveObject() to save it inside a staging directory:

library(alabaster.mae)
tmp <- tempfile()
meta <- saveObject(mae, tmp)
list.files(tmp, recursive=TRUE)
##  [1] "OBJECT"                                               
##  [2] "experiments/0/OBJECT"                                 
##  [3] "experiments/0/assays/0/OBJECT"                        
##  [4] "experiments/0/assays/0/array.h5"                      
##  [5] "experiments/0/assays/names.json"                      
##  [6] "experiments/0/column_data/OBJECT"                     
##  [7] "experiments/0/column_data/basic_columns.h5"           
##  [8] "experiments/0/row_data/OBJECT"                        
##  [9] "experiments/0/row_data/basic_columns.h5"              
## [10] "experiments/1/OBJECT"                                 
## [11] "experiments/1/assays/0/OBJECT"                        
## [12] "experiments/1/assays/0/array.h5"                      
## [13] "experiments/1/assays/names.json"                      
## [14] "experiments/1/column_data/OBJECT"                     
## [15] "experiments/1/column_data/basic_columns.h5"           
## [16] "experiments/1/row_ranges/OBJECT"                      
## [17] "experiments/1/row_ranges/ranges.h5"                   
## [18] "experiments/1/row_ranges/sequence_information/OBJECT" 
## [19] "experiments/1/row_ranges/sequence_information/info.h5"
## [20] "experiments/names.json"                               
## [21] "sample_data/OBJECT"                                   
## [22] "sample_data/basic_columns.h5"                         
## [23] "sample_map.h5"

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

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

Session information

sessionInfo()
## R Under development (unstable) (2024-01-16 r85808)
## 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.mae_1.3.2         alabaster.base_1.3.19      
##  [3] MultiAssayExperiment_1.29.0 SummarizedExperiment_1.33.3
##  [5] Biobase_2.63.0              GenomicRanges_1.55.2       
##  [7] GenomeInfoDb_1.39.5         IRanges_2.37.1             
##  [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.3       bitops_1.0-7           
##  [4] lattice_0.22-5          alabaster.se_1.3.3      digest_0.6.34          
##  [7] evaluate_0.23           grid_4.4.0              bookdown_0.37          
## [10] fastmap_1.1.1           jsonlite_1.8.8          Matrix_1.6-5           
## [13] alabaster.schemas_1.3.1 BiocManager_1.30.22     HDF5Array_1.31.2       
## [16] jquerylib_0.1.4         abind_1.4-5             cli_3.6.2              
## [19] rlang_1.1.3             crayon_1.5.2            XVector_0.43.1         
## [22] cachem_1.0.8            DelayedArray_0.29.0     yaml_2.3.8             
## [25] S4Arrays_1.3.2          tools_4.4.0             Rhdf5lib_1.25.1        
## [28] GenomeInfoDbData_1.2.11 alabaster.ranges_1.3.3  alabaster.matrix_1.3.7 
## [31] R6_2.5.1                lifecycle_1.0.4         rhdf5_2.47.2           
## [34] zlibbioc_1.49.0         bslib_0.6.1             Rcpp_1.0.12            
## [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.14