Package 'alabaster.treese'

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

Help Index


Read a TreeSummarizedExperiment from disk

Description

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.

Usage

readTreeSummarizedExperiment(path, metadata, ...)

Arguments

path

String containing a path to a directory, itself created using the saveObject method for TreeSummarizedExperiment objects.

metadata

Named list of metadata for this object, see readObjectFile for details.

...

Further arguments passed to readSingleCellExperiment and internal altReadObject calls.

Value

A TreeSummarizedExperiment object.

See Also

"saveObject,TreeSummarizedExperiment-method", to save the TreeSummarizedExperiment to disk.

Examples

# 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 disk

Description

Save a TreeSummarizedExperiment to its on-disk representation.

Usage

## S4 method for signature 'TreeSummarizedExperiment'
saveObject(x, path, ...)

Arguments

x

A TreeSummarizedExperiment object or one of its subclasses.

path

String containing the path to a directory in which to save x.

...

Further arguments to pass to "saveObject,SingleCellExperiment-method".

Details

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.

  • rowLinks and colLinks are saved as data frames.

  • referenceSeq is saved as FASTA via alabaster.string. A DNAStringSetList is saved as a list of such sequence sets.

Value

x is saved into path and NULL is invisibly returned.

See Also

readTreeSummarizedExperiment, to read the TreeSummarizedExperiment back into the R session.

Examples

# 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)