plot_cells_m3addon: Plots the cells along with their trajectories.

Description Usage Arguments Value References Examples

View source: R/plotting.R

Description

Plots the cells along with their trajectories.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
plot_cells_m3addon(
  cds,
  x = 1,
  y = 2,
  reduction_method = c("UMAP", "tSNE", "PCA", "LSI", "spRing", "trimap"),
  color_cells_by = "cluster",
  cluster_reduction_method = c("UMAP", "tSNE", "PCA", "LSI", "spRing", "trimap"),
  group_cells_by = c("cluster", "partition"),
  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,
  alpha = 1,
  min_expr = 0.1,
  rasterize = FALSE,
  legend_title_is_marker = TRUE
)

Arguments

cds

cell_data_set for the experiment

x

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

y

the column of 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", "spRing", "trimap", 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".

cluster_reduction_method

The dimensional space from which to plot clusters. Must be one of "UMAP", "tSNE", "PCA", "LSI".

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

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.

Value

a ggplot2 plot object

References

this function differs from that found in monocle3 as it allows for use of spRing \ dimensionality reduction.

Examples

1
2
3
4
5
6
7
## Not run: 
lung <- load_A549()
plot_cells(lung)
plot_cells(lung, color_cells_by="log_dose")
plot_cells(lung, markers="GDF15")

## End(Not run)

scfurl/m3addon documentation built on Aug. 9, 2021, 5:30 p.m.