A lightweight and user-friendly Bash pipeline for Reduced Representation Bisulfite Sequencing (RRBS) data analysis. It performs quality control, adapter trimming, alignment, deduplication, methylation extraction, and summary reporting — all in a single script with optional dry-run mode.
- Supports both single-end and paired-end FASTQ files
- Automatic detection of mode-based arguments
- Creates a detailed log file ({sampleX}.log) with timestamps and command & execution details
- --dry-run option to preview commands without execution
- Clean and minimal dependencies — no workflow engine needed
Please ensure the following tools are installed and accessible from your system PATH:
Trim_galore
Bismark
MultiQC
Bowtie2
chmod +x run_rrbs.sh
./run_rrbs.sh sample_R1.fastq.gz sample_R2.fastq.gz /path/to/bowtie2_index
For single-end:
./run_rrbs.sh sample.fastq.gz /path/to/bowtie2_index
Dry-run mode (preview commands only):
./run_rrbs.sh sample.fastq.gz /path/to/bowtie2_index --dry-run
- *.log — per-sample execution log with steps and timestamps
- *_dedup.bam — deduplicated aligned BAM file
- *_Methylation_report.txt, *.bedGraph.gz, *.cov.gz — methylation calls
- multiqc_report.html — combined quality control summary
Each major processing step is logged to a file with command and execution details (sampleX.log).
A test example:
RRBS pipeline started at 2025-06-04 07:46:55
Sample: SRR17518177 | Mode: paired-end | Dry-run: true
==========================================
----------------------------------------------------------------------------------------------------
STAGE 1: FastQC
----------------------------------------------------------------------------------------------------
>> fastqc SRR17518177.R1.fq.gz SRR17518177.R2.fq.gz
----------------------------------------------------------------------------------------------------
STAGE 2: Trim Galore
----------------------------------------------------------------------------------------------------
>> trim_galore --paired --rrbs SRR17518177.R1.fq.gz SRR17518177.R2.fq.gz
----------------------------------------------------------------------------------------------------
STAGE 3: Bismark Alignment
----------------------------------------------------------------------------------------------------
>> bismark --genome ~/genomes/hg38/bowtie2_index -1 SRR17518177.R1_val_1.fq.gz -2 SRR17518177.R2_val_2.fq.gz -o .
----------------------------------------------------------------------------------------------------
STAGE 4: Deduplicate BAM
----------------------------------------------------------------------------------------------------
>> deduplicate_bismark --paired SRR17518177.R1_val_1_bismark_bt2_pe.bam
----------------------------------------------------------------------------------------------------
STAGE 5: Methylation Extraction
----------------------------------------------------------------------------------------------------
>> bismark_methylation_extractor --paired-end --bedGraph --gzip --no_overlap --output . SRR17518177.R1_val_1_bismark_bt2_pe.deduplicated.bam
----------------------------------------------------------------------------------------------------
STAGE 6: MultiQC
----------------------------------------------------------------------------------------------------
>> multiqc . --outdir .
----------------------------------------------------------------------------------------------------
STAGE 7: Cleanup Intermediate Files
----------------------------------------------------------------------------------------------------
>> rm -f *deduplicated.txt.gz *bt2.bam *M-bias.txt *val_*.fq.gz
>> mv SRR17518177.R1_val_1_bismark_bt2_pe.deduplicated.bam SRR17518177.deduplicated.bam
Pipeline completed at 2025-06-04 07:46:55
========== SUMMARY ==========
Sample name : SRR17518177
Mode : paired
Genome index : ~/genomes/hg38/bowtie2_index
Final BAM : SRR17518177.deduplicated.bam
Methylation : SRR17518177.deduplicated_Methylation_report.txt (or .gz/bedGraph)
QC Report : multiqc_report.html
Log saved to : SRR17518177.log
MIT License
Please let me know if you have any questions or suggestions about my pipeline script!