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
- Dobin A. et al. (2013). STAR: ultrafast universal RNA-seq aligner. Bioinformatics, 29(1), 15–21. Describes the splice-aware aligner used for mapping reads to the reference genome.
- Liao Y. et al. (2014). featureCounts: an efficient general purpose program for assigning sequence reads to genomic features. Bioinformatics, 30(7), 923–930. Describes read summarisation for genomic features, including genes and exons.
- Smith T. et al. (2017). UMI-tools: modeling sequencing errors in Unique Molecular Identifiers to improve quantification accuracy. Genome Research, 27(3), 491–499. Describes UMI-aware methods for identifying PCR duplicates; applicability depends on the library design and UMI configuration.
- Martin M. (2011). Cutadapt removes adapter sequences from high-throughput sequencing reads. EMBnet.journal, 17(1), 10. Relevant to adapter trimming; the workflow invokes Trim Galore for trimming and FastQC reporting.
From FASTQ to Analysis-Ready Outputs
Workflow & Configuration
- 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.
- Initial quality control: FastQC reports are generated for the raw reads.
- UMI extraction and trimming: UMI-tools extracts barcodes using a configured pattern, then Trim Galore trims reads and generates post-trimming FastQC reports.
- Alignment: STAR aligns reads to the reference; samtools sorts and indexes the resulting BAM files and generates alignment statistics.
- 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
- Aligned reads: sorted BAM files and indexes under
output/STAR/align/; deduplicated BAM files and logs underoutput/UMI/DEDUP/. - Count tables: per-sample files named
{sample}_counts.gene.tsv,{sample}_counts.exon.tsvand{sample}_counts.transcript.tsv, intended foroutput/SUBREAD/. With UMI processing, the filenames includeumi_dedup. - Quality outputs: raw-read FastQC reports under
output/FASTQC/, trimmed FASTQ files and post-trimming reports underoutput/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