plot_cells: Plots the cells along with their trajectories.

plot_cellsR Documentation

Plots the cells along with their trajectories.

Description

Plots the cells along with their trajectories.

Usage

plot_cells(
  cds,
  x = 1,
  y = 2,
  reduction_method = c("UMAP", "tSNE", "PCA", "LSI", "Aligned"),
  color_cells_by = "cluster",
  group_cells_by = "cluster",
  genes = NULL,
  show_trajectory_graph = TRUE,
  trajectory_graph_color = "grey28",
  trajectory_graph_segment_size = 0.75,
  norm_method = c("log", "size_only"),
  label_cell_groups = TRUE,
  label_groups_by_cluster = TRUE,
  group_label_size = 2,
  labels_per_group = 1,
  label_branch_points = TRUE,
  label_roots = TRUE,
  label_leaves = TRUE,
  graph_label_size = 2,
  cell_size = 0.35,
  cell_stroke = I(cell_size/2),
  alpha = 1,
  min_expr = 0.1,
  rasterize = FALSE,
  scale_to_range = TRUE,
  label_principal_points = FALSE
)

Arguments

cds

cell_data_set for the experiment

x

the column of SingleCellExperiment::reducedDims(cds) to plot on the horizontal axis

y

the column of SingleCellExperiment::reducedDims(cds) to plot on the vertical axis

reduction_method

The lower dimensional space in which to plot cells. Must be one of "UMAP", "tSNE", "PCA" and "LSI".

color_cells_by

What to use for coloring the cells. Must be either the name of a column of colData(cds), or one of "clusters", "partitions", or "pseudotime".

group_cells_by

How to group cells when labeling them. Must be either the name of a column of colData(cds), or one of "clusters" or "partitions". If a column in colData(cds), must be a categorical variable.

genes

Facet the plot, showing the expression of each gene in a facet panel. Must be either a list of gene ids (or short names), or a dataframe with two columns that groups the genes into modules that will be aggregated prior to plotting. If the latter, the first column must be gene ids, and the second must the group for each gene.

show_trajectory_graph

Whether to render the principal graph for the trajectory. Requires that learn_graph() has been called on cds.

trajectory_graph_color

The color to be used for plotting the trajectory graph.

trajectory_graph_segment_size

The size of the line segments used for plotting the trajectory graph.

norm_method

How to normalize gene expression scores prior to plotting them. Must be one of "log" or "size_only".

label_cell_groups

Whether to label cells in each group (as specified by group_cells_by) according to the most frequently occurring label(s) (as specified by color_cells_by) in the group. If false, plot_cells() simply adds a traditional color legend.

label_groups_by_cluster

Instead of labeling each cluster of cells, place each label once, at the centroid of all cells carrying that label.

group_label_size

Font size to be used for cell group labels.

labels_per_group

How many labels to plot for each group of cells. Defaults to 1, which plots only the most frequent label per group.

label_branch_points

Whether to plot a label for each branch point in the principal graph.

label_roots

Whether to plot a label for each root in the principal graph.

label_leaves

Whether to plot a label for each leaf node in the principal graph.

graph_label_size

How large to make the branch, root, and leaf labels.

cell_size

The size of the point for each cell

cell_stroke

The stroke used for plotting each cell - default is 1/2 of the cell_size

alpha

Alpha for the cells. Useful for reducing overplotting.

min_expr

Minimum expression threshold for plotting genes

rasterize

Whether to plot cells as a rastered bitmap. Requires the ggrastr package.

scale_to_range

Logical indicating whether to scale expression to percent of maximum expression.

label_principal_points

Logical indicating whether to label roots, leaves, and branch points with principal point names. This is useful for order_cells and choose_graph_segments in non-interactive mode.

Value

a ggplot2 plot object

Examples

  ## Not run: 
    lung <- load_A549()
    plot_cells(lung)
    plot_cells(lung, color_cells_by="log_dose")
    plot_cells(lung, markers="GDF15")
  
## End(Not run)


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