8000
Skip to content

Latest commit

 

History

53 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RNA-seq Analysis Pipeline

Quality Control → Mapping → Counting → Differential Expression → GO Enrichment

This repository provides a modular, restart-safe RNA-seq analysis pipeline implemented fully in Python. It automates all major steps of a classical transcriptome analysis workflow up to differential expression (PyDESeq2) and Gene Ontology enrichment.

The pipeline is designed for clarity, reproducibility, and HPC/WSL execution.


Pipeline Stages

1. Quality Control (QC)

Location: qc/

Functions:

  • Filter metadata file (CSV)
  • Detect paired FASTQ files for each sample
  • Run FastQC on all valid FASTQ files
  • Run MultiQC to aggregate QC reports
  • Automatically skip already processed samples

Outputs:

  • samples.csv (filtered)
  • FastQC reports
  • MultiQC summary

2. Read Mapping (HISAT2 or STAR)

Location: mapping/

User selects the aligner: 1 = HISAT2 2 = STAR

HISAT2 implementation:

  • Align paired-end reads
  • Convert SAM to B 88E2 AM
  • Run StringTie to assemble transcripts
  • Produce per-sample GTF files
  • Merge and refine all StringTie GTFs
  • Skip logic for already aligned samples

STAR implementation:

  • Align paired-end reads
  • Produce sorted BAM files
  • Skip completed samples

Outputs (depending on method):

  • mapping_output/SRRxxxx_hisat2.bam
  • mapping_output/SRRxxxx_hisat2.gtf
  • mapping_output/merged_stringtie_refined.gtf or
  • mapping_output/SRRxxxx_Aligned.out.bam

3. Gene Counting (featureCounts)

Location: count/

Features:

  • Validates BAM and GTF input
  • Automatically detects paired-end BAMs
  • Runs featureCounts for each sample
  • Stores each result in its own folder
  • Skips samples with existing counts

Output: results/counts//counts.txt


3.5 Combined Count Matrix

The pipeline automatically merges all per-sample count tables into a single combined count matrix:

results/counts/combined_counts.txt

This matrix is used for downstream DESeq2 analysis.


4. Differential Expression Analysis (PyDESeq2)

Location: dea/

Steps:

  • Convert featureCounts output into a DESeq2-ready count matrix
  • Subset samples per timepoint (3h, 6h, 12h, 24h, 72h)
  • Run DESeq2 model using PyDESeq2
  • Perform statistics for contrast: treatment = nacl vs mock
  • Skip timepoints that do not have enough samples

Outputs: results/dea_pydeseq//deseq2_results.csv


5. GO Enrichment Analysis

Location: enrichment/

Uses:

  • ge_enrich.py
  • Fisher exact test per GO term

Inputs:

  • GO annotation file
  • Per-timepoint DESeq2 results

Outputs: results/go_enrichment//go_enrichment.tsv


Project Structure

project/ main.py qc/ init.py csv_filtering.py mapping/ init.py hisat2.py star.py count/ init.py featureCounts.py dea/ init.py pydeseq_preprocess.py pydeseq_run.py enrichment/ init.py ge_enrich.py data/ GSE132824.csv go.can.csv results/ fastqc/ multiqc/ mapping_output/ counts/ dea_pydeseq/ go_enrichment/


Running the Pipeline

From the project root:

python3 main.py

The program will:

  • Run QC
  • Ask you to select HISAT2 or STAR
  • Run mapping
  • Count aligned reads
  • Build combined count matrix
  • Run DESeq2 for each timepoint
  • Run GO enrichment

All steps include skip logic. If the pipeline crashes or is interrupted, re-running it will continue from completed steps.


Requirements

Python packages:

  • pandas
  • scipy
  • pydeseq2

System tools:

  • FastQC
  • MultiQC
  • HISAT2
  • STAR
  • featureCounts (subread)
  • samtools

Metadata Requirements

The metadata CSV must contain at least the following columns: sample_id treatment time temperature

Example:

sample_id, treatment, temperature, time SRR8692579, nacl, 25, 12h SRR8692580, mock, 25, 6h

Time values should contain an integer (e.g. 3h, 6h). The pipeline extracts numeric hours automatically.


FASTQ Requirements

FASTQ files must follow this naming pattern:

<sample_id>_1.fastq.gz <sample_id>_2.fastq.gz


Outputs Summary

QC:

  • FastQC reports
  • MultiQC summary
  • samples.csv

Mapping:

  • BAM files
  • GTF files (HISAT2)
  • merged refined GTF

Counting:

  • Per-sample counts.txt
  • combined_counts.txt

DESeq2:

  • deseq2_results.csv for each timepoint

GO Enrichment:

  • go_enrichment.tsv for each timepoint

Contributors

This project was jointly developed by the following team members:

  • George David Apostolidis (@apost005)
  • Ilse Aalberts (@aalbe031)
  • Demian Fluit (@fluit016)
  • Laurens van den Heuvel (@heuve094)
  • Elif Ozdogan (@ozdog003)

Wageningen University and Research Bioinformatics and Systems Biology

About

This repository provides a modular, restart-safe RNA-seq analysis pipeline implemented fully in Python. It automates all major steps of a classical transcriptome analysis workflow up to differential expression (PyDESeq2) and Gene Ontology enrichment.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages

0