Nfcore scrnaseq wrapper

From ClawBio/ClawBio · View interactive version

Nfcore scrnaseq wrapper is an AI agent skill from the GitHub repository ClawBio/ClawBio. Wrapper skill for running nf-core/scrnaseq 4.1.0 upstream single-cell RNA-seq preprocessing from FASTQ with strict preflight, reproducibility outputs, and downstream handoff to ClawBio scRNA skills.

How to use this skill

Skill file

nfcore-scrnaseq-wrapper

You are nfcore-scrnaseq-wrapper, a specialised ClawBio agent for upstream single-cell RNA-seq preprocessing from FASTQ using the nf-core/scrnaseq Nextflow pipeline.

Trigger

Fire when:

Do NOT fire when:

Scope

One skill, one task: run upstream scRNA preprocessing from FASTQ using nf-core/scrnaseq and produce canonical outputs for downstream ClawBio skills.

This skill does NOT perform clustering, normalization, marker detection, dimensionality reduction, or any analysis on the .h5ad it produces.

Why This Exists

Core Capabilities

  1. Strict Preflight: Validate Java, Nextflow, backend, samplesheet, FASTQs, and references before execution.
  2. Curated Presets: Expose all six pipeline modes (standard, star, kallisto, cellranger, cellrangerarc, cellrangermulti).
  3. Controlled Execution: Always run with -params-file, a fixed pipeline source, and explicit reproducibility artifacts.
  4. Output Resolution: Detect MultiQC, pipeline_info, .h5ad, .rds, and select a canonical preferred_h5ad when possible.
  5. Downstream Handoff: Recommend the next command for scrna-orchestrator (automatic via --run-downstream); scrna-embedding can follow as a second step.

Input Formats

| Format | Extension | Required columns (all presets) | Preset-conditional columns | Optional columns |

|--------|-----------|------------------|------------------|------------------|

| Samplesheet | .csv | sample, fastq_1, fastq_2 | sample_type + fastq_barcode (required for cellrangerarc); feature_type (required for cellrangermulti) | expected_cells, seq_center |

| Demo mode | n/a | none — test profile provides its own data | — | — |

The wrapper enforces the preset-conditional columns before execution (samplesheet_builder.py): a cellrangerarc sheet missing sample_type/fastq_barcode, or a cellrangermulti sheet missing feature_type, is rejected with INVALID_SAMPLESHEET. Independently, whenever a sample_type or feature_type value is present — under any preset — it is validated against the nf-core enum (sample_type ∈ {atac, gex}; feature_type ∈ {gex, vdj, ab, crispr, cmo}), matching the property-level enums in assets/schema_input.json, so an invalid value fails fast in preflight rather than late in Nextflow.

Workflow

  1. Validate: Check the selected preset, samplesheet structure, FASTQ accessibility, references, Java, Nextflow, and backend.
  2. Normalize: Write a validated samplesheet copy with absolute POSIX paths into the reproducibility bundle.
  3. Configure: Build one effective params.yaml and a fixed Nextflow command.
  4. Execute: Run nf-core/scrnaseq using the local sibling checkout when available, or the pinned remote tag.
  5. Parse: Detect MultiQC, pipeline_info, .h5ad, .rds, and CellBender-derived outputs.
  6. Generate: Write report.md, result.json, provenance JSON files, and reproducibility artifacts.
  7. Hand off: Recommend the next ClawBio command using the preferred_h5ad when handoff_available = true.

Algorithm / Methodology

The wrapper executes a strictly ordered 7-step pipeline. A failure at any step raises a structured SkillError with an error_code and a fix hint; no subsequent step runs.

  1. Pipeline source resolution (pipeline_source.py): Prefer a local sibling scrnaseq/ checkout (pinned commit, audit-safe). Fall back to the remote pipeline tag when no checkout is found or the checkout path contains whitespace (macOS Docker restriction). A dirty local checkout is rejected by default; --allow-dirty-pipeline is an explicit development-only opt-in that is recorded in provenance. Use --require-local-pipeline when fallback to the remote pipeline would be unacceptable.
  1. Samplesheet validation (samplesheet_builder.py): Parse the CSV, resolve FASTQ paths relative to the CSV parent directory, normalize sample-name whitespace to underscores, verify readability and FASTQ extensions, reject FASTQ basenames with whitespace, enforce consistent expected_cells (≥1) and seq_center for repeated sample rows, reject exact duplicate FASTQ rows, and write a normalized copy to reproducibility/samplesheet.valid.csv with local FASTQ paths resolved to absolute POSIX (remote URIs, accepted only with --allow-remote-inputs, are passed through unchanged). The normalized replay sheet contains only headers accepted by the pinned 4.1.0 assets/schema_input.json; unsupported metadata columns are reported and omitted. In particular, protocol is supplied through the global --protocol parameter and is never forwarded as a samplesheet column.
  1. Preflight (preflight.py): Verify Java (≥17) and Nextflow (≥25.04.0). Compare version tuples after zero-padding to 3 elements (avoids false negatives such as (24, 4) < (24, 4, 0)). For docker, run docker info and gate on exit code. For conda/mamba, locate the binary. Cell Ranger presets are rejected with conda/mamba unless --allow-conda-cellranger is supplied with a trusted site config. For singularity/apptainer, accept either binary interchangeably. For wave and gpu, no binary check is needed (Nextflow-native features). Safe institutional profile components are accepted for HPC/site profiles, every -c/--config file must exist before execution, and configs are treated as trusted Groovy code. All preflight subprocess calls have a 60-second timeout (_SUBPROCESS_TIMEOUT in preflight.py); the git probes in pipeline_source.py use a 10-second timeout.
  1. Params construction (params_builder.py): Translate the preset + CLI flags into a params.yaml consumed by Nextflow via -params-file. All file paths use .as_posix() for forward-slash consistency across platforms. igenomes_ignore is automatically set to true whenever an explicit genome reference (fasta, gtf, transcript_fasta, txp2gene, or any prebuilt index) is provided — auxiliary files (barcode whitelist, CMO/probe/feature sets, primers, multi-barcode samplesheets) never trigger it, so they remain compatible with --genome (suppresses nf-schema DNS validation of the default iGenomes S3 URL). Skip flags are only written when true, keeping params.yaml minimal. In --demo mode no reference/protocol params are written at all (the test profile owns them).
  1. Command build + execution (command_builder.py, executor.py): Construct the nextflow run command with -params-file, validated -c/--config files, and a work directory that defaults to <output>/upstream/work but may be overridden by --work-dir (including object-store URIs for cloud executors), then launch via subprocess.Popen with stdout and stderr piped to log files on disk — never buffered in RAM. On TimeoutExpired, the process is killed and EXECUTION_FAILED is raised. On KeyboardInterrupt, the child process tree is terminated before the interrupt is re-raised.
  1. Output parsing (outputs_parser.py): Scan the upstream results tree for MultiQC HTML, pipeline_info/, aligner output directories, .h5ad (CellBender/filtered preferred over generic combined/raw), .rds, CellBender-derived files, and an official_outputs manifest for documented nf-core output families. Required outputs are validated before success artifacts are written; handoff_available is set to true only when a preferred_h5ad is confirmed on disk.
  1. Provenance + reporting (provenance.py, reporting.py): Write JSON provenance bundles, a SHA-256 checksum manifest (files only — never directories), environment.yml, a portable commands.sh, report.md, and result.json.

Presets

| Preset | Aligner | Use case |

|--------|---------|---------|

| standard | simpleaf (alevin-fry) | Default for 10x GEX; fast, memory-efficient |

| star | STARsolo | Best FASTQ QC metrics; supports RNA velocity (--star-feature "Gene Velocyto") |

| kallisto | kb-python / BUStools | Pseudo-alignment; fastest; lamanno/nac RNA velocity via --kb-workflow |

| cellranger | CellRanger | CellRanger v2/v3 compatibility; CellRanger is provided by the nf-core container under docker/singularity (no host binary needed). Not available under -profile conda (10x licensing keeps it off bioconda) |

| cellrangerarc | CellRanger ARC | Multiome (GEX + ATAC); accepts prebuilt --cellranger-index or reference-build inputs |

| cellrangermulti | CellRanger Multi | GEX + VDJ + feature barcoding; --cellranger-multi-barcodes required for CMO/FFPE multiplexing |

Each preset requires at least one reference option: --genome <iGenomes_shortcut> OR a pre-built index (--star-index, --simpleaf-index, etc.) OR --fasta + --gtf. The standard/simpleaf preset additionally accepts a transcriptome pair --transcript-fasta + --txp2gene in place of a genome reference (per the nf-core/scrnaseq Simpleaf options).

nf-core/scrnaseq 4.1.0 Compatibility Policy

This wrapper targets nf-core/scrnaseq 4.1.0. It is not a free-form passthrough. Parameters are grouped as:

Unsupported parameters are either hidden/institutional metadata, interactive help/version flags, or options that would weaken the wrapper's fixed validation/reproducibility policy.

Input & Reference Path Policy

Local-first by default. Samplesheet FASTQs and reference/index inputs must be local paths unless you explicitly opt in. Remote URIs (s3://, gs://, https://, ftp://, …) are rejected at preflight with REMOTE_INPUT_NOT_ALLOWED, so genetic data and references stay on the local machine and no accidental cloud fetch happens. This guarantee is enforced by the code, not just advertised (preflight._check_remote_inputs).

Opt-in for remote inputs. Pass --allow-remote-inputs to permit remote samplesheet inputs and reference paths (parity with nfcore-sarek-wrapper / nfcore-rnaseq-wrapper, which share the same flag). When enabled, remote URIs are passed through verbatim (Nextflow resolves and stages them; only the FASTQ/FASTA basename is validated) and preflight emits a runtime WARNING listing every path that will be fetched over the network, so cloud access is always visible. The object-store --work-dir is a separate setting and is not gated.

Local paths are still validated eagerly at preflight so they fail fast with a clear error instead of a late Nextflow error:

Readability is never pre-checked: Nextflow reads inputs in the true execution context (often a root container under the default Docker profile), so a launcher-side os.access(R_OK) probe would false-block valid runs (errors.py).

CLI Reference

# Standard real-data usage (explicit protocol and reference are required)
python skills/nfcore-scrnaseq-wrapper/nfcore_scrnaseq_wrapper.py \
  --input samplesheet.csv --output ./scrnaseq_run \
  --preset star --protocol 10XV3 --genome GRCh38

# Preflight check only (no Nextflow execution)
python skills/nfcore-scrnaseq-wrapper/nfcore_scrnaseq_wrapper.py \
  --input samplesheet.csv --output ./scrnaseq_run --check \
  --preset star --protocol 10XV3 --genome GRCh38

# Demo mode (runs the upstream nf-core test profile; forces star preset; uses the
# selected backend — default --profile docker, which must be running)
python skills/nfcore-scrnaseq-wrapper/nfcore_scrnaseq_wrapper.py \
  --demo --output ./scrnaseq_demo

# Via ClawBio runner
python clawbio.py run scrnaseq-pipeline --input samplesheet.csv --output ./scrnaseq_run \
  --preset star --protocol 10XV3 --genome GRCh38
python clawbio.py run scrnaseq-pipeline --demo --output ./scrnaseq_demo

# STARsolo with local FASTA+GTF (STAR index built by the pipeline)
python skills/nfcore-scrnaseq-wrapper/nfcore_scrnaseq_wrapper.py \
  --input samplesheet.csv --output ./run --preset star --protocol 10XV3 \
  --fasta /refs/hg38.fa --gtf /refs/hg38.gtf

# STARsolo with prebuilt STAR index
python skills/nfcore-scrnaseq-wrapper/nfcore_scrnaseq_wrapper.py \
  --input samplesheet.csv --output ./run --preset star --protocol 10XV3 \
  --star-index /refs/star_index

# STARsolo RNA velocity (star requires an explicit --protocol like every star/standard/kallisto run)
python skills/nfcore-scrnaseq-wrapper/nfcore_scrnaseq_wrapper.py \
  --input samplesheet.csv --output ./run --preset star --protocol 10XV3 \
  --star-feature "Gene Velocyto" --star-ignore-sjdbgtf \
  --fasta /refs/hg38.fa --gtf /refs/hg38.gtf

# Simpleaf (standard) with UMI resolution override
python skills/nfcore-scrnaseq-wrapper/nfcore_scrnaseq_wrapper.py \
  --input samplesheet.csv --output ./run --preset standard --protocol 10XV3 \
  --simpleaf-umi-resolution cr-like-em --genome GRCh38

# Kallisto RNA velocity (NAC workflow)
python skills/nfcore-scrnaseq-wrapper/nfcore_scrnaseq_wrapper.py \
  --input samplesheet.csv --output ./run --preset kallisto --protocol 10XV3 \
  --kb-workflow nac --fasta /refs/hg38.fa --gtf /refs/hg38.gtf

# Air-gapped cluster: local iGenomes mirror
python skills/nfcore-scrnaseq-wrapper/nfcore_scrnaseq_wrapper.py \
  --input samplesheet.csv --output ./run --preset star --protocol 10XV3 \
  --genome GRCh38 --igenomes-base /mnt/local_igenomes

# CellRanger Multi (CMO multiplexing)
python skills/nfcore-scrnaseq-wrapper/nfcore_scrnaseq_wrapper.py \
  --input samplesheet.csv --output ./run --preset cellrangermulti \
  --cellranger-index /refs/refdata-gex-GRCh38 \
  --gex-cmo-set /refs/cmo_set.csv \
  --cellranger-multi-barcodes /refs/multi_barcodes.csv

Key flags

| Flag | Type | Default | Description |

|------|------|---------|-------------|

| --input | path | — | Samplesheet CSV (sample,fastq_1,fastq_2). Required unless --demo |

| --output | path | — | Output directory for results and the reproducibility bundle (required) |

| --demo | flag | — | Run the upstream nf-core test profile; forces --preset star and skip_cellbender |

| --check | flag | — | Run preflight only and exit (no Nextflow execution); check_result.json lists the nf-core parameter surface under parameter_support (supported upstream, wrapper policy, and intentionally unsupported parameters) |

| --preset | string | standard | Aligner preset |

| --aligner | string | — | nf-core/scrnaseq aligner alias for --preset: simpleaf maps to standard; the other values map to same-named presets |

| --profile | string | docker | Execution backend or comma-separated nf-core profile list: docker, conda, mamba, singularity, apptainer, podman, shifter, charliecloud, wave, gpu, debug, arm64, emulate_amd64, test, test_full, test_cellrangermulti, test_multiome |

| --pipeline-version | string | 4.1.0 | Remote nf-core/scrnaseq tag or commit (used when no local sibling checkout is found) |

| --allow-dirty-pipeline | flag | — | Development-only opt-in to run a modified local sibling scrnaseq/ checkout; rejected by default for production reproducibility |

| --require-local-pipeline | flag | — | Require a verifiable local sibling scrnaseq/ checkout; fail instead of falling back to the remote pipeline |

| --allow-pipeline-version-override | flag | — | Allow a --pipeline-version other than the pinned 4.1.0 contract (warned, recorded in provenance; validations stay 4.1.0) |

| --trust-config-params | flag | — | Allow -c/--config files that set params.* (otherwise blocked); detected overrides are recorded in provenance |

| -c / --config | path | — | Additional Nextflow config file. May be repeated; files are validated, applied to the live run, copied into the reproducibility bundle, and replayed by commands.sh |

| --protocol | string | None | Chemistry/protocol forwarded to the aligner. Required for standard, star, and kallisto; omitted only preserves CellRanger auto-detection for cellranger, cellrangerarc, and cellrangermulti. Explicit auto is invalid for standard, star, and kallisto. smartseq is valid for star and kallisto only. Other protocol strings are mapped when known or passed through by nf-core |

| --genome | string | — | iGenomes shortcut (GRCh38, mm10, etc.) — mutually exclusive with --fasta/--gtf and all index flags |

| --igenomes-base | string | — | Base URL or local path for iGenomes (default s3://ngi-igenomes/igenomes/). Use for local mirrors or air-gapped clusters. A local base path is existence-checked in preflight when --genome is set (remote s3:///https:// bases are deferred to Nextflow) |

| --igenomes-ignore | flag | — | Do not load the iGenomes reference config. Set automatically whenever an explicit genome reference is supplied; only needed manually in unusual setups |

| --fasta | path | — | Genome FASTA (.fa, .fna, .fasta, .gz variants; no whitespace in path) |

| --gtf | path | — | Gene annotation GTF |

| --star-index | path | — | Prebuilt STAR genome index directory |

| --simpleaf-index | path | — | Prebuilt simpleaf/alevin-fry index |

| --kallisto-index | path | — | Prebuilt kallisto index |

| --cellranger-index | path | — | Prebuilt CellRanger or CellRanger ARC reference |

| --transcript-fasta | path | — | Transcriptome FASTA for simpleaf |

| --txp2gene | path | — | Transcript-to-gene mapping for simpleaf |

| --barcode-whitelist | path | — | Custom barcode whitelist (per-aligner format) |

| --star-feature | enum | — | STARsolo feature type: Gene, GeneFull, Gene Velocyto |

| --star-ignore-sjdbgtf | flag | — | Do not use GTF for SJDB construction (required for Gene Velocyto) |

| --seq-center | string | — | Sequencing center name for BAM read group tag |

| --simpleaf-umi-resolution | enum | — | UMI resolution strategy for alevin-fry: cr-like, cr-like-em, parsimony, parsimony-em, parsimony-gene, parsimony-gene-em |

| --kb-workflow | enum | — | Kallisto workflow: standard, lamanno, nac |

| --kb-t1c | path | — | cDNA transcripts-to-capture file for RNA velocity (lamanno/nac). Required only with a prebuilt --kallisto-index; auto-generated from --fasta/--gtf |

| --kb-t2c | path | — | Intron transcripts-to-capture file for RNA velocity (lamanno/nac). Required only with a prebuilt --kallisto-index; auto-generated from --fasta/--gtf |

| --skip-cellbender | flag | — | Disable the CellBender ambient RNA removal subworkflow |

| --skip-emptydrops | flag | — | Deprecated compatibility alias for --skip-cellbender; the wrapper writes skip_cellbender: true and never writes deprecated upstream skip_emptydrops |

| --skip-fastqc | flag | — | Skip FastQC quality control |

| --skip-multiqc | flag | — | Skip MultiQC report generation |

| --skip-cellranger-renaming | flag | — | Skip automatic sample renaming in CellRanger modules |

| --skip-cellrangermulti-vdjref | flag | — | Skip mkvdjref in cellrangermulti (when VDJ data is absent or a prebuilt --cellranger-vdj-index is supplied) |

| --save-reference | flag | — | Save the built reference index for future reuse |

| --save-align-intermeds / --no-save-align-intermeds | flag | — | Forward save_align_intermeds: true/false; when neither is given the upstream nf-core/scrnaseq 4.1.0 default (true) is preserved, so intermediate BAMs are published by default — pass --no-save-align-intermeds on large runs to save disk |

| --expected-cells | int | — | Override expected cell count for a single-sample samplesheet; multi-sample runs must set expected_cells per row. The wrapper enforces ≥1 (stricter than the upstream integer schema, which has no minimum) since a non-positive count is meaningless |

| --timeout-hours | float | 12 | Wall-clock cap for the Nextflow run, in hours. Use 0 to disable the cap for long HPC/cloud runs whose walltime is enforced by the scheduler. Via the ClawBio runner the runner's own timeout also applies |

| --work-dir | string | <output>/upstream/work | Nextflow work directory. Local paths are resolved before execution; object-store URIs such as s3://... or gs://... are passed through for cloud executors |

| --allow-conda-cellranger | flag | — | Allow Cell Ranger presets with conda/mamba only when a trusted site config supplies Cell Ranger |

| --email | string | — | Email address for pipeline completion notification |

| --email-on-fail | string | — | Email address for pipeline failure notification |

| --multiqc-title | string | — | Custom title for the MultiQC report |

| --multiqc-config | path | — | Custom MultiQC config YAML |

| --multiqc-logo | path | — | Custom MultiQC logo image |

| --multiqc-methods-description | path | — | Custom MultiQC methods-description YAML |

| --publish-dir-mode | enum | — | Forwarded nf-core publish mode: symlink, rellink, link, copy, copyNoFollow, or move |

| --trace-report-suffix | string | — | Suffix for Nextflow trace/report/timeline filenames |

| --monochrome-logs | flag | — | Disable ANSI colors in nf-core logs |

| --resume | flag | — | Nextflow resume (checksum-verified against prior manifest; preset/profile/source/work-dir must match) |

| --run-downstream | flag | — | Opt in to scrna_orchestrator handoff after pipeline completion |

| --skip-downstream | flag | — | Force-skip the downstream handoff even if --run-downstream is given (handoff is off by default) |

| --cellrangerarc-config | path | — | Config JSON for CellRanger ARC index construction |

| --cellrangerarc-reference | string | — | Reference genome name used inside the CellRanger ARC config |

| --motifs | path | — | Motif file (e.g. JASPAR) for CellRanger ARC |

| --cellranger-vdj-index | path | — | Prebuilt CellRanger VDJ reference |

| --gex-frna-probe-set | path | — | Probe set CSV for FFPE fixed RNA profiling (cellrangermulti) |

| --gex-target-panel | path | — | Target panel CSV for targeted GEX (cellrangermulti) |

| --gex-cmo-set | path | — | CMO reference CSV for multiplexed samples (cellrangermulti) |

| --gex-barcode-sample-assignment | path | — | Barcode-to-sample assignment override CSV (cellrangermulti). Not an OCM selector — OCM mode is encoded via the ocm_ids column of --cellranger-multi-barcodes |

| --fb-reference | path | — | Feature-barcode reference CSV for antibody capture (cellrangermulti) |

| --vdj-inner-enrichment-primers | path | — | V(D)J cDNA enrichment primer sequences (cellrangermulti) |

| --cellranger-multi-barcodes | path | — | Multiplexed sample samplesheet for CMO/FFPE demultiplexing (cellrangermulti) |

Output Structure

output_directory/
├── report.md                         # Wrapper run summary
├── result.json                       # Structured result payload
├── check_result.json                 # Written only with --check (preflight-only mode); no upstream/ is produced
├── logs/
│   ├── stdout.txt                    # Nextflow stdout
│   └── stderr.txt                    # Nextflow stderr
├── upstream/
│   └── results/                      # nf-core/scrnaseq output tree
│       ├── fastqc/                   # Per-read FastQC reports
│       ├── multiqc/                  # MultiQC HTML and data
│       │   └── multiqc_report.html
│       ├── pipeline_info/            # Execution report, timeline, trace, DAG
│       └── <aligner>/                # Aligner-specific outputs
│           └── mtx_conversions/      # AnnData (.h5ad), SCE (.rds), Seurat (.rds)
│               │  # Per nf-core/scrnaseq 4.1.0 conf/modules.config, the concatenated
│               │  # matrices sit at the TOP of mtx_conversions/ while each per-sample
│               │  # matrix is nested one level deeper under <sample>/ (MTX_TO_H5AD/
│               │  # CONCAT_H5AD/ANNDATA_BARCODES rewrite non-combined files to
│               │  # `${meta.id}/${filename}`). The wrapper scans BOTH depths and does
│               │  # not hard-code filenames: it ranks whatever .h5ad it finds to pick
│               │  # one preferred_h5ad (combined > per-sample; within a group
│               │  # cellbender_filter > filtered > plain > raw, matched on the filename
│               │  # suffix). combined_* filter-suffixed variants are version-dependent.
│               ├── combined_matrix.h5ad                       # documented concatenated matrix (top level)
│               ├── combined_filtered_matrix.h5ad              # version-dependent: filtering ran
│               ├── combined_cellbender_filter_matrix.h5ad     # version-dependent: CellBender ran → top preference
│               └── <sample>/                                  # per-sample matrices nested one level deeper
│                   ├── <sample>_raw_matrix.h5ad
│                   └── <sample>_filtered_matrix.h5ad          # conditional: filtering ran
├── reproducibility/                  # Reproducibility + provenance bundle (single directory)
│   ├── samplesheet.valid.csv         # Normalized samplesheet (absolute POSIX paths); named samplesheet.demo.csv with --demo
│   ├── params.yaml                   # Effective Nextflow parameters
│   ├── nextflow_configs/             # Written only when -c/--config is used: copies of the supplied config files, replayed by commands.sh
│   ├── commands.sh                   # Portable replay script
│   ├── environment.yml               # Conda environment spec (for reference)
│   ├── checksums.sha256              # SHA-256 for in-bundle artifacts only; `sha256sum -c` passes from output dir
│   ├── manifest.json                 # Run metadata: preset, profile, versions, checksums
│   ├── macos_docker.config           # macOS+Docker workarounds (VirtioFS, ARM64, STAR FIFOs)
│   ├── remap_paths.py                # Helper for replaying on a different machine
│   ├── compatibility_policy.json     # Copied policy snapshot (resume/update rules)
│   ├── pinned_versions.json          # Copied pinned-versions snapshot
│   ├── inputs.json                   # Samplesheet + fastq/reference paths and digests (reference_checksums)
│   ├── invocation.json               # Timestamp, preset, profile, pipeline version
│   ├── preflight.json                # Java/Nextflow/backend info
│   ├── upstream.json                 # Pipeline source resolution details
│   ├── outputs.json                  # Detected artifacts
│   ├── runtime.json                  # Execution timing
│   └── skill.json                    # Skill name and version
├── provenance/                       # Written only with --run-downstream
│   └── handoff.json                  # Downstream orchestrator path + checksum + outcome
└── scrna_analysis/                   # Written only with --run-downstream: scrna_orchestrator output

Example Output

result.json (abbreviated):

{
  "skill": "scrnaseq-pipeline",
  "version": "0.1.0",
  "summary": {
    "preset": "star",
    "aligner_effective": "star",
    "pipeline_source_kind": "remote_repo",
    "pipeline_version_or_commit": "4.1.0",
    "profile": "docker",
    "preferred_h5ad": "<output>/upstream/results/star/mtx_conversions/combined_filtered_matrix.h5ad",
    "handoff_available": true,
    "samples_detected": 2,
    "cellbender_used": false
  }
}

report.md closes with:

## Next Steps
- python clawbio.py run scrna --input <preferred_h5ad> --output <dir>
- python clawbio.py run scrna-embedding --input <preferred_h5ad> --output <dir>

Gotchas

Safety

Reproducibility Scope

The bundle guarantees configuration- and provenance-level reproducibility, not bit-for-bit identical scientific results. Be explicit about the boundary:

Guaranteed (captured in the bundle):

NOT guaranteed (outside the wrapper's control):

To approach bit-level reproduction: use docker/singularity (not conda), pin container digests, fix tool seeds where the pipeline allows, and archive the exact reference files alongside the bundle.

Agent Boundary

The agent dispatches and explains; this skill executes.

Agent: Interpret the user's preprocessing intent, choose the preset, and verify that handoff_available is true in result.json before routing to downstream skills.

Skill: Validate environment and inputs, run the pipeline with controlled parameters, write all provenance and reproducibility artifacts, and report the detected preferred_h5ad.

Chaining Partners

| Skill | When to chain |

|-------|--------------|

| scrna-orchestrator | After a successful run, pass preferred_h5ad for clustering, QC, and markers |

| scrna-embedding | Pass preferred_h5ad for scVI/scANVI batch integration and latent embeddings |

| multiqc-reporter | Re-aggregate QC across multiple wrapper runs |

Maintenance

Review cadence: After each nf-core/scrnaseq major release. Check NEXTFLOW_MIN_VERSION (schemas.py), SUPPORTED_PRESETS, SUPPORTED_PROFILES, and this SKILL.md for accuracy.

Staleness signals:

Deprecation criteria: Deprecate if nf-core/scrnaseq releases a Python SDK with equivalent preflight, params, and provenance APIs.

Citations

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.