A comprehensive, containerized RNA-seq analysis pipeline that performs alignment, quantification, differential expression analysis, and pipeline comparison across multiple tools.
This pipeline provides a complete solution for RNA-seq data analysis, offering:
- Multiple Aligners: STAR, HISAT2, Bowtie2
- Multiple Quantifiers: featureCounts, HTSeq, RSEM
- Multiple DEG Tools: DESeq2, edgeR
- Comprehensive QC: FastQC, fastp, MultiQC
- Pipeline Comparison: Cross-tool correlation analysis
Key Features:
- 🐳 Fully containerized (Docker)
- 🔄 Reproducible results across platforms
- 📊 Generates 16 different pipeline combinations
- 🎨 Publication-ready visualizations
- ⚡ Parallel processing for faster execution
- 📝 Comprehensive logging and error handling
- Prerequisites
- Installation
- Quick Start
- Directory Structure
- Pipeline Stages
- Usage
- Output Files
- Advanced Options
- OS: Linux, macOS, or Windows (with WSL2)
- RAM: Minimum 16 GB (32 GB recommended)
- CPU: Minimum 8 cores (16+ recommended)
- Storage: 50-100 GB free space (depending on dataset size)
- Docker: Version 20.10 or higher
All dependencies are included in the Docker container:
- Python 3.11
- R 4.2.3
- Bioconda packages (STAR, HISAT2, Bowtie2, etc.)
git clone https://github.com/bioinfokushwaha/RnaSeqMetaAnalyst.git
cd RnaSeqMetaAnalyst/bioinfo_pipelineThis process builds the Docker image with all necessary environments and tools. It may take 20-40 minutes.
docker build -t rnaseqmetaanalyst:latest . docker run -it --rm --entrypoint /bin/bash rnaseqmetaanalyst:latestDownload the Docker image:
Use the rnaseqmetaanalyst.tar.gz file (rnaseqmetaanalyst.tar.gz), follow these steps to load it into Docker.
gunzip rnaseqmetaanalyst.tar.gzThis will produce:
rnaseqmetaanalyst.tarAlternatively, you can extract and load in a single command:
gunzip -c rnaseqmetaanalyst.tar.gz > rnaseqmetaanalyst.tardocker load -i rnaseqmetaanalyst.tarExpected output:
Loaded image: rnaseqmetaanalyst:latest
docker imagesYou should see:
REPOSITORY TAG IMAGE ID CREATED
rnaseqmetaanalyst latest <image_id> <date>
docker run --rm rnaseqmetaanalyst:latestTo open an interactive shell inside the container:
docker run -it --rm --entrypoint /bin/bash rnaseqmetaanalyst:latestIf Bash is unavailable:
docker run -it --rm --entrypoint /bin/sh rnaseqmetaanalyst:latest- Create project directory structure:
mkdir -p my_project/data/raw
mkdir -p my_project/data/genome- Add your files:
my_project/
├── data/
│ ├── raw/ # FASTQ files
│ │ ├── sample1_1.fastq.gz
│ │ ├── sample1_2.fastq.gz
│ │ ├── sample2_1.fastq.gz
│ │ └── sample2_2.fastq.gz
│ ├── genome/ # Reference genome
│ │ ├── genome.fna # Genome FASTA
│ │ ├── annotation.gtf # Gene annotation
│ │ └── annotation.gff # Gene annotation
│ └── sampleinfo.txt # Sample metadata
└── results/ # Will be created by pipeline
- Create sampleinfo.txt:
SampleName CONDITION
sample1 control
sample2 control
sample3 treated
sample4 treatedImportant: Use tab-separated values (TSV format), not spaces.
cd my_project
bash /path/to/run_pipeline.sh --project-dir $(pwd) --mode PEFor better understanding of paremeters go through 'run_pipeline.sh' where you add multiple parameters That's it! The pipeline will:
- Perform quality control
- Align reads with 3 different aligners
- Quantify expression with 3 different methods
- Perform differential expression analysis
- Generate comparison reports
project/
├── data/
│ ├── raw/ # Raw FASTQ files
│ │ ├── sample1_1.fastq.gz # R1 for paired-end
│ │ ├── sample1_2.fastq.gz # R2 for paired-end
│ │ └── ...
│ ├── genome/ # Reference genome files
│ │ ├── *.fna|*.fa|*.fasta # Genome sequence
│ │ ├── *.gtf # Gene annotation (GTF)
│ │ └── *.gff|*.gff3 # Gene annotation (GFF)
│ ├── sampleinfo.xlsx # Sample metadata
│ └── housekeeping_genes.xlsx # Optional housekeeping genes for normalization/QC
│
└── results/ # Output directory (created automatically)
results/
├── qc/ # Quality control reports
│ ├── fastqc_raw/ # FastQC before trimming
│ ├── fastqc_clean/ # FastQC after trimming
│ ├── fastp_reports/ # fastp HTML reports
│ └── multiqc/ # MultiQC summary
├── Trim/ # Trimmed FASTQ files
├── Mapping/ # Alignment outputs
│ ├── Bowtie/ # Bowtie2 BAM files
│ ├── Hisat2/ # HISAT2 BAM files
│ └── STAR/ # STAR BAM files
├── Quantification/ # Count matrices
│ ├── Bowtie/
│ │ ├── FC/ # featureCounts
│ │ ├── HT/ # HTSeq
│ │ └── RSEM/ # RSEM
│ ├── Hisat2/
│ │ ├── FC/
│ │ └── HT/
│ └── STAR/
│ ├── FC/
│ ├── HT/
│ └── RSEM/
├── DEG/ # Clean count matrices
│ ├── *_clean.txt # Cleaned matrices
│ └── sampleinfo.txt # Sample metadata copy
├── results/
│ ├── DEG/ # Differential expression results
│ │ ├── B_FC_counts_clean/ # Bowtie2 + FC results
│ │ │ ├── *_edgeR_UP.xlsx
│ │ │ ├── *_edgeR_DOWN.xlsx
│ │ │ ├── *_DESeq2_UP.xlsx
│ │ │ ├── *_DESeq2_DOWN.xlsx
│ │ │ ├── *_PCA_Plot.png
│ │ │ └── *_Volcano.png
│ │ └── ... (16 combinations total)
│ └── pipeline_comparison/ # Cross-pipeline analysis
│ ├── upregulated_genes_heatmap.png
│ ├── downregulated_genes_heatmap.png
│ ├── *_correlation.png
│ └── *.xlsx
└── logs/ # Execution logs
graph LR
A[Raw FASTQ] --> B[FastQC]
A --> C[fastp Trimming]
C --> D[FastQC]
%% Alignment
C --> E[STAR Alignment]
C --> F[HISAT2 Alignment]
C --> G[Bowtie2 Alignment]
%% Quantification
E --> H[featureCounts]
E --> I[HTSeq]
E --> J[RSEM]
F --> K[featureCounts]
F --> L[HTSeq]
F --> M[RSEM]
G --> N[featureCounts]
G --> O[HTSeq]
G --> P[RSEM]
%% Differential Expression
H --> Q[DESeq2]
H --> R[edgeR]
I --> S[DESeq2]
I --> T[edgeR]
J --> U[DESeq2]
J --> V[edgeR]
K --> W[DESeq2]
K --> X[edgeR]
L --> Y[DESeq2]
L --> Z[edgeR]
M --> AA[DESeq2]
M --> AB[edgeR]
N --> AC[DESeq2]
N --> AD[edgeR]
O --> AE[DESeq2]
O --> AF[edgeR]
P --> AG[DESeq2]
P --> AH[edgeR]
Tools Used:
- QC: FastQC, fastp, MultiQC
- Aligners: STAR, HISAT2, Bowtie2
- Quantifiers: featureCounts, HTSeq, RSEM
Combinations Generated: 8 count matrices
- Bowtie2 + featureCounts
- Bowtie2 + HTSeq
- Bowtie2 + RSEM
- HISAT2 + featureCounts
- HISAT2 + HTSeq
- STAR + featureCounts
- STAR + HTSeq
- STAR + RSEM
Tools Used:
- DESeq2 (variance-stabilizing transformation)
- edgeR (trimmed mean of M-values normalization)
For Each Count Matrix:
- Normalized counts
- PCA plots
- Volcano plots
- UP-regulated genes (Excel)
- DOWN-regulated genes (Excel)
- Summary statistics
Total Combinations: 16 (8 matrices × 2 DEG tools)
Analyses:
- Non-zero gene counts across samples
- UP-regulated genes overlap matrix
- DOWN-regulated genes overlap matrix
- Correlation heatmaps between pipelines
- Summary statistics and reports
./run_pipeline.sh --project-dir <path> --mode <SE|PE>./run_pipeline.sh --project-dir $(pwd) --mode PE./run_pipeline.sh --project-dir $(pwd) --mode SE./run_pipeline.sh --project-dir $(pwd) --mode PE --deg-only./run_pipeline.sh --project-dir $(pwd) --mode PE --comparison-onlyAssume using Mammalian Genome
./run_pipeline1.sh --project-dir $(pwd) --busco --protein data/genome/protein.faa --lineage mammalia_odb12./run_pipeline.sh \
--project-dir $(pwd) \
--mode PE \
--log2fc 1.5 \
--fdr 0.01 \
--pvalue 0.01# Skip comparison analysis
./run_pipeline.sh --project-dir $(pwd) --mode PE --skip-comparison
# Skip DEG analysis
./run_pipeline.sh --project-dir $(pwd) --mode PE --skip-deg
# Skip alignment (requires existing count matrices)
./run_pipeline.sh --project-dir $(pwd) --mode PE --skip-alignment| Option | Description | Default |
|---|---|---|
--project-dir |
Project directory path (required) | - |
--mode |
Sequencing mode: SE or PE (required) | - |
--threads |
Number of CPU threads | 8 |
--log2fc |
Log2 fold change threshold | 1 |
--fdr |
False discovery rate threshold | 0.05 |
--pvalue |
P-value threshold | 0.05 |
--sjdb-overhang |
STAR parameter (read length - 1) | 100 |
--skip-alignment |
Skip alignment stage | false |
--skip-deg |
Skip DEG analysis | false |
--skip-comparison |
Skip comparison stage | false |
--deg-only |
Only run DEG analysis | false |
--comparison-only |
Only run comparison | false |
--detached |
Run in background | false |
--index-dir |
Pre-built indices directory | - |
multiqc_report.html- Comprehensive QC summaryfastp_reports/*.html- Per-sample QC reportsfastqc_raw/- Pre-trimming QCfastqc_clean/- Post-trimming QC
*_sorted.bam- Sorted BAM files*_sorted.bam.bai- BAM index files*.log- Alignment statistics
*_counts_clean.txt- Cleaned count matrices (CSV format)- One file per aligner-quantifier combination
Per Pipeline Combination:
*_UP.xlsx- Upregulated genes*_DOWN.xlsx- Downregulated genes*_Normalized.xlsx- Normalized counts*_PCA_Plot.png- Principal component analysis*_PCA_Scores.xlsx- PCA coordinates*_Volcano.png- Volcano plot*_DEG_Summary.xlsx- Summary statistics
Columns in DEG Files:
- Gene ID
- Log2 fold change
- P-value
- Adjusted p-value (FDR)
- Base mean / CPM
- Status (UP/DOWN/NS)
upregulated_genes_comparison_matrix.xlsx- UP gene overlapsdownregulated_genes_comparison_matrix.xlsx- DOWN gene overlapsupregulated_genes_heatmap.png- UP genes heatmapdownregulated_genes_heatmap.png- DOWN genes heatmap*_correlation.png- Correlation heatmapsnonzero_gene_counts_by_sample.xlsx- Gene detection ratesanalysis_summary.txt- Summary report
If you have pre-built genome indices, you can skip the indexing step:
./run_pipeline.sh \
--project-dir $(pwd) \
--mode PE \
--index-dir /path/to/indicesExpected index structure:
indices/
├── Bowtie/
│ └── genome.*
├── Hisat2/
│ └── genome.*
├── STAR/
│ └── genome/
└── RSEM/
├── Bowtie/
│ └── rsem_ref.*
└── STAR/
└── rsem_ref.*
For long-running analyses:
./run_pipeline.sh \
--project-dir $(pwd) \
--mode PE \
--detachedMonitor progress:
# View container logs
docker logs -f <container_id>
# Or view log file
tail -f results/pipeline_run.log# Use 16 threads
./run_pipeline.sh --project-dir $(pwd) --mode PE --threads 16
# With memory limit (via Docker)
docker run --cpus=16 --memory=32g ...Each pipeline combination is assigned a 3-letter code:
Format: [Aligner][Quantifier][DEG Tool]
Aligners:
B= Bowtie2H= HISAT2S= STAR
Quantifiers:
F= featureCountsH= HTSeqR= RSEM
DEG Tools:
E= edgeRD= DESeq2
Examples:
BFE= Bowtie2 + featureCounts + edgeRSRD= STAR + RSEM + DESeq2HHE= HISAT2 + HTSeq + edgeR
Error:
Got permission denied while trying to connect to the Docker daemon socket
Solution:
# Add user to docker group
sudo usermod -aG docker $USER
# Log out and back in, or run:
newgrp dockerError:
Container killed due to memory limit
Solution:
# Increase Docker memory limit
# For Docker Desktop: Settings → Resources → Memory
# Or reduce thread count
./run_pipeline.sh --project-dir $(pwd) --mode PE --threads 4Error:
ERROR: sampleinfo.txt not found
Solution:
- Ensure file exists at
data/sampleinfo.txt - Check format (tab-separated, not space-separated)
- Verify file permissions
Issue: DEG analysis completes but no results files
Possible causes:
- No genes pass thresholds
- Sample size too small
- Low sequencing depth
Solution:
# Try more lenient thresholds
./run_pipeline.sh \
--project-dir $(pwd) \
--mode PE \
--log2fc 0 \
--fdr 0.1Check logs:
cat results/logs/star_*.log
cat results/logs/hisat2_*.log
cat results/logs/bowtie_*.logCommon causes:
- Insufficient memory
- Corrupted FASTQ files
- Incorrect genome files
- Check logs: All execution logs are in
results/logs/ - View container output:
docker logs <container_id>
Paired-End:
- Forward reads:
*_1.fastq.gzor*_R1.fastq.gz - Reverse reads:
*_2.fastq.gzor*_R2.fastq.gz
Single-End:
- Files should NOT contain
_1,_2,_R1, or_R2in names
Required:
- Genome FASTA:
*.fna,*.fa, or*.fasta - GTF annotation:
*.gtf - GFF annotation:
*.gffor*.gff3
Notes:
- Files can be gzipped (
.gzextension) - Must be in the same directory
- Only one file of each type should be present
Format: Tab-separated values (TSV)
Required columns:
Sample: Sample names (must match FASTQ file prefixes)Condition: Experimental conditions
Example:
SampleName CONDITION
Sample1 Control
Sample2 Control
Sample3 Control
Sample4 Treatment
Sample5 Treatment
Sample6 TreatmentImportant:
- Use tabs, not spaces
- Sample names must exactly match FASTQ prefixes
- At least 2 conditions required
- At least 2 replicates per condition recommended
-
FastQC (raw reads)
- Read quality assessment
- Adapter detection
- GC content distribution
-
fastp (trimming)
- Adapter removal
- Quality filtering
- Length filtering
- Automatic detection of adapters
-
FastQC (trimmed reads)
- Post-trimming quality check
-
MultiQC (summary)
- Aggregates all QC reports
- Interactive HTML dashboard
Runs in parallel (3 aligners simultaneously):
-
STAR (2-pass alignment)
- Splice-aware aligner
- Best for: Detection of novel junctions
- Output: Sorted BAM files
-
HISAT2
- Fast splice-aware aligner
- Best for: Large datasets
- Output: Sorted BAM files
-
Bowtie2
- General-purpose aligner
- Best for: Non-spliced alignments
- Output: Sorted BAM files
For each aligner:
-
featureCounts
- Fast, counts at exon level
- Handles multi-mapping reads
- Gene-level summarization
-
HTSeq
- Python-based counter
- Flexible counting modes
- Union mode (default)
-
RSEM (STAR and Bowtie2 only)
- Transcript-level quantification
- Handles isoform abundance
- Expectation-maximization algorithm
For each count matrix:
-
Normalization
- DESeq2: Variance-stabilizing transformation
- edgeR: TMM normalization
-
Differential Expression
- Pairwise comparisons between conditions
- FDR correction (Benjamini-Hochberg)
- Generates UP/DOWN gene lists
Conservative (publication):
--log2fc 1 --fdr 0.05Moderate (exploratory):
--log2fc 0.5 --fdr 0.1Lenient (hypothesis generation):
--log2fc 0 --fdr 0.1Generates excel file of pariwise comparision matrix and number of common DEGs in 16 rows cross 16 columns and also its images for both up and downregulated genes
- Bioconda community for tool packaging
- Docker community for containerization support
- All tool developers whose software powers this pipeline
