rctd-annotation

Annotate Visium and Xenium spatial transcriptomics data with cell types using RCTD deconvolution.

Updated May 28, 2026
One-click install
npx skills add https://github.com/cpanse/skills --skill rctd-annotation-cpanse
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: rctd-annotation
Source: https://github.com/cpanse/skills/tree/main/single-cell-spatial-general/skills/rctd-annotation
Command: npx skills add https://github.com/cpanse/skills --skill rctd-annotation-cpanse

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Spatial transcriptomics platforms like Visium and Xenium measure gene expression at spots or cells without known cell type labels. This Skill performs cell type deconvolution with RCTD (spacexr) using scRNA-seq references, so you can assign cell types, detect doublets, and integrate results into Seurat objects. ## Core Features & Use Cases - Reference Preparation: Downsample scRNA-seq references to 300-500 cells per type and build RCTD Reference objects with cleaned cell type names. - Single and Multi-Sample RCTD: Run deconvolution in doublet or full mode with parallel processing, then normalize weights and extract per-cell predictions. - Seurat Integration & Reporting: Add predicted cell types and weights to Seurat metadata, export cell groups for Xenium Explorer, and generate FGCZ-compliant R Markdown reports. - Use Case: You have a Xenium breast cancer dataset and a published scRNA-seq reference. Use this Skill to validate gene overlap, run RCTD across all samples, filter low-confidence cells, and produce spatial cell type maps with summary statistics. ## Quick Start Ask the agent to annotate your Xenium or Visium Seurat object with RCTD using your scRNA-seq reference and generate the spatial cell type plots and summary report.

Frequently Asked Questions about rctd-annotation

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I annotate Visium or Xenium data with RCTD?

Create a Reference object from a downsampled scRNA-seq dataset, build a SpatialRNA query from counts and tissue coordinates, then run create.RCTD and run.RCTD with doublet_mode set to doublet. Extract predicted cell types from the results_df slot and normalized weights with normalize_weights.

How many cells per cell type should an RCTD reference have?

Downsample the reference to 300-500 cells per cell type, with a minimum of about 25 cells per type. This balances deconvolution accuracy against memory usage and runtime, especially for large references.

What is the difference between RCTD doublet mode and full mode?

Doublet mode assigns at most two cell types per spot and runs 3-10x faster, making it the recommended default. Full mode allows any number of cell types per spot, which suits multi-label deconvolution at lower spatial resolution.

Why does RCTD fail with mismatched cells or gene names?

Coordinate and count matrices must contain identical cell barcodes; intersect and reorder both before creating the SpatialRNA object. Gene name mismatches between reference and query can be fixed by normalizing case, and you should verify at least 50% gene overlap.

How do I filter low-confidence RCTD predictions?

Compute the maximum normalized weight per cell and filter cells below a threshold such as 0.5. Low confidence typically indicates poor reference quality, tissue mismatch, or insufficient gene overlap between reference and spatial data.