add_cluster_graph: Constructs a trajectory using a cell grouping and a network...

View source: R/wrap_add_cluster_graph.R

add_cluster_graphR Documentation

Constructs a trajectory using a cell grouping and a network between groups. Will use an existing grouping if it is present in the dataset.

Description

A trajectory in this form will rarely be useful, given that cells are only placed at the milestones themselves, but not on the edges between milestones. A better alternative might be to project the cells using a dimensionality reduction, see add_dimred_projection().

Usage

add_cluster_graph(
  dataset,
  milestone_network,
  grouping = NULL,
  explicit_splits = FALSE,
  ...
)

Arguments

dataset

A dataset created by wrap_data() or wrap_expression()

milestone_network

A network of milestones.

grouping

A grouping of the cells, can be a named vector or a dataframe with group_id and cell_id

explicit_splits

Whether to make splits specific by adding a starting node. For example: A->B, A->C becomes A->X, X->B, X->C

...

extra information to be stored in the wrapper.

Value

A trajectory object

Examples

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
grouping <- sample(c("A", "B", "C", "D"), length(dataset$cell_ids), replace = TRUE)
grouping
trajectory <- add_cluster_graph(dataset, milestone_network, grouping)

# for plotting the result, install dynplot
#- dynplot::plot_graph(trajectory)

dynwrap documentation built on July 26, 2023, 5:15 p.m.