defineMSTPaths {TrajectoryUtils} | R Documentation |
Define paths through the MST, either from pre-specified root nodes or based on external timing information.
defineMSTPaths(g, roots, times = NULL, clusters = NULL, use.median = FALSE)
g |
A graph object containing a minimum spanning tree, e.g., from |
roots |
A character vector specifying the root node for each component in |
times |
A numeric vector of length equal to the number of nodes in |
clusters |
A vector or factor specifying the assigned cluster for each cell,
where each cluster corresponds to a node in Alternatively, a matrix with number of rows equal to This only has an effect if |
use.median |
Logical scalar indicating whether the time for each cluster is defined as the median time across its cells.
The mean is used by default.
This only has an effect if |
When roots
is specified, a path is defined from the root to each endpoint node (i.e., with degree 1) in g
.
We expect one root node to be specified for each component in g
.
When times
is specified, a path is defined from each local minima in time to the nearest local maxima within each component of g
.
Timing information can be defined from experimental metadata or with computational methods like RNA velocity.
A list of character vectors.
Each vector contains the names of nodes in g
and defines a path through the MST from a root to an endpoint node.
Aaron Lun
guessMSTRoots
, to obtain roots
without any prior information.
splitByBranches
, for a root-free way of obtaining paths.
library(igraph) test.g <- make_graph(c("A", "B", "B", "C", "B", "D"), directed=FALSE) defineMSTPaths(test.g, roots="A") defineMSTPaths(test.g, roots="B") defineMSTPaths(test.g, times=c(A=0, B=1, C=2, D=3)) defineMSTPaths(test.g, times=c(A=0, B=-1, C=2, D=3)) defineMSTPaths(test.g, times=c(A=0, B=5, C=2, D=3))