Assigns rows of a new sample-by-feature matrix into the realized lineage sets
of a fitted "linf.csts" hierarchy. The hierarchy is not refit: each
sample is walked through the frozen tree by choosing, at each depth, the
realized child lineage whose newly added feature has the largest abundance in
that sample.
Usage
transfer.dcsts(
X,
csts,
depth = NULL,
view = c("absorb", "active", "pure"),
match.by = c("feature.ids", "feature.labels"),
feature.ids = NULL,
feature.labels = NULL,
tie.method = c("support", "first", "random", "error"),
carry.forward.terminal.depths = TRUE,
sep = NULL,
backend = c("auto", "dense", "sparse")
)Arguments
- X
Nonnegative sample-by-feature matrix to transfer. Columns may be in any order and may include features not present in
csts; missing retained features are treated as zero.- csts
A fitted
"linf.csts"object produced bylinf.cstsand optionally refined by repeated calls torefine.linf.csts.- depth
Integer vector of requested depths. Defaults to all fitted depths in
csts.- view
Which fitted hierarchy view to transfer into.
"absorb"useslineage.labels.absorb;"pure"useslineage.labels.pure;"active"useslineage.labels.- match.by
Whether columns in
Xare aligned tocsts$feature.idsorcsts$feature.labels.- feature.ids
Optional feature identifiers for columns of
X. Defaults tocolnames(X).- feature.labels
Optional feature labels for columns of
X. Defaults tofeature.ids.- tie.method
How to resolve ties among frozen child lineages with equal sample abundance.
"support"chooses the tied lineage with largest reference support and then lexical order;"first"uses frozen child order;"random"samples one tied lineage;"error"stops.- carry.forward.terminal.depths
Logical, retained for call compatibility. Under either setting, terminal lineages are assigned only where they occur in the fitted hierarchy. No out-of-hierarchy fallback is performed.
- sep
Separator used in lineage labels. Defaults to
csts$sepor"__".- backend
Matrix backend; passed to the internal matrix preparer.
Value
A list of class "linf.dcst.transfer" with components:
assignment: character matrix of transferred labels for the requested depths.all.depths: character matrix for all fitted depths.depth: requested depth vector.view,match.by,tie.method: settings used.
At any depth with no realized candidate or no positive abundance for its
candidate features, that depth and all subsequent depths are NA.
Returned lineages use display labels regardless of match.by.