View source: R/wrap_add_root.R
add_root | R Documentation |
Designates a milestone as root, and changes the direction of any edges so that they move away from the specified root (if flip_edges=TRUE
, default).
add_root(
trajectory,
root_cell_id = trajectory$root_cell_id,
root_milestone_id = trajectory$root_milestone_id,
flip_edges = TRUE
)
add_root_using_expression(
trajectory,
features_oi,
expression_source = "expression"
)
is_rooted(trajectory)
remove_root(trajectory)
trajectory |
The trajectory as created by |
root_cell_id |
The root cell id, not required if root_milestone_id is given |
root_milestone_id |
The root milestone id, not required if root_cell_id is given |
flip_edges |
Whether to flip edges which are going in the other direction compared to the root |
features_oi |
The feature ids which will be used to root |
expression_source |
Source of the expression, either a string or a matrix |
A root_cell_id
can also be specified, and the root milestone will be determined as the milestone with the closest geodesic distance to this cell.
A trajectory, with a root_milestone_id and with adapted milestone_network and progressions based on the rooting.
# add a root using a root cell
trajectory <- example_trajectory
trajectory <- add_root(
trajectory,
root_cell_id = sample(trajectory$cell_ids, 1)
)
trajectory$root_milestone_id
# add a root using a root milestone id
trajectory <- add_root(
trajectory,
root_milestone_id = "milestone_end"
)
trajectory$root_milestone_id
trajectory$milestone_network
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.