omics.co.in logo omics.co.in

Chapter 3: Step 1 — Quality Control (QC) & Preprocessing

Tested Stacks: GATK 4.6.1 Samtools 1.21 Nextflow 24.10 Seurat v5.1 Python 3.12
Prerequisites: Basic Linux CLI & Sequencing Formats
📚 Chapter 3 of 10 0% Course Completed

Chapter 3: Step 1 — Quality Control (QC) & Preprocessing

Every clinical diagnostic assay starts with raw binary reads emitted by sequencing platforms. In this chapter, we master the mathematics of Phred quality scores, implement automated quality reporting using FastQC, and deploy high-performance trimming algorithms using FastP and Trimmomatic to eliminate technical artifacts.

Step 1 Technical Specifications
  • Input File: Raw FASTQ (.fastq.gz) containing nucleotide strings and ASCII-encoded Phred quality scores.
  • Tools Used: FastQC (statistical quality reporting), FastP • Trimmomatic (adapter trimming & sliding-window base filtering).
  • Output File: Cleaned, quality-filtered FASTQ (.fastq.gz) ready for aligner ingestion.
  • Clinical Utility: Evaluates per-base quality decay, base composition, GC biases, and adapter contamination. Trimming eliminates synthetic adapter artifacts and erroneous low-quality base calls ($Q < 20$), preventing downstream false-positive variant calls.

The 4-Line Anatomy of a FASTQ Record

Each sequencing read occupies exactly four lines in a standard FASTQ file:

@A00123:456:H5TY2DSX7:1:1101:1024:1000 1:N:0:GATCGT  <- Line 1: Header (Instrument, Run, Flowcell, Tile, X:Y coordinates, Index)
ATGCGATCGATCGTAGCTAGCTAGGCTAGCTAACTAGCTAGCTA         <- Line 2: Nucleotide Sequence Call (A, C, G, T, N)
+                                                    <- Line 3: Separator (optional repeat of header)
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF         <- Line 4: ASCII Phred Quality Characters (ASCII 33 offset)

Phred Quality Score Mathematics

The Phred score ($Q$) is a logarithmic transformation of the estimated base-calling error probability ($P_e$):

$$Q = -10 imes \log_{10}(P_e) \quad \Longleftrightarrow \quad P_e = 10^{-Q/10}$$
Phred Score ($Q$)Error Probability ($P_e$)Base Call AccuracyASCII-33 CharacterClinical Interpretation
Q101 in 10 (0.10)90.0%+Unacceptable. High probability of false-positive call.
Q201 in 100 (0.01)99.0%5Minimum acceptable diagnostic threshold for clinical filtration.
Q301 in 1,000 (0.001)99.9%?Benchmark standard for Illumina SBS and PacBio HiFi.
Q401 in 10,000 (0.0001)99.99%IUltra-high accuracy (NovaSeq X, Element AVITI, BGI DNBseq).

Production Preprocessing Pipelines: FastP vs Trimmomatic

In modern high-throughput labs, FastP has largely replaced legacy Java-based tools due to its multithreaded C++ architecture, automatic adapter detection, and built-in poly-G tail removal (crucial for two-color Illumina chemistry where no-signal corresponds to G):

# Modern High-Performance Trimming with FastP
fastp     --in1 sample_R1.fastq.gz     --in2 sample_R2.fastq.gz     --out1 clean_R1.fastq.gz     --out2 clean_R2.fastq.gz     --detect_adapter_for_pe     --trim_poly_g     --cut_front --cut_tail     --cut_window_size 4     --cut_mean_quality 20     --length_required 50     --thread 16     --html qc_report.html     --json qc_metrics.json

# Legacy Trimmomatic Pipeline Execution
trimmomatic PE -threads 16     sample_R1.fastq.gz sample_R2.fastq.gz     clean_paired_R1.fq.gz clean_unpaired_R1.fq.gz     clean_paired_R2.fq.gz clean_unpaired_R2.fq.gz     ILLUMINACLIP:adapters/TruSeq3-PE.fa:2:30:10:2:keepBothReads     LEADING:3 TRAILING:3     SLIDINGWINDOW:4:20     MINLEN:50
⚠️

Common Pitfalls & Troubleshooting Checklist

  • Java Heap Exhaustion (GATK / Picard): If processes terminate with java.lang.OutOfMemoryError, set your environment variable explicitly: export _JAVA_OPTIONS="-Xmx16g -Djava.io.tmpdir=/tmp".
  • Index Timestamp Mismatch: If tools complain that a BAM index is missing or out of date, regenerate with samtools index -@ 4 sample.bam.
  • Conda Channel Conflicts: Avoid ABI incompatibilities between bioconda and conda-forge by setting strict priority: conda config --set channel_priority strict.
  • Chromosome Naming Contamination: Always verify whether reference FASTA headers use chr1 or 1; divergent naming causes silent alignment drops.
Was this guide helpful to your research?
Help us maintain 100% accurate, peer-reviewed bioinformatics standards.
📝 Propose Edit on GitHub ↗