add_cell_coloring: Add colouring to a set of cells.

Description Usage Arguments Value

Description

The cells can be coloured by a grouping (clustering), according to a feature (gene expression), closest milestone, or pseudotime from the root of the trajectory.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
add_cell_coloring(
  cell_positions,
  color_cells = c("auto", "none", "grouping", "feature", "milestone", "pseudotime"),
  trajectory,
  grouping = NULL,
  groups = NULL,
  feature_oi = NULL,
  expression_source = "expression",
  pseudotime = NULL,
  color_milestones = c("auto", "given", "cubeHelix", "Set3", "rainbow"),
  milestones = NULL,
  milestone_percentages = NULL
)

Arguments

cell_positions

The positions of the cells, represented by a tibble. Must contain column cell_id (character) and may contain columns from, to, pseudotime, depending on the value of color_cells.

color_cells

How to color the cells.

  • "auto": Try to figure out how to color cells depending on whether one of the grouping, feature_io, milestones or pseudotime parameters are defined.

  • "none": Cells are not coloured.

  • "grouping": Cells are coloured according to a grouping (e.g. clustering). Either the grouping parameter or trajectory$grouping must be a named character vector.

  • "feature": Cells are coloured according to the values of a given feature (e.g. gene expression). Either the expression_source parameter or get_expression(trajectory) must be a matrix. Parameter feature_oi must also be defined.

  • "milestone" (recommended): Cells are coloured according their position in the trajectory. The positioning of the cells are determined by parameter milestone_percentages or else by trajectory$milestone_percentages. The colours of the milestones can be determined automatically or can be specified by passing a tibble containing character columns milestone_id and color (See add_milestone_coloring() for help in constructing this object).

  • "pseudotime": Cells are coloured according to the pseudotime value from the root.

trajectory

A dynwrap trajectory.

grouping

A grouping of the cells (e.g. clustering) as a named character vector.

groups

A tibble containing character columns group_id and color. If NULL, this object is inferred from the grouping itself.

feature_oi

The name of a feature to use for colouring the cells.

expression_source

Source of the feature expression, defaults to get_expression(trajectory).

pseudotime

The pseudotime from the root of the trajectory to the cells as a named numeric vector.

color_milestones

Which palette to use for colouring the milestones

  • auto: Determine colours automatically. If color is already specified in milestones tibble, this will be used. Otherwise, the colour scheme is determined by milestone_palette_list$auto.

  • given: The milestones object already contains a column color.

  • cubeHelix: Use the rje::cubeHelix() palette.

  • Set3: Use the RColorBrewer::brewer.pal(name = "Set3") palette.

  • rainbow: Use the grDevices::rainbow() palette.

milestones

Tibble containing the column milestone_id (character). If color_milestones is set to "given", this tibble should also contain a column color (character), containing colour hex codes (e.g. "#123456").

milestone_percentages

The milestone percentages.

Value

A named list with following objects:


dynplot documentation built on Dec. 11, 2021, 9:33 a.m.