Skip to contents

Plot CytoTRACE 2 Results

Usage

CytoTRACEPlot(
  object,
  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,
  srt = NULL,
  ...
)

Arguments

object

A Seurat object.

reduction

Reduction to plot. NULL uses DefaultReduction.

group.by

Metadata column(s) used to color cells.

combine, nrow, ncol, byrow

Combine plots with patchwork. combine = FALSE returns a list of ggplots.

pt.size, pt.alpha

Point size and transparency. pt.size = NULL scales with sqrt(n) (minimum 0.3). Rasterized points keep at least a two-pixel radius at raster.dpi = c(512, 512) and scale with raster.dpi.

palette, palcolor

Palette name (thisplot::show_palettes) or custom colors.

theme_use, theme_args

Theme name or function, plus extra theme arguments.

verbose

Whether to print the message. Default is TRUE.

srt

Deprecated alias for object; supply exactly one of the two. It will be removed in scop 1.0.0.

...

Arguments passed to other functions.

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 <- RunStandardWorkflow(pancreas_sub)
#> ℹ [2026-11-12 05:09:31] Start standard processing workflow...
#> ℹ [2026-11-12 05:09:31] Checking a list of <Seurat>...
#> ! [2026-11-12 05:09:31] Data 1/1 of the `srt_list` is "unknown"
#> ℹ [2026-11-12 05:09:31] Perform `NormalizeData()` with `normalization.method = 'LogNormalize'` on 1/1 of `srt_list`...
#> ℹ [2026-11-12 05:09:31] Perform `FindVariableFeatures()` on 1/1 of `srt_list`...
#> ℹ [2026-11-12 05:09:31] Use the separate HVF from `srt_list`
#> ℹ [2026-11-12 05:09:31] Number of available HVF: 2000
#> ℹ [2026-11-12 05:09:31] Finished check
#> ℹ [2026-11-12 05:09:31] Perform `ScaleData()`
#> ℹ [2026-11-12 05:09:31] Perform pca linear dimension reduction
#> ℹ [2026-11-12 05:09:32] Use stored estimated dimensions 1:23 for Standardpca
#> ℹ [2026-11-12 05:09:32] Perform `Seurat::FindClusters()` with `cluster_algorithm = 'louvain'` and `cluster_resolution = 0.6`
#> ℹ [2026-11-12 05:09:32] Reorder clusters...
#> ℹ [2026-11-12 05:09:32] Skip `log1p()` because `layer = data` is not "counts"
#> ℹ [2026-11-12 05:09:32] Perform umap nonlinear dimension reduction
#> ✔ [2026-11-12 05:09:40] Standard processing workflow completed
pancreas_sub <- RunCytoTRACE(
  pancreas_sub,
  species = "Mus_musculus",
  backend = "cpp"
)
#> ◌ [2026-11-12 05:09:40] Running CytoTRACE2
#> ℹ [2026-11-12 05:09:40] Extracting expression matrix from `assay = RNA, layer = counts`
#> ◌ [2026-11-12 05:09:40] Running CytoTRACE2 with `backend = cpp`
#> ℹ [2026-11-12 05:09:40] Preparing CytoTRACE2 database
#> ℹ [2026-11-12 05:09:40] Downloading CytoTRACE2 model data from datasets GitHub repository...
#> ℹ [2026-11-12 05:09:40]   Downloading model_parameters.rds ...
#> ℹ [2026-11-12 05:09:41]   Downloading features_model_training_17.csv ...
#> ℹ [2026-11-12 05:09:41]   Downloading mt_dict_human_to_mouse.csv ...
#> ℹ [2026-11-12 05:09:42]   Downloading mt_human_alias.csv ...
#> ℹ [2026-11-12 05:09:42]   Downloading mt_mouse_alias.csv ...
#> ✔ [2026-11-12 05:09:42] CytoTRACE2 data cached at /home/runner/.local/share/R/scop/CytoTRACE2
#> ℹ [2026-11-12 05:09:42] Loading model from /home/runner/.local/share/R/scop/CytoTRACE2
#> ℹ [2026-11-12 05:09:45] Dataset contains 15998 genes and 1000 cells.
#> ℹ [2026-11-12 05:09:45] Running on 1 subsample
#> ℹ [2026-11-12 05:09:45] Using 1 core
#> ℹ [2026-11-12 05:09:45] 12486 input genes mapped to model genes.
#> ℹ [2026-11-12 05:09:45] Building results
#> ✔ [2026-11-12 05:09:54] 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