Skip to contents

Plot CytoTRACE 2 Results

Usage

CytoTRACEPlot(
  srt,
  reduction = NULL,
  group.by = NULL,
  combine = TRUE,
  nrow = NULL,
  ncol = NULL,
  byrow = TRUE,
  pt.size = NULL,
  pt.alpha = 1,
  palette = "Chinese",
  palcolor = NULL,
  theme_use = "theme_scop",
  theme_args = list(),
  verbose = TRUE,
  ...
)

Arguments

srt

A Seurat object.

reduction

Which dimensionality reduction to use. If not specified, will use the reduction returned by DefaultReduction.

group.by

Name of one or more meta.data columns to group (color) cells by.

combine

Combine plots into a single patchwork object. If FALSE, return a list of ggplot objects.

nrow

Number of rows in the combined plot. Default is NULL, which means determined automatically based on the number of plots.

ncol

Number of columns in the combined plot. Default is NULL, which means determined automatically based on the number of plots.

byrow

Whether to arrange the plots by row in the combined plot. Default is TRUE.

pt.size

The size of the points in the plot.

pt.alpha

The transparency of the data points. Default is 1.

palette

Color palette name. Available palettes can be found in thisplot::show_palettes. Default is "Chinese".

palcolor

Custom colors used to create a color palette. Default is NULL.

theme_use

Theme used. Can be a character string or a theme function. Default is "theme_scop".

theme_args

Other arguments passed to the theme_use. Default is list().

verbose

Whether to print the message. Default is TRUE.

...

Additional arguments to be passed to CellDimPlot and FeatureDimPlot.

Value

If combine = TRUE, returns a patchwork object combining all plots. If combine = FALSE, returns a named list of ggplot objects:

  • Score: UMAP plot colored by score computed by CytoTRACE2;

  • Potency: UMAP plot colored by potency category computed by CytoTRACE2;

  • Relative: UMAP plot colored by relative score computed by CytoTRACE2;

  • Phenotype: UMAP plot colored by phenotype (if group.by is provided);

  • Boxplot: Boxplot of score computed by CytoTRACE2 corresponding to phenotype (if group.by is provided).

Examples

data(pancreas_sub)
pancreas_sub <- standard_scop(pancreas_sub)
#>  [2026-05-14 05:57:13] Start standard processing workflow...
#>  [2026-05-14 05:57:13] Checking a list of <Seurat>...
#> ! [2026-05-14 05:57:13] Data 1/1 of the `srt_list` is "unknown"
#>  [2026-05-14 05:57:13] Perform `NormalizeData()` with `normalization.method = 'LogNormalize'` on 1/1 of `srt_list`...
#>  [2026-05-14 05:57:15] Perform `Seurat::FindVariableFeatures()` on 1/1 of `srt_list`...
#>  [2026-05-14 05:57:15] Use the separate HVF from `srt_list`
#>  [2026-05-14 05:57:16] Number of available HVF: 2000
#>  [2026-05-14 05:57:16] Finished check
#>  [2026-05-14 05:57:16] Perform `Seurat::ScaleData()`
#>  [2026-05-14 05:57:16] Perform pca linear dimension reduction
#>  [2026-05-14 05:57:16] Use stored estimated dimensions 1:20 for Standardpca
#>  [2026-05-14 05:57:17] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#>  [2026-05-14 05:57:17] Reorder clusters...
#>  [2026-05-14 05:57:17] Skip `log1p()` because `layer = data` is not "counts"
#>  [2026-05-14 05:57:17] Perform umap nonlinear dimension reduction
#>  [2026-05-14 05:57:17] Perform umap nonlinear dimension reduction using Standardpca (1:20)
#>  [2026-05-14 05:57:22] Perform umap nonlinear dimension reduction using Standardpca (1:20)
#>  [2026-05-14 05:57:26] Standard processing workflow completed
pancreas_sub <- RunCytoTRACE(
  pancreas_sub,
  species = "Mus_musculus"
)
#>  [2026-05-14 05:57:26] Running CytoTRACE2
#>  [2026-05-14 05:57:26] Extracting expression matrix from `assay = RNA, layer = counts`
#>  [2026-05-14 05:57:26] Downloading CytoTRACE2 model data from GitHub repository...
#>  [2026-05-14 05:57:26]   Downloading model_parameters.rds ...
#>  [2026-05-14 05:57:26]   Downloading features_model_training_17.csv ...
#>  [2026-05-14 05:57:26]   Downloading mt_dict_human_to_mouse.csv ...
#>  [2026-05-14 05:57:27]   Downloading mt_human_alias.csv ...
#>  [2026-05-14 05:57:27]   Downloading mt_mouse_alias.csv ...
#>  [2026-05-14 05:57:27] Loading model from /home/runner/.local/share/R/scop/CytoTRACE2
#>  [2026-05-14 05:57:30] Dataset contains 15998 genes and 1000 cells.
#>  [2026-05-14 05:57:30] Running on 1 subsample(s)
#>  [2026-05-14 05:57:30] Preprocessing subsample (1000 cells)
#>  [2026-05-14 05:57:30] 12486 input genes mapped to model genes.
#>  [2026-05-14 05:57:33] Running ensemble prediction and postprocessing
#>  [2026-05-14 05:57:33] Computing PCA for kNN smoothing
#>  [2026-05-14 05:58:07] CytoTRACE2 computed successfully

CytoTRACEPlot(
  pancreas_sub,
  group.by = "CellType",
  xlab = "UMAP_1",
  ylab = "UMAP_2"
)


plots <- CytoTRACEPlot(
  pancreas_sub,
  group.by = "CellType",
  combine = FALSE
)
plots$Boxplot