View source: R/wrap_add_branch_trajectory.R
add_branch_trajectory | R Documentation |
The branch network is converted to a milestone network by giving each branch a start and end milestone. If two branches are connected in the branch network, the end milestone of branch 1 and start milestone of branch 2 will be merged.
add_branch_trajectory(
dataset,
branch_network,
branches,
branch_progressions,
...
)
dataset |
A dataset created by |
branch_network |
The network between branches, a dataframe with a from and to branch identifier |
branches |
The length and directedness of the branches, a dataframe with the branch identifier (branch_id), the length of the branch (length) and whether it is directed |
branch_progressions |
Specifies the progression of a cell along a transition in the branch network. A dataframe containing the cell_id, branch_id and its progression along the edge (percentage, between 0 and 1) |
... |
extra information to be stored in the trajectory |
The resulting trajectory will always be directed.
A trajectory object
dataset <- wrap_data(cell_ids = letters)
branch_network <- tibble::tibble(from = c("A", "A"), to = c("B", "C"))
branch_network
branches <- tibble::tibble(branch_id = c("A", "B", "C"), length = 1, directed = TRUE)
branches
branch_progressions <- tibble::tibble(
cell_id = dataset$cell_ids,
branch_id = sample(branches$branch_id, length(dataset$cell_ids), replace = TRUE),
percentage = runif(length(dataset$cell_ids))
)
branch_progressions
trajectory <- add_branch_trajectory(
dataset,
branch_network,
branches,
branch_progressions
)
# 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.