STEP 2: Trimming and Adapter Removal
Trimming and Adapter Removal
Trimming is an important preprocessing step in many NGS workflows to remove low-quality bases and adapter sequences from reads before alignment.
Why Trim Reads?
Common reasons to trim sequencing reads:
- Remove adapter sequences - Sequencing adapters that remain in reads
- Remove low-quality bases - Bases with poor quality scores (typically at read ends)
- Remove N’s - Unknown bases
- Quality filtering - Discard reads below quality thresholds
- Length filtering - Remove reads that are too short after trimming
Trimming Tools
Trigalore
Perl wrapper around Cutadapt and FastQC, designed for ease of use.
module load trimgalore
# Paired-end example
trim_galore --paired --quality 20 --length 20 \
sample_R1.fastq.gz sample_R2.fastq.gzCutadapt
Python-based trimmer, fast and user-friendly.
module load cutadapt
# Paired-end example
cutadapt -o sample_R1_trimmed.fastq.gz \
-p sample_R2_trimmed.fastq.gz \
--minimum-length 20 \
--quality-cutoff 20 \
sample_R1.fastq.gz sample_R2.fastq.gzCutadapt Parameters:
-a- 3’ adapter for R1-A- 3’ adapter for R2--minimum-length- Minimum read length to keep--quality-cutoff- Quality threshold for trimming
fastp
All-in-one tool with built-in QC.
module load fastp
# Paired-end example
fastp -i sample_R1.fastq.gz -I sample_R2.fastq.gz \
-o sample_R1_trimmed.fastq.gz -O sample_R2_trimmed.fastq.gz \
--detect_adapter_for_pe \
--qualified_quality_phred 20 \
--length_required 20 \
--thread 8 \
--html sample_fastp.htmlChecking Trimming Success
Run FastQC before and after trimming to verify:
- Adapter content removed
- Quality scores improved
- Read length distribution
Workflow Integration
Typical order:
- FastQC (raw reads)
- Trimming (Trimmomatic/Cutadapt/fastp)
- FastQC (trimmed reads)
- Alignment
Best Practices
- Always run FastQC before trimming to identify what needs trimming
- Keep paired reads synchronized (use paired-end mode)
- Save trimming logs for QC metrics
- Use moderate quality thresholds (Q20 or Q30)
- Consider your downstream analysis requirements