$npx -y skills add K-Dense-AI/scientific-agent-skills --skill bulk-rnaseqEnd-to-end bulk RNA-seq orchestrator — takes raw FASTQ reads through QC and trimming (FastQC, fastp/Trim Galore), alignment and quantification (STAR, Salmon, featureCounts), assembles a gene-level counts matrix, then hands off to differential expression (pydeseq2), pathway/GSEA e
| 1 | # Bulk RNA-seq |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | This skill orchestrates a complete, **defensible** bulk RNA-seq differential-expression study, from raw sequencing reads to enriched pathways and figures. It is a router, not a reimplementation: most stages already have dedicated skills in this repo, and this skill connects them in the right order, fills the one real gap (raw reads → a gene-level counts matrix), and enforces the design and QC decisions that determine whether the final result is trustworthy. |
| 6 | |
| 7 | "Defensible" means three things, applied throughout: |
| 8 | - **Reproducible** — pinned pipeline/tool versions, containers where possible, recorded parameters, fixed random seeds. |
| 9 | - **Quality-gated** — QC is inspected and acted on before, during, and after quantification, not skipped. |
| 10 | - **Statistically sound** — adequate replication, a design that matches the biology, counts handled correctly, and FDR-controlled testing. |
| 11 | |
| 12 | The pipeline is: **FastQC/trim → align/quant (STAR/Salmon) → counts → DE (pydeseq2) → enrichment (pathway-enrichment) → figures**. |
| 13 | |
| 14 | ## When to Use This Skill |
| 15 | |
| 16 | Use this skill when the user wants to: |
| 17 | - Go from FASTQ files (or a sequencing run) to differentially expressed genes and pathways. |
| 18 | - Run or configure `nf-core/rnaseq`, or align/quantify with STAR, Salmon, or featureCounts. |
| 19 | - Turn Salmon/STAR/featureCounts output into a counts matrix ready for DESeq2/PyDESeq2. |
| 20 | - Design or sanity-check a bulk RNA-seq experiment (replicates, batch, strandedness) before committing compute. |
| 21 | - Scope an end-to-end RNA-seq analysis and decide which tools and skills to chain. |
| 22 | |
| 23 | This is **bulk** RNA-seq (samples = biological specimens). For single-cell/nuclei data use `scanpy`; for the DE statistics alone use `pydeseq2`; for enrichment alone use `pathway-enrichment`. |
| 24 | |
| 25 | ## The Pipeline at a Glance |
| 26 | |
| 27 | ```mermaid |
| 28 | flowchart TD |
| 29 | fastq["Raw FASTQ + samplesheet"] --> qc["FastQC + MultiQC"] |
| 30 | qc --> trim["Trim: fastp / Trim Galore"] |
| 31 | trim --> align["Align + quant: STAR and/or Salmon"] |
| 32 | align --> counts["Gene-level counts matrix"] |
| 33 | counts --> de["Differential expression"] |
| 34 | de --> enrich["Pathway / GSEA enrichment"] |
| 35 | de --> fig["Figures"] |
| 36 | enrich --> fig |
| 37 | nfcore["nf-core/rnaseq via nextflow skill"] -.->|"path A"| align |
| 38 | manual["Standalone recipes (this skill)"] -.->|"path B"| align |
| 39 | bridge["build_counts_matrix.py (this skill)"] -.-> counts |
| 40 | pydeseq2skill["pydeseq2 skill"] -.-> de |
| 41 | pwskill["pathway-enrichment skill"] -.-> enrich |
| 42 | vizskill["scientific-visualization skill"] -.-> fig |
| 43 | ``` |
| 44 | |
| 45 | ## Two Upstream Paths — Pick One |
| 46 | |
| 47 | The reads → counts stage can be run two ways. They produce equivalent gene counts; choose by context, then stay on that path. |
| 48 | |
| 49 | | Use **Path A — `nf-core/rnaseq`** when… | Use **Path B — standalone tools** when… | |
| 50 | |------------------------------------------|------------------------------------------| |
| 51 | | You want the field-standard, audited, citable pipeline with one command | You have a few samples and want to learn/inspect each step | |
| 52 | | Many samples, or you'll scale to HPC/cloud | No Nextflow/containers available, or a constrained environment | |
| 53 | | Reproducibility and a full MultiQC report matter most | You need a non-standard step the pipeline doesn't expose | |
| 54 | | → Drive it through the **`nextflow`** skill | → Follow `references/upstream-manual.md` | |
| 55 | |
| 56 | When unsure, prefer **Path A**: `nf-core/rnaseq` already wires together FastQC → trimming → STAR/Salmon → quantification → tximport → MultiQC with sensible, reviewed defaults, which is the most defensible option. Path B exists for transparency and constrained setups. |
| 57 | |
| 58 | Both paths converge on a **gene-level counts matrix**, after which the workflow is identical. |
| 59 | |
| 60 | ## Setup |
| 61 | |
| 62 | ```bash |
| 63 | # This skill's glue (bridge + handoffs) — Python |
| 64 | uv pip install pytximport pandas |
| 65 | |
| 66 | # Downstream skills install their own deps: |
| 67 | # pydeseq2 skill -> uv pip install pydeseq2 |
| 68 | # pathway-enrichment skill -> uv pip install gseapy gprofiler-official |
| 69 | |
| 70 | # Path A (nf-core): on |