## ----setup--------------------------------------------------------------------
#| echo: false
library(BiocStyle)
self <- Biocpkg("alabaster.treese")


## -----------------------------------------------------------------------------
#| label: save
# Mock up a TreeSE with a row tree and reference sequences.
library(TreeSummarizedExperiment)
data(tinyTree)
mat <- matrix(rpois(100, 10), ncol = 10)
rownames(mat) <- tinyTree[["tip.label"]]
colnames(mat) <- letters[1:10]

tse <- TreeSummarizedExperiment(list(counts = mat), rowTree = tinyTree)
tse[["stuff"]] <- LETTERS[1:10]
referenceSeq(tse) <- Biostrings::DNAStringSet(rep("ACGT", nrow(tse)))
tse

# Save it into a staging directory.
library(alabaster.treese)
tmp <- tempfile()
saveObject(tse, tmp)

list.files(tmp, recursive = TRUE)


## -----------------------------------------------------------------------------
#| label: read
# Load the TreeSE back from disk.
roundtrip <- readObject(tmp)
class(roundtrip)


## -----------------------------------------------------------------------------
#| label: session-info
sessionInfo()

