← Về thư mục
📄 / / profiles / r-and-d / raw_evidence / OpenAI4S / skills / single-cell-rna-analysis / SKILL.md

name: single-cell-rna-analysis description: > Reproducible Scanpy workflow for human or mouse 10x scRNA-seq and snRNA-seq count matrices: single-sample descriptive QC, clustering and annotation, or comparative donor-aware pseudobulk DE and Milo DA; plus preflight validation, optional explicitly requested Harmony, checkpoints, resume, and a checksummed analysis bundle. Use for cell-called GEX matrices, not FASTQ, CITE-seq, ATAC, Multiome, spatial, trajectory, communication, or CNV analysis. origin: openai4s category: workflow capabilities: network: mode: none domains: []


Single-cell RNA Analysis

Use this workflow for human or mouse 10x GEX scRNA-seq or snRNA-seq after cell calling. It preserves raw counts, keeps descriptive cluster markers separate from condition inference, and treats annotations as evidence until the user confirms them.

Before running

  1. Read the input contract, select exactly one analysis_mode, and resolve every input path. Use descriptive only for a single h5ad without a valid condition contrast; otherwise use comparative.
  2. Run preflight(config). Do not proceed when status is invalid.
  3. Show the user warnings about ambient RNA, confounding, annotation evidence, or insufficient donor replication before interpreting results.
  4. Harmony is opt-in only. Never infer a batch key or silently replace a confounded one.

Call the workflow

The directory contains hyphens, so import it with importlib:

import importlib

single_cell = importlib.import_module("single-cell-rna-analysis.kernel")
config = {
    "schema_version": 1,
    "analysis_mode": "comparative",
    "organism": "human",
    "modality": "scrna",
    "input": {"mode": "sample_sheet", "path": "samples.csv"},
    "reference": {
        "gene_id_type": "symbol",
        "genome_build": "GRCh38",
        "annotation_release": "GENCODE 46",
    },
    "design": {
        "tested": "stim",
        "reference": "control",
        "condition_key": "condition",
        "donor_key": "donor_id",
        "paired": True,
        "covariates": [],
    },
    "integration": {"method": "none", "batch_keys": []},
}

check = single_cell.preflight(config)
result = single_cell.run(config, "single-cell-run")

For a single h5ad with no donor or condition metadata, use descriptive mode:

config = {
    "schema_version": 1,
    "analysis_mode": "descriptive",
    "organism": "human",
    "modality": "scrna",
    "input": {
        "mode": "h5ad",
        "path": "pbmc3k.h5ad",
        "counts_layer": "X",
        "sample_id": "pbmc3k",
    },
    "reference": {
        "gene_id_type": "symbol",
        "genome_build": "hg19",
        "annotation_release": "GENCODE 19",
    },
    "integration": {"method": "none", "batch_keys": []},
}

Descriptive mode never invents donor/condition labels, performs integration, or emits inferential DE/DA. It runs raw-count validation, within-sample QC, embedding, resolution-sweep clustering, descriptive markers and optional evidence-assisted annotation.

run() and resume() return status, run_dir, featured_files, warnings, annotation_status, statistics_status, and manifest. Save every featured file as an Artifact:

for featured_file in result["featured_files"]:
    host.save_artifact(featured_file)

If a run was interrupted, call:

resumed = single_cell.resume("single-cell-run")

Resume validates the resolved configuration and input hashes. A changed source invalidates dependent checkpoints instead of mixing results from different inputs.

Stage routing

Non-negotiable interpretation rules