This function generates a scatter plot to visualize the inferred trajectory. It was modified from the package ArchR plotTrajectory to use a Seurat object as input. For more details, check here https://www.archrproject.com/reference/plotTrajectory.html.

TrajectoryPlot(
  object = NULL,
  trajectory = "Trajectory",
  reduction = NULL,
  size = 0.2,
  rastr = FALSE,
  quantCut = c(0.01, 0.99),
  continuousSet = NULL,
  discreteSet = NULL,
  randomize = TRUE,
  keepAxis = FALSE,
  baseSize = 6,
  addArrow = FALSE,
  smoothWindow = 5
)

Arguments

object

Seurat object

trajectory

Name of one metadata column to group the cells, usually this refers to the clustering results

reduction

Which dimension reduction is used to visualize the trajectory

size

A number indicating the size of the points to plot

rastr

Whether the plot should be rasterized

quantCut

If this is not NULL, a quantile cut is performed to threshold the top and bottom of the distribution of numerical values. This prevents skewed color scales caused by strong outliers. The format of this should be c(x,y) where x is the lower threshold and y is the upper threshold. For example, quantileCut = c(0.025,0.975) will take the 2.5th percentile and 97.5 percentile of values and set values below/above to the value of the 2.5th and 97.5th percentile values respectively.

continuousSet

The name of a continuous palette from ArchRPalettes for visualizing colorBy in the embedding if a continuous color set is desired.

discreteSet

The name of a discrete palette from ArchRPalettes for visualizing colorBy in the embedding if a discrete color set is desired.

randomize

A boolean value that indicates whether to randomize points prior to plotting to prevent cells from one cluster being present at the front of the plot.

keepAxis

A boolean value that indicates whether the x and y axis ticks and labels should be plotted.

baseSize

The base font size to use in the plot.

addArrow

A boolean value that indicates whether to add a smoothed arrow in the embedding based on the aligned trajectory.

smoothWindow

An integer value indicating the smoothing window for creating inferred Arrow overlay on to embedding.

Value

A ggplot object

Examples

if (FALSE) {
p <- TrajectoryPlot(
   object = obj,
   reduction = "dm",
   continuousSet = "blueYellow",
   size = 1
)
}