View source: R/wrap_add_cell_graph.R
add_cell_graph | R Documentation |
The cells that are part of the backbone will form the trajectory. All other cells are moved towards the nearest cell that is part of the backbone.
add_cell_graph(
dataset,
cell_graph,
to_keep,
milestone_prefix = "milestone_",
...
)
dataset |
A dataset created by |
cell_graph |
The edges between cells, a dataframe containing the from and to cells, the *length, and whether this edge is directed |
to_keep |
Whether a cells is part of the backbone. May be a character vector with the identifiers of the backbone cells, or a named boolean vector whether a cell is from the backbone |
milestone_prefix |
A prefix to add to the id of the cell ids when they are used as milestones, in order to avoid any naming conflicts, |
... |
extra information to be stored in the wrapper. |
A trajectory object
library(dplyr)
dataset <- wrap_data(cell_ids = letters)
backbone_cell_graph <- tibble::tibble(
from = letters[1:10],
to = letters[2:11],
length = 1,
directed = TRUE
)
leaves_cell_graph <- tibble::tibble(
from = letters[12:26],
to = sample(letters[1:11], 15, replace = TRUE),
length = 1,
directed = TRUE
)
cell_graph <- bind_rows(backbone_cell_graph, leaves_cell_graph)
cell_graph
to_keep <- letters[1:11]
to_keep
trajectory <- add_cell_graph(dataset, cell_graph, to_keep)
# for plotting the result, install dynplot
#- dynplot::plot_graph(trajectory)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.