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

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.

...

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