This repository contains a complete RNA-seq analysis pipeline designed for SLURM environments.
- Pre-processing (
RNAseq_PIPELINE.sh) - Differential Gene Expresion Analysis (
DGE_analysis.Rmd)
- Modify the variables inside
RNAseq_PIPELINE.shwith your paths and sample names. - Submit to SLURM:
sbatch RNAseq_PIPELINE.shRuns a quality control check on the raw FASTQ files.
Command:
fastqc sample_R1.fastq.gz sample_R2.fastq.gz -o output_dir
Arguments:
- sample.fastq.gz: Input FASTQ file
- -o: Output directory
Aligns paired-end reads to the reference genome using STAR. Outputs include:
- Sorted BAM file
- Gene count matrix
Command:
STAR \
--genomeDir STAR_index_dir \
--sjdbGTFfile annotation.gtf \
--readFilesIn sample_R1.fastq.gz sample_R2.fastq.gz \
--readFilesCommand zcat \
--runThreadN 4 \
--outFileNamePrefix output_prefix \
--outSAMtype BAM SortedByCoordinate \
--quantMode GeneCounts
- --genomeDir: Path to STAR genome index (e.g. built for hg38)
- --sjdbGTFfile: GTF annotation file used for guided alignment
- --readFilesIn: Input paired-end FASTQ files
- --readFilesCommand: Decompression method (e.g., zcat for .gz)
- --runThreadN: Number of threads for parallel processing
- --outFileNamePrefix: Prefix for all output files
- --outSAMtype: BAM SortedByCoordinate Output sorted BAM file by coordinate
- --outTmpDir: Temporary directory for STAR to use
- --outWigStrand: Unstranded Type of strand specificity in wiggle files (Unstranded, Forward, or Reverse)
- --quantMode: GeneCounts Outputs read counts per gene
Indexes the sorted BAM file for downstream tools.
Command:
samtools index Aligned.sortedByCoord.out.bam
Creates a normalized bigWig file for visualization.
Command:
bamCoverage \
--bam input.bam \
--outFileName output.bw \
--effectiveGenomeSize 2913022398 \
--outFileFormat bigwig \
--binSize 1 \
--normalizeUsing RPGCArguments:
- --bam: Input BAM file (cleaned, filtered, and deduplicated)
- --outFileName: Output bigWig file name
- --effectiveGenomeSize: Effective genome size (e.g. 2913022398 for human hg38)
- --outFileFormat: Output format, typically bigwig
- --binSize: Bin size for signal aggregation (e.g. 1 bp resolution)
- --normalizeUsing: Normalization method (e.g. RPGC = Reads Per Genomic Content)
This workflow includes gene annotation, count filtering, normalization, statistical testing, visualization, and functional enrichment analysis.
- Open
DGE_analysis.Rmdin RStudio. - Set the variables in the CONFIG section at the top.
- Knit or run chunk by chunk.
| File | Description |
|---|---|
counts.tab |
Raw gene counts matrix (from STAR --quantMode GeneCounts) |
genes.bed |
Gene annotation BED file with Ensembl IDs and gene symbols |
1. Import & Annotate Reads the count matrix, merges with a gene annotation file to add gene symbols, and deduplicates entries where multiple Ensembl IDs map to the same symbol.
2. Differential Expression (DESeq2)
Builds a DESeq2 object, filters lowly expressed genes, and runs the model with a user-defined reference condition. Genes are classified as UP, DOWN, or NO based on |LFC| > 1 and padj < 0.05.
3. Visualization
- PCA — assesses sample clustering and replicate reproducibility after VST normalization
- Volcano plot — displays fold change vs. significance, labelling the top N most significant genes
4. GO Enrichment (enrichR) Runs Gene Ontology Biological Process enrichment separately on UP and DOWN regulated genes.
- Differential expression results (
DGE_*.xlsx) - Normalized gene expression values (
normalized_counts_*.xlsx) - PCA plot (
PCA.pdf) - Volcano plot (
Volcano_*.pdf) - GO enrichment tables (
GO_UP_*.xlsx,GO_DOWN_*.xlsx) - GO enrichment plots (
GO_*.pdf)