From single-cell-spatial-general
Comprehensive toolkit for predicting cellular potency and differentiation states from single-cell RNA-seq data using CytoTRACE2, with full integration into FGCZ analysis workflows. Use when analyzing developmental hierarchies, stem cell differentiation, cancer stemness, or inferring cellular potency from scRNA-seq Seurat objects.
How this skill is triggered — by the user, by Claude, or both
Slash command
/single-cell-spatial-general:cytotrace2-analysisThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Predict cellular potency and differentiation states from scRNA-seq data.
Predict cellular potency and differentiation states from scRNA-seq data.
CytoTRACE 2 outputs:
devtools::install_github("digitalcytometry/cytotrace2", subdir = "cytotrace2_r")
slot_type = "counts""human" or "mouse" (default)library(CytoTRACE2)
seurat_obj <- cytotrace2(
seurat_obj, is_seurat = TRUE, slot_type = "counts",
species = "human", ncores = 16, batch_size = 10000
)
seurat_obj$sample <- paste0(seurat_obj$patient, "_", seurat_obj$condition)
seurat_list <- SplitObject(seurat_obj, split.by = "sample")
for (i in seq_along(seurat_list)) {
seurat_list[[i]] <- cytotrace2(
seurat_list[[i]], is_seurat = TRUE, slot_type = "counts",
species = "human", ncores = 16
)
}
# Merge and transfer metadata
seurat_merged <- merge(seurat_list[[1]], seurat_list[-1])
seurat_obj <- AddMetaData(seurat_obj, seurat_merged$CytoTRACE2_Score, "CytoTRACE2_Score")
seurat_obj <- AddMetaData(seurat_obj, seurat_merged$CytoTRACE2_Relative, "CytoTRACE2_Relative")
seurat_obj <- AddMetaData(seurat_obj, seurat_merged$CytoTRACE2_Potency, "CytoTRACE2_Potency")
| Parameter | Default | Notes |
|---|---|---|
species | "mouse" | Use "human" for human data |
ncores | 1 | 16 for high-memory systems |
batch_size | 10000 | Reduce to 5000 if memory-limited |
slot_type | "counts" | Never use log-transformed |
When to split by sample: >100K cells, condition analysis, memory issues, batch effects.
| Score | Category | Description |
|---|---|---|
| 0.0-0.167 | Differentiated | Terminally differentiated |
| 0.167-0.333 | Unipotent | Single lineage |
| 0.333-0.5 | Oligopotent | Few lineages |
| 0.5-0.667 | Multipotent | Multiple lineages |
| 0.667-0.833 | Pluripotent | Most lineages |
| 0.833-1.0 | Totipotent | All lineages |
Relative vs Absolute: Relative is normalized within dataset; absolute is cross-dataset comparable.
# Standard colors
colors.cyto <- c(Differentiated = "#9E0142", Unipotent = "#F46D43",
Oligopotent = "#FEE08B", Multipotent = "#E6F598",
Pluripotent = "#66C2A5", Totipotent = "#5E4FA2")
mycols <- rev(unname(pals::polychrome(32)))
# UMAP with inferno palette
FeaturePlot(seurat_obj, "CytoTRACE2_Score", raster = FALSE) +
scale_colour_gradientn(colours = c("#000004FF", "#3B0F70FF", "#8C2981FF",
"#DE4968FF", "#FE9F6DFF", "#FCFDBFFF"),
limits = c(0, 1)) +
coord_fixed()
# Violin with potency labels
VlnPlot(seurat_obj, "CytoTRACE2_Score", group.by = "cell_type",
cols = mycols, sort = TRUE, pt.size = 0) +
scale_y_continuous(sec.axis = sec_axis(~., breaks = seq(0, 1, by = 1/12),
labels = c("", "Differentiated", "", "Unipotent", "", "Oligopotent", "",
"Multipotent", "", "Pluripotent", "", "Totipotent", "")))
See references/visualization.md for complete visualization code.
Critical: "rowMeans(): 'x' must be numeric" error on >100K cells is a resource issue, not data quality. Use SBATCH job submission with proper resources.
See references/troubleshooting.md for:
/home/pgueguen/git/paul-scripts/p31662_UM_Aizhan/UM_Atlas/Creates, edits, and optimizes skills for Claude Code, including drafting, evaluating with test prompts, iterating on performance, and improving skill descriptions for better triggering accuracy.
npx claudepluginhub cpanse/skills --plugin single-cell-spatial-general