cell-curator¶
This package annotates pre-clustered AnnData and MuData from signed marker
programs, bottom-up markers, ontology checks, reference mappings, and multimodal
evidence. It records uncertainty and preserves Unknown when evidence is
insufficient.
Runs are local and review-gated, and the source object remains unchanged. Writing an annotated output requires a person to confirm the exact reviewed state. Running cell-curator requires Python 3.11 or newer and an existing clustering.
Documentation: https://mdmanurung.github.io/cell-curator/
Install¶
Clone the repository, then install the workflow dependencies:
git clone https://github.com/mdmanurung/cell-curator.git
cd cell-curator
uv sync --frozen --extra workflow
uv run cell-curator --version
Alternatively, install the current wheel from GitHub Releases:
uv pip install https://github.com/mdmanurung/cell-curator/releases/download/v0.3.0/cell_curator-0.3.0-py3-none-any.whl
The wheel installs the workflow, schemas, templates, and agent skill under
<prefix>/share/cell-curator/. Available extras are workflow, celltypist,
reference-models, census, and scimilarity.
Agent harnesses¶
The skill and the CLI work the same in Claude Code, Codex, and OpenCode. Install the CLI once, so every harness can run it:
uv tool install "cell-curator[workflow] @ git+https://github.com/mdmanurung/cell-curator"
Inside this repository nothing else is needed. Codex and OpenCode find the skill
at .agents/skills/cell-curator and read AGENTS.md, and Claude Code reads
CLAUDE.md. To use the skill from any project:
Harness |
Skill |
Ask before approvals |
|---|---|---|
Claude Code |
|
the plugin’s |
Codex |
|
copy |
OpenCode |
the same |
merge |
The approval rules make the harness ask a person before cell-curator assumptions approve (Gate A) and cell-curator write-back apply, the two commands
that stand in for a human decision.
Agent-guided run¶
Provide the input path, cluster key, assay representations, biological context, and available marker programs. For example:
Annotate
data/pbmc_clustered.h5ad. The samples are healthy adult human peripheral blood measured with 10x 3’. Clusters are inobs["leiden"], log-normalized values inlayers["logcounts"], and counts inlayers["counts"]. Use the shippedassets/markers/human-pbmc.json. Begin in evidence-only mode and report marker coherence, uncertainty, and unresolved clusters before proposing labels.
For a complete run on public data, see the PBMC 3k tutorial.
The agent then follows SKILL.md and the linked analytical contracts. Interactive and pre-authorized runs produce the same decision ledger.
Python run¶
For programmatic use, CellCurator exposes the implementation shared by the CLI
and Snakemake workflow:
from cell_curator import CellCurator
cur = CellCurator(
adata=adata, # or path="data/pancreas_clustered.h5ad"
organism="human",
tissue="pancreas",
cluster_key="leiden_1",
markers="markers/pancreas.json",
run_id="pancreas-v1",
output_root="/abs/path/results",
mode="annotation", # or "evidence-only"
developmental_stage="adult",
condition="healthy",
experimental_context="pancreas atlas v1",
)
cur.inspect()
cur.prepare()
cur.plan()
cur.approve_assumptions(reviewer="your-name") # Gate A: you approve the plan's assumptions
The package chooses no label. After the plan, run an annotation-consensus run
(skills/annotation-consensus) with plan/vocabulary.tsv, set
annotation.consensus_directory to its output, and continue with
collect_annotation_level, import_consensus_annotation_level and
finalize_corpus_annotation, or the CLI commands annotation collect-level,
annotation import-consensus and annotation finalize. Write-back requires a person
to confirm it. A worked example on public data is in
skills/annotation-consensus/examples/pbmc3k.
Configure the input¶
For a versioned, multi-source label corpus and a compiled L1–L3 workflow, see the corpus guide. It collects Wilcoxon and logistic-regression markers, runs configured local CellTypist/popV models, and records deterministic decisions within accepted parents. A separate state/study display supplies L4. New corpus knowledge enters through reviewed proposals; no atlas is treated as a gold standard.
For file-based CLI or Snakemake runs, copy and validate the configuration template:
cp skills/cell-curator/assets/config.template.yaml config.yaml
uv run cell-curator config validate --config config.yaml
Declare each assay and representation explicitly. The table summarizes the main distinctions:
Data |
Required distinction |
|---|---|
scRNA-seq |
Use log-normalized values for ranking and counts for detection. |
CITE-seq or MuData |
Keep RNA and protein as separate evidence lanes. |
scATAC-seq or multiome |
Distinguish peak accessibility from inferred gene activity. |
Spatial transcriptomics |
Treat proximity as context rather than cell identity. |
Hierarchical labels |
Scope every child decision to its frozen parent. |
Set input.keys.canonical_parent to the cluster column. Register markers,
ontologies, or labeled references under knowledge.providers. Use a new
run.run_id when the input or configuration changes. See
assay-routing.md for the full
representation contract.
Network: offline, institution, or online¶
Every HTTP request goes through one guard, set by knowledge.network:
|
Reaches |
Use it for |
|---|---|---|
|
nothing |
local markers and a local Cell Ontology |
|
localhost and |
a local or institutional model server, ontology mirror, or table server; nothing leaves the institution |
|
any host |
remote tables, live ontology lookups, Census, CellTypist models |
An allowed_hosts entry that starts with . allows that domain’s subdomains.
Redirects are checked too, so an allowed host cannot send a request outside.
CellTypist routes use cached models only and never download. Plan offers a
Census route only in online mode. reference acquire-azimuth and
acquire-scimilarity are downloads a person runs by name, each one GET for a
public, checksum-pinned file. reference acquire-census queries Census through tiledb, outside the guard.
What network cannot govern: the agent itself. In Claude Code or Codex with a cloud model, every file the agent reads goes to that vendor, and the evidence cards, reports, and score tables carry per-cluster statistics from your data. Nothing leaves the institution only when the harness model is local too (for example OpenCode with Ollama), or when you run the CLI or Python without a cloud agent.
Execute the workflow¶
With config.yaml prepared, use the guided CLI to move through each review boundary:
uv run cell-curator config validate --config config.yaml
uv run cell-curator data inspect --config config.yaml
uv run cell-curator run scene --config config.yaml
uv run cell-curator run confirm-context --config config.yaml \
--input context-confirmation.json --reviewer REVIEWER
uv run cell-curator run plan --config config.yaml
uv run cell-curator assumptions approve --config config.yaml --reviewer REVIEWER
uv run cell-curator run execute --config config.yaml
uv run cell-curator run validate --config config.yaml
For additional commands, cell-curator --help lists all 23 command groups.
For resumable execution, Snakemake manages dependencies and stale artifacts. The
annotation DAG (workflow/annotation.smk) needs annotation.enabled: true and an
existing consensus run. Its targets keep the review boundary. Write-back remains a
separate step:
uv run snakemake --snakefile workflow/annotation.smk annotation \
--configfile config.yaml --cores 4
uv run snakemake --snakefile workflow/annotation.smk annotation_review \
--configfile config.yaml --cores 4
Before executing a new configuration, use --dry-run. The Slurm profile is in
workflow/profiles/slurm.
Review and write back¶
After the run completes and before write-back, review the artifacts under
run.output_root/run.run_id. They include evidence receipts, hierarchy decisions,
critic reconciliation, the review packet, and provenance. Every configured critic
pass must record findings, or a severity NONE attestation, before write-back
proceeds. Preview the complete mapping, then apply it from your own terminal:
uv run cell-curator write-back preview --config config.yaml --output annotated.h5ad
uv run cell-curator write-back apply --config config.yaml --output annotated.h5ad
apply prints a summary and an approval token covering the run, source, labels,
assumptions, report, critic ledgers, diff, and output path, and writes only after you
type the token. A non-interactive run writes only when its configuration set
guidance.preauthorized: true before scene setting. See
artifact-schemas.md for the
receipt.
Analytical constraints¶
Cell type and cell state are separate annotation axes.
Missing panel features are unmeasured, not negative evidence.
ATAC peaks provide direct accessibility evidence; gene activity is inferred.
A RAPIDS route requires its declared GPU and software contract. CPU output is not substituted for a required GPU result.
Unknownis retained when coverage, coherence, margin, or capability is inadequate.Supplied Cell Ontology identifiers require local semantic validation. Labels may remain ontology-free when no ontology is available.
Comparative claims require measured benchmark results.
Known limits¶
No comparative result yet. The only published benchmark scores cell-curator alone on one AIDA PBMC slice, and it fires its own “not comparable” stop rule. See benchmarks/README.md.
Confidence is a vote share, not a calibrated probability.
Human-first. Marker genes match case-insensitively, but there is no ortholog mapping, and only a human PBMC marker set ships.
CPU scale. The CPU bottom-up marker lane densifies each cluster against the rest, and stability refinement runs networkx Louvain. Neither has been measured at atlas scale. For hundreds of thousands of cells, use the RAPIDS route.
scANVI and scArches need a CUDA GPU. The Azimuth-compatible lane is a kNN on harmonized genes, not Azimuth itself.
Documentation¶
Topic |
Document |
|---|---|
Installation and extras |
|
Tutorial on PBMC 3k |
|
Error messages and fixes |
|
Command-line reference |
|
Agent workflow |
|
Inputs and matrices |
|
Marker file format |
|
Assays and providers |
|
Parent-local refinement |
|
Multimodal evidence |
|
Decisions and critics |
|
Artifact schemas |
|
Compute and resume |
|
Validation |
|
Capability mapping |