Save a TreeSummarizedExperiment to disk
Source:R/saveTreeSummarizedExperiment.R
saveTreeSummarizedExperiment.RdSave a TreeSummarizedExperiment to its on-disk representation.
Usage
# S4 method for class '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
rowTreeorcolTreeis saved as a list containing the fields of thephyloobject, where theedgematrix is split intoparentandchildvectors. This preserves the node numbering and arbitrary tip/node labels, which would not survive a round trip through Newick.referenceSeqis saved as FASTA via alabaster.string. A DNAStringSetList is saved as a list of such sequence sets.
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)
#> [1] "OBJECT"
#> [2] "_environment.json"
#> [3] "assays/0/OBJECT"
#> [4] "assays/0/array.h5"
#> [5] "assays/names.json"
#> [6] "column_data/OBJECT"
#> [7] "column_data/basic_columns.h5"
#> [8] "reference_sequences/OBJECT"
#> [9] "reference_sequences/names.txt.gz"
#> [10] "reference_sequences/sequences.fasta.gz"
#> [11] "row_data/OBJECT"
#> [12] "row_data/basic_columns.h5"
#> [13] "row_links/OBJECT"
#> [14] "row_links/basic_columns.h5"
#> [15] "row_trees/0/OBJECT"
#> [16] "row_trees/0/list_contents.h5"
#> [17] "row_trees/names.json"