--- title: Saving `SummarizedExperiment`s to artifacts and back again author: - name: Aaron Lun email: infinite.monkeys.with.keyboards@gmail.com package: alabaster.se date: "Revised: September 22, 2022" output: BiocStyle::html_document vignette: > %\VignetteIndexEntry{Saving and loading SummarizedExperiments} %\VignetteEngine{knitr::rmarkdown} %\VignetteEncoding{UTF-8} --- ```{r, echo=FALSE} library(BiocStyle) self <- Githubpkg("ArtifactDB/alabaster.se") knitr::opts_chunk$set(error=FALSE, warning=FALSE, message=FALSE) ``` # Overview The `r self` package implements methods to save `SummarizedExperiment` objects to file artifacts and load them back into R. Check out the `r Githubpkg("ArtifactDB/alabaster.base")` for more details on the motivation and concepts of the **alabaster** framework. # Quick start Given a `(Ranged)SummarizedExperiment`, we can use `stageObject()` to save it inside a staging directory: ```{r} library(SummarizedExperiment) example(SummarizedExperiment, echo=FALSE) # can't be bothered to copy it here. rse library(alabaster.se) tmp <- tempfile() dir.create(tmp) meta <- stageObject(rse, tmp, "se") .writeMetadata(meta, tmp) list.files(tmp, recursive=TRUE) ``` We can then load it back into the session with `loadObject()`. ```{r} meta <- acquireMetadata(tmp, "se/experiment.json") roundtrip <- loadObject(meta, tmp) class(roundtrip) ``` More details on the metadata and on-disk layout are provided in the [schema](https://artifactdb.github.io/BiocObjectSchemas/html/summarized_experiment/v1.html). # Session information {-} ```{r} sessionInfo() ```