| Title: | Load and Save TreeSummarizedExperiment from File |
|---|---|
| Description: | Save TreeSummarizedExperiment into file artifacts, and load them back into memory. This is a more portable alternative to serialization of such objects into RDS files. Each artifact is associated with metadata for further interpretation; downstream applications can enrich this metadata with context-specific properties. |
| Authors: | Tuomas Borman [aut, cre] (ORCID: <https://orcid.org/0000-0002-8563-8884>), Leo Lahti [aut] (ORCID: <https://orcid.org/0000-0001-5537-637X>) |
| Maintainer: | Tuomas Borman <[email protected]> |
| License: | Artistic-2.0 |
| Version: | 0.99.0 |
| Built: | 2026-10-29 17:15:34 UTC |
| Source: | https://github.com/BiocStaging/alabaster.treese |
Read a TreeSummarizedExperiment object from
its on-disk representation. This is usually not directly called by users,
but is instead called by dispatch in
readObject.
readTreeSummarizedExperiment(path, metadata, ...)readTreeSummarizedExperiment(path, metadata, ...)
path |
String containing a path to a directory, itself created using
the |
metadata |
Named list of metadata for this object, see
|
... |
Further arguments passed to
|
A TreeSummarizedExperiment object.
"saveObject,TreeSummarizedExperiment-method", to save the
TreeSummarizedExperiment to disk.
# Mocking up a TreeSE: data(tinyTree, package = "TreeSummarizedExperiment") 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))) # Staging it: tmp <- tempfile() saveObject(tse, tmp) readObject(tmp)# Mocking up a TreeSE: data(tinyTree, package = "TreeSummarizedExperiment") 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))) # Staging it: tmp <- tempfile() saveObject(tse, tmp) readObject(tmp)
Save a TreeSummarizedExperiment to its on-disk representation.
## S4 method for signature 'TreeSummarizedExperiment' saveObject(x, path, ...)## S4 method for signature 'TreeSummarizedExperiment' saveObject(x, path, ...)
x |
A TreeSummarizedExperiment object or one of its subclasses. |
path |
String containing the path to a directory in which to save
|
... |
Further arguments to pass to
|
Everything inherited from the SingleCellExperiment parent class is saved by alabaster.sce. The TreeSummarizedExperiment-specific slots are saved as follows:
Each tree in rowTree or
colTree is saved as a list
containing the fields of the phylo object, where the edge
matrix is split into parent and child vectors. This preserves
the node numbering and arbitrary tip/node labels, which would not survive a
round trip through Newick.
referenceSeq is saved as FASTA
via alabaster.string. A DNAStringSetList is saved as a list of such
sequence sets.
x is saved into path and NULL is invisibly
returned.
readTreeSummarizedExperiment, to read the
TreeSummarizedExperiment back into the R session.
# Mocking up a TreeSE: data(tinyTree, package = "TreeSummarizedExperiment") 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))) # Staging it: tmp <- tempfile() saveObject(tse, tmp) list.files(tmp, recursive = TRUE)# Mocking up a TreeSE: data(tinyTree, package = "TreeSummarizedExperiment") 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))) # Staging it: tmp <- tempfile() saveObject(tse, tmp) list.files(tmp, recursive = TRUE)