View source: R/wrap_add_dimred_projection.R
add_dimred_projection | R Documentation |
A dimensionality reduction of cells and milestones is used, along with the milestone network, to project cells onto the nearest edge. Optionally, a cell grouping can be given which will restrict the edges on which a cell can be projected.
add_dimred_projection(
dataset,
milestone_ids = NULL,
milestone_network,
dimred,
dimred_milestones,
grouping = NULL,
...
)
dataset |
A dataset created by |
milestone_ids |
The ids of the milestones in the trajectory. Type: Character vector. |
milestone_network |
The network of the milestones. Type: Data frame(from = character, to = character, length = numeric, directed = logical). |
dimred |
Can be
|
dimred_milestones |
An optional dimensionality reduction of the milestones. A matrix with milestones in rows and components (comp_1, comp_2, ...) in columns This will be automatically calculated if |
grouping |
A grouping of the cells, can be a named vector or a dataframe with group_id and cell_id |
... |
extra information to be stored in the wrapper. |
A trajectory object
library(tibble)
dataset <- wrap_data(cell_ids = letters)
milestone_network <- tibble::tibble(
from = c("A", "B", "B"),
to = c("B", "C", "D"),
directed = TRUE,
length = 1
)
milestone_network
dimred <- matrix(
runif(length(dataset$cell_ids) * 2),
ncol = 2,
dimnames = list(dataset$cell_ids, c("comp_1", "comp_2"))
)
dimred
dimred_milestones <- matrix(
runif(2*4),
ncol = 2,
dimnames = list(c("A", "B", "C", "D"), c("comp_1", "comp_2"))
)
dimred_milestones
trajectory <- add_dimred_projection(
dataset,
milestone_network = milestone_network,
dimred = dimred,
dimred_milestones = dimred_milestones
)
# 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.