RNA-Seq: From FASTQ to BAM and Count Tables

A modular Nextflow workflow for preprocessing, reference alignment and gene-, exon- and transcript-level quantification.

Purpose

This pipeline takes RNA-Seq FASTQ files and a reference genome through preprocessing and STAR alignment, producing alignment files (BAM) and count tables. It packages the core steps in a modular Nextflow workflow, with configurable genome, tool and execution settings.

The workflow ends at count generation. Differential expression and pathway enrichment are downstream analyses and are not produced by the main pipeline.


Selected Methodological References


From FASTQ to Analysis-Ready Outputs

RNA-Seq workflow from FASTQ to BAM and count tables FASTQ files go through initial FastQC, UMI extraction, and Trim Galore trimming with FastQC reports. STAR aligns reads and samtools sorts and indexes BAM files. UMI-tools deduplicates alignments before featureCounts generates gene, exon and transcript count tables. FASTQ sample reads QC & Trimming FastQC and read cleanup STAR reference alignment UMI-tools deduplication featureCounts gene, exon and transcript QC Reports logs and reports Aligned BAM Files STAR alignment output Count Tables per sample and feature level

Workflow & Configuration

  1. Inputs: a samplesheet identifies samples and their FASTQ read file(s); the pipeline also needs a matching reference FASTA, GTF annotation and pre-built STAR index. The code supports paired-end and single-end read processing.
  2. Initial quality control: FastQC reports are generated for the raw reads.
  3. UMI extraction and trimming: UMI-tools extracts barcodes using a configured pattern, then Trim Galore trims reads and generates post-trimming FastQC reports.
  4. Alignment: STAR aligns reads to the reference; samtools sorts and indexes the resulting BAM files and generates alignment statistics.
  5. Deduplication and quantification: UMI-tools deduplicates alignments, then featureCounts assigns reads to gene, exon and transcript features using the GTF annotation.

The project is organised as a modular Nextflow DSL2 workflow. Reference paths, library strandedness, read mode, UMI patterns and process resources are configurable.

Input format note: the checked-in sample sheet example uses an input_path column, while the current entry point reads fastq_path_1 and fastq_path_2. Align the sample sheet and parser format before running the workflow.

UMI note: the current preprocessing and processing subworkflows invoke UMI extraction and deduplication. Confirm that the library has UMIs and that its barcode pattern is configured before using this workflow.


Outputs & Scope

  1. Aligned reads: sorted BAM files and indexes under output/STAR/align/; deduplicated BAM files and logs under output/UMI/DEDUP/.
  2. Count tables: per-sample files named {sample}_counts.gene.tsv, {sample}_counts.exon.tsv and {sample}_counts.transcript.tsv, intended for output/SUBREAD/. With UMI processing, the filenames include umi_dedup.
  3. Quality outputs: raw-read FastQC reports under output/FASTQC/, trimmed FASTQ files and post-trimming reports under output/TRIMGALORE/, plus process logs and alignment statistics.

Publication check: the featureCounts module declares gene-, exon- and transcript-level tables, but its current publication rules appear to copy exon files and summary files only. Verify the published outputs before relying on all three tables being present in the final output directory.

Count tables are per-sample outputs, not an aggregated count matrix. They can be combined for downstream differential expression analysis (for example, with DESeq2 or edgeR), but differential expression and pathway enrichment are outside this workflow's outputs. Transcript-level counts do not constitute transcript reconstruction, isoform analysis or splicing analysis.


Technologies

  • Nextflow DSL2 (version 23.04.0 or later)
  • FastQC and Trim Galore
  • STAR and samtools
  • UMI-tools
  • Subread featureCounts
  • Docker or Singularity