order_cells: Orders cells according to pseudotime.

View source: R/order_cells.R

order_cellsR Documentation

Orders cells according to pseudotime.

Description

Assigns cells a pseudotime value based on their projection on the principal graph learned in the learn_graph function and the position of chosen root states. This function takes as input a cell_data_set and returns it with pseudotime information stored internally. order_cells() optionally takes "root" state(s) in the form of cell or principal graph node IDs, which you can use to specify the start of the trajectory. If you don't provide a root state, an plot will be generated where you can choose the root state(s) interactively. The trajectory will be composed of segments.

Usage

order_cells(
  cds,
  reduction_method = "UMAP",
  root_pr_nodes = NULL,
  root_cells = NULL,
  verbose = FALSE
)

Arguments

cds

the cell_data_set upon which to perform this operation

reduction_method

a string specifying the reduced dimension method to use when ordering cells. Currently only "UMAP" is supported.

root_pr_nodes

NULL or a vector of starting principal points. If provided, pseudotime will start (i.e. be zero) at these graph nodes. You can find the principal point names by running plot_cells with label_principal_points = TRUE. Both root_pr_nodes and root_cells cannot be provided.

root_cells

NULL or a vector of starting cells. If provided, pseudotime will start (i.e. be zero) at these cells. Both root_pr_nodes and root_cells cannot be provided.

verbose

Whether to show running information for order_cells

Value

an updated cell_data_set object.

Examples

  
    cell_metadata <- readRDS(system.file('extdata',
                                         'worm_embryo/worm_embryo_coldata.rds',
                                         package='monocle3'))
    gene_metadata <- readRDS(system.file('extdata',
                                         'worm_embryo/worm_embryo_rowdata.rds',
                                         package='monocle3'))
    expression_matrix <- readRDS(system.file('extdata',
                                             'worm_embryo/worm_embryo_expression_matrix.rds',
                                             package='monocle3'))

    cds <- new_cell_data_set(expression_data=expression_matrix,
                             cell_metadata=cell_metadata,
                             gene_metadata=gene_metadata)

    cds <- preprocess_cds(cds)
    cds <- align_cds(cds, alignment_group =
                     "batch", residual_model_formula_str = "~ bg.300.loading +
                      bg.400.loading + bg.500.1.loading + bg.500.2.loading +
                      bg.r17.loading + bg.b01.loading + bg.b02.loading")
    cds <- reduce_dimension(cds)
    cds <- cluster_cells(cds)
    cds <- learn_graph(cds)
    cds <- order_cells(cds, root_pr_nodes='Y_21')
  


cole-trapnell-lab/monocle3 documentation built on April 7, 2024, 9:24 p.m.