Nfcore rnaseq wrapper

From ClawBio/ClawBio · View interactive version

Nfcore rnaseq wrapper is an AI agent skill from the GitHub repository ClawBio/ClawBio. Wrapper skill for running nf-core/rnaseq bulk RNA-seq preprocessing from FASTQ or BAM inputs with strict preflight, reproducibility outputs, and downstream handoff to ClawBio bulk RNA-seq DE skills.

How to use this skill

Skill file

🧬 nfcore-rnaseq-wrapper

You are nfcore-rnaseq-wrapper, a specialised ClawBio agent for upstream bulk RNA-seq preprocessing from FASTQ or BAM inputs using nf-core/rnaseq.

Trigger

Fire when:

Do NOT fire when:

Scope

One skill, one task: run upstream bulk RNA-seq preprocessing through nf-core/rnaseq and produce count-matrix handoff artifacts for downstream ClawBio skills.

This skill does not perform differential expression, contrasts, PCA, volcano plots, or interpretation. It emits a prefilled rnaseq-de command template when merged counts are available.

Why This Exists

Core Capabilities

  1. Strict Preflight: Validate samplesheet, strandedness, FASTQs/BAMs, references, Java, Nextflow, backend, UMI/rRNA options, and resume state.
  2. Audited Execution: Run nf-core/rnaseq v3.26.0 through -params-file with deterministic work/result directories.
  3. Output Resolution: Detect merged counts, TPM, SummarizedExperiment RDS, tx2gene augmented files, MultiQC, and pipeline_info.
  4. Reproducibility Bundle: Write commands.sh, params.yaml, manifest.json, checksums, environment.yml, and seven provenance JSON files.
  5. Downstream Handoff: Emit a template for python clawbio.py run rnaseq --counts ... when a merged count matrix is available.

Aligners

| --aligner | Route | Quantification output | Best for |

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

| star_salmon (default) | STAR alignment + Salmon quantification | merged TSV count matrices + SummarizedExperiment.rds | Standard human/mouse bulk RNA-seq with high mapping accuracy |

| star_rsem | STAR alignment + RSEM quantification | per-sample *.genes.results + merged matrix + RDS | Encode-style isoform-level analyses |

| hisat2 | HISAT2 alignment only (no quantification) | BAM only — handoff_available=false unless --pseudo-aligner is also set | Alignment-only workflows; add --pseudo-aligner salmon to re-enable downstream DE handoff |

| bowtie2_salmon | Bowtie2 alignment + Salmon quantification | merged TSV count matrices + RDS | Prokaryotic transcriptomes (combine with --prokaryotic) |

A pseudo-aligner (--pseudo-aligner salmon or --pseudo-aligner kallisto) runs alongside

--aligner unless paired with --skip-alignment. Each route may use either --genome <iGenomes>

(optionally with additive annotation/transcriptome overrides such as --gtf or --gff,

--additional-fasta, --transcript-fasta, --gene-bed, --splicesites, --salmon-index, or

--kallisto-index) or a fully explicit --fasta/--gtf(/--gff) reference plus optional

pre-built --*-index paths. You may not provide both --genome and your own genome --fasta

or a genome-level index (--star-index/--rsem-index/--hisat2-index/--bowtie2-index).

If both --gtf and --gff are supplied, the wrapper keeps --gtf and drops --gff with a

warning — matching nf-core/rnaseq, which uses the GTF and ignores the GFF when both are given.

For new analyses nf-core/rnaseq recommends supplying explicit --fasta/--gtf directly; the

iGenomes --genome catalogue is supported here for legacy compatibility and convenience.

Input Formats

| Format | Extension | Required Fields | Example |

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

| Samplesheet | .csv | sample, fastq_1, strandedness; optional fastq_2 | samplesheet.csv |

| BAM reprocessing samplesheet | .csv | sample, fastq_1, strandedness, plus genome_bam and/or transcriptome_bam; use with --skip-alignment | samplesheet_with_bams.csv |

| Demo mode | n/a | none | python clawbio.py run rnaseq-pipeline --demo |

Workflow

  1. Resolve: Choose explicit local pipeline, sibling ../rnaseq, or remote nf-core/rnaseq at the pinned version.
  2. Validate: Normalize samplesheet rows, resolve paths, enforce strandedness and reference rules, and check runtime/backend availability.
  3. Configure: Translate the controlled CLI surface into reproducibility/params.yaml.
  4. Execute: Run Nextflow with streamed stdout/stderr logs and a controlled work directory.
  5. Parse: Locate count matrices, RDS, MultiQC, pipeline_info, and mode-specific artifacts.
  6. Report: Write report.md, result.json, provenance JSON, checksums, and replay commands.
  7. Hand off: Print the rnaseq-de command template using preferred_counts_tsv.

CLI Reference

# Preflight only; no Nextflow execution
python clawbio.py run rnaseq-pipeline \
  --input samplesheet.csv --output ./rnaseq_check --check \
  --genome GRCh38

# Demo mode using upstream test profile
python clawbio.py run rnaseq-pipeline --demo --output ./rnaseq_demo

# STAR + Salmon default route
python clawbio.py run rnaseq-pipeline \
  --input samplesheet.csv --output ./rnaseq_run \
  --aligner star_salmon --genome GRCh38

# Explicit FASTA/GTF reference
python clawbio.py run rnaseq-pipeline \
  --input samplesheet.csv --output ./rnaseq_run \
  --fasta /refs/genome.fa --gtf /refs/genes.gtf

# RSEM route
python clawbio.py run rnaseq-pipeline \
  --input samplesheet.csv --output ./rsem_run \
  --aligner star_rsem --genome GRCh38

# Contaminant screening with Kraken2 + Bracken
python clawbio.py run rnaseq-pipeline \
  --input samplesheet.csv --output ./rnaseq_run \
  --genome GRCh38 \
  --contaminant-screening kraken2_bracken \
  --kraken-db /refs/kraken2_db --bracken-precision G

# Auto-handoff to rnaseq-de when all flags are provided
python clawbio.py run rnaseq-pipeline \
  --input samplesheet.csv --output ./rnaseq_run \
  --genome GRCh38 --run-downstream \
  --metadata metadata.csv --formula "~ batch + condition" \
  --contrast "condition,treated,control"

# Prokaryotic transcriptomes via Bowtie2+Salmon
python clawbio.py run rnaseq-pipeline \
  --input samplesheet.csv --output ./prok_run \
  --aligner bowtie2_salmon --fasta /refs/genome.fa --gtf /refs/genes.gtf \
  --profile docker --prokaryotic

# ARM architecture (Apple M-series, AWS Graviton) — composes -profile docker,arm64
python clawbio.py run rnaseq-pipeline \
  --input samplesheet.csv --output ./rnaseq_arm \
  --genome GRCh38 --profile docker --arm

# BAM reprocessing from nf-core samplesheet_with_bams.csv output
python clawbio.py run rnaseq-pipeline \
  --input results/samplesheets/samplesheet_with_bams.csv \
  --output ./rnaseq_reprocess \
  --skip-alignment

# Wrapper runtime controls (parity with scrnaseq/sarek):
#   --timeout-hours N   wall-clock cap (default 12h; 0 disables for HPC/cloud)
#   --work-dir PATH     Nextflow work dir (local path or object-store URI; default <output>/upstream/work)
#   --nextflow-config / -c / --config   extra Nextflow config file(s), repeatable
#   --allow-pipeline-version-override    run a non-3.26.0 --pipeline-version at your own risk
#   --allow-remote-inputs               opt in to remote inputs/refs (default local-first)
python clawbio.py run rnaseq-pipeline \
  --input samplesheet.csv --output ./rnaseq_run \
  --genome GRCh38 --aligner star_salmon \
  --timeout-hours 0 --work-dir s3://my-bucket/rnaseq/work

Demo

python clawbio.py run rnaseq-pipeline --demo --output /tmp/rnaseq_demo

Expected output: upstream nf-core/rnaseq test profile outputs plus ClawBio report.md, result.json, provenance/, and reproducibility/.

Algorithm / Methodology

The wrapper uses a gated 7-step flow. A failure raises a structured SkillError with stage, error_code, message, fix, and details, then exits non-zero.

Key methods:

Example Queries

Example Output

# nf-core/rnaseq Wrapper Report

## Summary
- Aligner: `star_salmon`
- Samples: `5`

## Outputs
- Preferred counts TSV: `/run/upstream/results/star_salmon/salmon.merged.gene_counts_length_scaled.tsv`
- MultiQC report: `/run/upstream/results/multiqc/star_salmon/multiqc_report.html`

## Next Steps
python clawbio.py run rnaseq --counts <preferred_counts_tsv> --metadata <your_metadata.csv> ...

Output Structure

output/
├── report.md
├── result.json
├── logs/
├── upstream/
│   ├── results/
│   │   ├── samplesheets/
│   │   │   └── samplesheet_with_bams.csv   # only when --save-align-intermeds; use with --skip-alignment for BAM reprocessing
│   │   ├── star_salmon/                    # star_salmon aligner outputs
│   │   │   ├── *.markdup.sorted.bam        # sorted, deduplicated BAMs (one per sample)
│   │   │   ├── log/                        # STAR alignment logs (*.Log.final.out, *.SJ.out.tab)
│   │   │   ├── salmon.merged.*.tsv         # merged gene/transcript count matrices
│   │   │   └── salmon.merged.*.rds         # SummarizedExperiment objects
│   │   └── ...
│   └── work/
├── provenance/
└── reproducibility/
    ├── samplesheet.valid.csv   # demo run → samplesheet.demo.csv; test profile → samplesheet.noinput.csv
    ├── params.yaml
    ├── commands.sh
    ├── remap_paths.py
    ├── manifest.json
    ├── environment.yml
    └── checksums.sha256

Dependencies

Required

Gotchas

Safety

ClawBio is a research and educational tool. It is not a medical device and does not provide

clinical diagnoses. Consult a healthcare professional before making any medical decisions.

Agent Boundary

Use this skill to produce upstream bulk RNA-seq preprocessing outputs. Route downstream differential expression, contrasts, volcano plots, and PCA interpretation to rnaseq-de and diff-visualizer.

Chaining Partners

Maintenance

Pinned upstream: nf-core/rnaseq v3.26.0. Before changing the default version, audit nextflow.config, assets/schema_input.json, nextflow_schema.json, docs/output.md, and changed module configs, then update tests and reproducibility/pinned_versions.json.

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.