Cell Curator

Use cell-curator to annotate an existing clustering. Local inputs are sufficient; optional classifiers, atlases, and web resources provide corroborating evidence.

For new annotation tasks, use the reviewed corpus and compiled hierarchy workflow in annotation-corpus.md. Establish the corpus and biological context, set annotation.enabled: true, and declare the desired L1–L3 identity levels. Configure matched CellTypist and popV resources when applicable. Record missing or unsuitable methods explicitly; do not silently substitute an unrelated reference. Keep established runs on their frozen configuration. The shared template retains the legacy disabled setting for compatibility, so new corpus runs must enable it explicitly.

Analytical constraints

  1. Freeze the source hash, working copy, and parent membership before analysis.

  2. Scope every child vocabulary, score, and refinement to its parent.

  3. Keep cell type and cell state separate. Preserve disagreement and Unknown.

  4. Treat missing features as unmeasured. Declare separate ranking and detection representations when their semantics differ.

  5. Run GPU methods only after the declared hardware and software contract passes.

  6. Approve material assumptions before assigning biological labels.

  7. Reconcile critic findings and preview the complete diff before write-back.

  8. Use Snakemake to manage dependencies and resume for workflow execution.

References

Read only the contract needed for the current decision.

Topic

Contract

Inputs, matrices, and QC

input-contract.md

Marker file format

markers.md

Reviewed label corpus and compiled hierarchy

annotation-corpus.md

Assays and providers

assay-routing.md

Parent-local refinement

adaptive-subclustering.md

Multimodal evidence

multimodal-evidence.md

Decisions and critics

decision-gates.md

Durable artifacts

artifact-schemas.md

Compute and resume

compute-and-snakemake.md

Completion criteria

validation.md

Capability mapping

quadbio-parity.md

LLM annotators compared

llm-annotators.md

Copy config.template.yaml. Declare the input, cluster key, assays, representations, detection source, biological context, knowledge providers, hierarchy, compute limits, and output path.

Versioned corpus

Use local normalized source exports and reviewed proposals as described in the corpus guide. Imports never approve labels. These commands inspect or create immutable knowledge artifacts, not run labels:

cell-curator corpus validate --input corpus.json
cell-curator corpus export --input corpus.json --context context.json --output markers.json
cell-curator corpus import --input corpus.json --records source-records.json \
  --output imported.json --source-kind generic --source-id study \
  --name "Study definitions" --url https://example.org/source \
  --source-version v1 --retrieved-at 2026-11-07
cell-curator corpus propose --input imported.json --changes changes.json \
  --output proposal.json --reason "Reviewed marker definition" --proposer REVIEWER
cell-curator corpus review --input imported.json --proposal proposal.json \
  --output reviewed.json --reviewer REVIEWER --rationale "Evidence reviewed" \
  --revision reviewed-v1 --decision accept
cell-curator corpus diff --input imported.json --other reviewed.json
cell-curator corpus check-isolation --input reviewed.json --donor-split donor_split.tsv \
  --test-split B --dataset-id DATASET_ID

The corpus reviewer is a person. An agent may prepare a proposal for review; do not record a person’s acceptance on their behalf.

1. Validate and freeze

Validate the configuration and inspect all requested resources before analysis:

cell-curator config validate --config config.yaml
cell-curator environment detect --config config.yaml
cell-curator data inspect --config config.yaml
cell-curator ontology provision --config config.yaml
cell-curator data canonicalize --config config.yaml
cell-curator data qc --config config.yaml
cell-curator run scene --config config.yaml
cell-curator progress status --config config.yaml

Resolve ambiguous matrices, duplicate features, missing keys, cell mismatches, source-hash drift, scheduler ambiguity, and invalid GPU contracts before proceeding. Review context.json, then record corrections and the reviewer:

cell-curator run confirm-context --config config.yaml \
  --input context-confirmation.json --reviewer REVIEWER

A non-interactive run requires guidance.interactive: false, guidance.preauthorized: true, a reviewer, complete context, and recorded assumptions. It uses the same gates and ledger as an interactive run.

2. Build and approve the plan

Construct the parent-scoped vocabulary, profile the measured panel, compute markers, score signed programs, and select a cross-check. CLUSTER_KEY is the config’s input.keys.canonical_parent, and results/RUN/canonical/input.h5ad is the frozen working copy (.h5mu for MuData) the run freezes under run.output_root:

cell-curator markers assemble --config config.yaml
cell-curator markers compute --config config.yaml --assay transcriptome \
  --representation logcounts --group-key CLUSTER_KEY
cell-curator markers profile --config config.yaml --assay transcriptome \
  --representation logcounts --group-key CLUSTER_KEY
cell-curator markers score --config config.yaml --assay transcriptome \
  --representation logcounts --group-key CLUSTER_KEY
cell-curator route select --request route-request.json
cell-curator run plan --config config.yaml
cell-curator assumptions list --config config.yaml

Record and approve material assumptions for the relevant scope:

cell-curator assumptions add --config config.yaml --scope SCOPE \
  --statement "MATERIAL ASSUMPTION"
cell-curator assumptions approve --config config.yaml \
  --scope SCOPE --reviewer REVIEWER

Renew approval when a later hierarchy level introduces a material assumption.

3. Generate evidence and assign labels

Set annotation.enabled: true and use the corpus workflow described in annotation-corpus.md. workflow/annotation.smk compiles the DAG; run it first with --dry-run. Source imports remain unreviewed until a person reviews a corpus proposal. Keep each source’s definitions and taxonomy; Allen is one example, not a preferred standard.

Assess technical association, quality, stress, cycling, gradients, mixed states, composition, and spatial context before accepting a label or Unknown.

# run execute runs the compiled DAG and needs the consensus run described below
cell-curator run execute --config config.yaml
cell-curator cluster confidence --margin 0.3 --specificity 0.8 \
  --agreement 0.7 --coverage 0.9
cell-curator hierarchy validate --labels results/RUN/labels/L1.tsv
cell-curator run status --config config.yaml

The package chooses no label. The labels come from an annotation-consensus run (skills/annotation-consensus). Set annotation.consensus_directory in the config to that run’s output directory; the directory can be empty when you write the config, because the consensus run needs the plan’s vocabulary first. The run covers the first hierarchy level only (guidance.hierarchy_levels: [L1]). After run plan and Gate A:

cell-curator annotation collect-level --config config.yaml --level L1
# run annotation-consensus with plan/vocabulary.tsv as its vocabulary, then:
cell-curator annotation import-consensus --config config.yaml --level L1
cell-curator annotation finalize --config config.yaml

import-consensus refuses a consensus run unless its cells and clusters match the run’s input, every label is in the approved L1 vocabulary (or is Unknown), and each cl_id matches the vocabulary. The imported confidence is the share of the cluster’s cells that vote for the label. It is not a calibrated probability.

Use only applicable cross-checks. Inspect unavailable receipts and their stated remediation. Automated predictions remain hypotheses.

cell-curator crosscheck obs-pred --input results/RUN/canonical/input.h5ad \
  --prediction-column predicted_label --cluster-column CLUSTER_KEY \
  --output-dir results/RUN/crosschecks
cell-curator crosscheck celltypist-discover --output-dir results/RUN/crosschecks
cell-curator crosscheck celltypist-predict --input results/RUN/canonical/input.h5ad \
  --model MODEL --cluster-column CLUSTER_KEY \
  --output-dir results/RUN/crosschecks
cell-curator crosscheck popv-predict --input results/RUN/canonical/input.h5ad \
  --reference references/annotated.h5ad --reference-label cell_type \
  --model-dir models/popv-pretrained --cluster-column CLUSTER_KEY \
  --output-dir results/RUN/crosschecks/popv
cell-curator crosscheck reference-knn --query results/RUN/canonical/input.h5ad \
  --reference reference.h5ad --reference-label cell_type --backend cpu \
  --output-dir results/RUN/crosschecks
cell-curator crosscheck azimuth --query results/RUN/canonical/input.h5ad \
  --reference reference.h5ad --reference-label cell_type \
  --output-dir results/RUN/crosschecks
cell-curator crosscheck scimilarity --input results/RUN/canonical/input.h5ad \
  --model-path models/scimilarity --output-dir results/RUN/crosschecks
cell-curator reference acquire-census --organism homo_sapiens --tissue blood \
  --output references/census.h5ad --version CENSUS_VERSION --max-cells 50000 \
  --expected-sha256 SHA256
cell-curator reference acquire-azimuth --url https://HOST/PATH \
  --output references/azimuth.h5ad --expected-sha256 SHA256
cell-curator reference acquire-scimilarity --url https://HOST/PATH \
  --output models/scimilarity.tar.gz --expected-sha256 SHA256
cell-curator reference train-scanvi --reference references/census.h5ad \
  --labels-key cell_type --counts-layer counts --output-dir models/scanvi
cell-curator reference map-scarches --query results/RUN/canonical/input.h5ad \
  --model-dir models/scanvi --output-dir results/RUN/crosschecks

Add --help to a route for its remaining flags. A .h5mu input additionally requires --input-modality, --query-modality, or --reference-modality. --backend gpu on reference-knn runs only after GPU validation passes.

acquire-azimuth and acquire-scimilarity are bounded by --max-bytes and --timeout-seconds and pinned by a required --expected-sha256. acquire-census is a Census query bounded by --max-cells and --timeout-seconds, pinned by --version, and checked against --expected-sha256 when you give one. It reaches Census outside the network guard. Every route writes a receipt recording the cache hit and checksum result. A bundle is stored as published; extract it yourself before passing it to --reference or --model-path.

4. Review and validate

Create evidence cards, import independent critic findings, reconcile each finding, and build the self-contained report. Every pass in review.critic_passes must import at least one finding; a pass that found nothing imports one row with severity NONE. Imports are append-only, so a later import cannot erase an earlier finding.

cell-curator evidence-card scaffold --config config.yaml
cell-curator critic packet --config config.yaml
cell-curator critic import-findings --config config.yaml --input critic-findings.tsv
cell-curator critic reconcile --config config.yaml --input critic-reconciliation.tsv
cell-curator critic validate --config config.yaml
cell-curator report build --config config.yaml --strict
cell-curator report check --config config.yaml --strict
cell-curator run validate --config config.yaml

The local ontology decides whether a CL identifier is valid. When a live_ontology provider is configured and remote enhancement is authorized, corroborate the accessions you assigned against it before write-back:

cell-curator ontology corroborate --config config.yaml \
  --term CL:0000084 --expected-name "T cell"

It reports agreement, disagreement, and unreachability, stores each answer it received as a hashed artifact, and changes no label. An absent network is an expected result, not a failure.

The report must show embeddings, marker evidence, hierarchy, uncertainty, rejected alternatives, QC, composition, provenance, and spatial context when available. Reconciliation records a reviewer and rationale for every resolved or dismissed finding.

To score this run against an external ground truth, export its labels as a neutral prediction table:

cell-curator run export-predictions --config config.yaml \
  --truth ground-truth.tsv --output predictions.tsv

The truth table must name exactly the barcodes the run labelled, carrying barcode and true_label and optionally true_cl_id and true_path. Any overlap that is not an exact match is refused rather than scored, so the cell set being measured is one that was chosen. An immutable receipt beside the table records the truth digest, the run’s mapping digest, and every label table it was built from. Annotation is per cluster, so the per-cell confidence column is a cluster value carried to each cell, and the receipt says so.

5. Preview and write back

Preview the complete mapping:

cell-curator write-back preview --config config.yaml --output annotated.h5ad

After assumptions, hierarchy, report, and critic validation pass, stop and ask the user to run write-back themselves in their own terminal. The command prints a summary and an approval_token covering the run, source, labels, assumptions, report, critic ledgers, diff, and target, and writes only after the token is typed back. Never type the token for the user, and never write an approval file: an agent approving its own output is exactly what the gate exists to prevent.

cell-curator write-back apply --config config.yaml --output annotated.h5ad
cell-curator progress status --config config.yaml
cell-curator run status --config config.yaml

A non-interactive run writes only when its configuration set guidance.preauthorized: true before scene setting; the receipt records which mode approved it.

Preserve category order and report colours. Modify the source only through the explicit in-place option.