Python API¶
The guided object and the functions used by the CLI and Snakemake workflow.
Guided object¶
- class cell_curator.CellCurator(*, adata=None, path=None, organism, tissue, run_id, cluster_key='canonical_cluster', markers=None, output_root='results/cell_curator', mode='evidence-only', scope_key=None, scope_name='', embedding_key='X_pca_harmony', layer='logcounts', counts_layer='counts', feature_id_column='gene_symbol', developmental_stage='', condition='', technology='dissociated', experimental_context='', composition_covariates=None, reviewer='', preauthorized=False, assumptions=(), hierarchy_levels=('L1',), writeback_prefix='cell_curator', overrides=None)[source]¶
A configured, hash-frozen annotation run.
Parameters mirror the questions the configuration actually asks. Anything not exposed here can still be set through
overrides, which is deep-merged onto the template last and therefore wins.Provide exactly one of
adataorpath.- Parameters:
adata (Any | None)
path (str | Path | None)
organism (str)
tissue (str)
run_id (str)
cluster_key (str)
output_root (str | Path)
mode (str)
scope_key (str | None)
scope_name (str)
embedding_key (str)
layer (str)
counts_layer (str)
feature_id_column (str)
developmental_stage (str)
condition (str)
technology (str)
experimental_context (str)
composition_covariates (Sequence[str] | None)
reviewer (str)
preauthorized (bool)
assumptions (Sequence[str])
hierarchy_levels (Sequence[str])
writeback_prefix (str)
overrides (Mapping[str, Any] | None)
- DEFAULT_SCOPE_KEY = 'cell_curator_scope'¶
- prepare()[source]¶
Freeze the input, then run the scene and plan stages in order.
Evidence generation requires both stages, so this removes the one piece of ordering a caller would otherwise have to know. An interactive run (the default) still stops here until the context is confirmed and the assumptions gate is signed.
- approve_assumptions(*, reviewer, scope='*', preauthorized=False)[source]¶
Sign the assumptions gate. Required before any biological label.
- preview_writeback(*args, **kwargs)[source]¶
Return the source-preserving write-back diff without applying it.
- write_back(*args, **kwargs)[source]¶
Apply an explicitly approved write-back to a new object by default.
- freeze_review_packet()[source]¶
Freeze the immutable review packet directory for human sign-off.
- Return type:
- annotate()[source]¶
Run every computational phase and freeze a review packet.
This is the whole pipeline: initialize, plan, audit, refine, evidence, decide, map, review, validate. It is idempotent, so calling it after the granular methods resumes rather than repeats. Labels still are not written back to any object — that stays behind
write_back().- Return type:
- confirm_context(*, input_path, reviewer)[source]¶
Confirm or correct the biological context recorded in Stage 1.
- add_assumption(*, statement, scope='global', material=True)[source]¶
Append one assumption to the living ledger.
- list_capabilities()[source]¶
Return the assay-aware capability registry this configuration resolves to.
- build_report(*, strict=False, level=None)[source]¶
Build the self-contained HTML report only.
Distinct from
review_packet(), which also builds the evidence cards and critic packet that surround it.
- build_critic_packet()[source]¶
Build the platform-neutral critic packet for adversarial review.
- Return type:
- import_critic_findings(input_path)[source]¶
Validate and atomically import structured critic findings.
Configuration and record types¶
One checksum-pinned acquisition artifact in a benchmark recipe. |
|
Versioned, neutral public or local benchmark acquisition contract. |
|
One operating point on the risk-coverage curve of a prediction table. |
|
Functions¶
Combine four evidence dimensions into an explicitly uncalibrated score. |
|
Run the configured pipeline; corpus runs execute the compiled Snakemake DAG. |
|
Return current stage, scope, blockers, progress, and next action. |
|
Apply an atomic write-back to a new object by default. |
|
Record interactive or declared non-interactive assumption approval. |
|
Build the platform-neutral critic packet for adversarial review. |
|
Scaffold one evidence card per proposed label. |
|
Build the self-contained HTML review report. |
|
Assemble and publish the signed marker vocabulary for a configuration. |
|
Create the hash-frozen working copy and canonical membership artifacts. |
|
Refuse a corpus whose records were learned from the test split's donors. |
|
Run strict read-only report validation after approval. |
|
Collect parent-scoped markers, classifier corroboration, and state evidence. |
|
Compare label definitions, source records, and mappings between revisions. |
|
Compute or validate source-preserving QC on the canonical working copy. |
|
Return the machine-readable schema for configuration version 3. |
|
Confirm or correct the scene context recorded in Stage 1. |
|
Corroborate CL terms against an optional live service without depending on it. |
|
Detect CPU, RAM, Apple Silicon, CUDA, and scheduler state without mutation. |
|
List locally cached CellTypist models without downloading anything. |
|
Score a neutral-format prediction table against its recorded truth. |
|
Turn an existing per-cell prediction column into one auditable hypothesis. |
|
Write a completed run's labels as a neutral-format prediction table. |
|
Export reviewed, context-matched corpus definitions as signed programs. |
|
Acquire a pinned curated-human reference bundle with a cache receipt. |
|
Acquire a bounded CELLxGENE Census slice with a versioned cache receipt. |
|
Acquire a pinned SCimilarity model bundle with a cache receipt. |
|
Validate hierarchy nesting and publish cell labels and the evidence report. |
|
Freeze the immutable review packet directory for human sign-off. |
|
Import bounded normalized source records without approving their labels. |
|
Write one level's decisions from the configured annotation-consensus run. |
|
Validate and atomically import structured critic findings. |
|
Validate and atomically import reviewer dispositions for critic findings. |
|
Initialize or resume an immutable annotation run. |
|
Inspect an AnnData or MuData source without changing it. |
|
Return the living assumptions ledger for a configured run. |
|
Return the assay-aware capability registry a configuration resolves to. |
|
Load and validate a pinned multi-source label corpus. |
|
Map a query onto a curated human reference (Azimuth-style). |
|
Transfer labels from a labeled reference by nearest neighbours. |
|
Map a query onto a trained reference model with scArches surgery. |
|
Run a local SCimilarity model as one hypothesis. |
|
Persist Stage 2 vocabulary, evidence routes, and unresolved assumptions. |
|
Run a locally cached CellTypist model as one hypothesis. |
|
Run a local pretrained CPU popV subset with full method provenance. |
|
Persist Stage 1 inspection, context, compute, assumptions, and progress. |
|
Return a source-preserving write-back diff after computational checks. |
|
Record a proposed corpus change without changing the active snapshot. |
|
Report the configured ontology provider's provisioning status. |
|
Append one assumption to the living ledger. |
|
Return a validated config copy with one newly registered assay representation. |
|
Return a validated config copy with one local or optional cached provider. |
|
Record a review and publish a new immutable corpus revision. |
|
Select one deterministic automated cross-check for a hierarchy scope. |
|
Run one configured local classifier as an immutable evidence stage. |
|
Run the complete signed marker profile and cross-check surface. |
|
Report coverage, selective accuracy, and risk across a confidence grid. |
|
Train a scANVI reference model from a labeled local reference object. |
|
Enforce that every critic finding carries a reviewer disposition. |
|
Validate one public benchmark dataset manifest. |
|
Enforce one parent per label and optional one-cell-one-leaf membership. |
|
Validate configured local knowledge providers and any configured ontology. |
|
Validate ontology accessions against a local ontology file. |
|
Validate completeness, hashes, mapping conservation, and review state. |