Inferensys

Glossary

Mapping Quality Filtering

Mapping quality filtering is the computational process of discarding sequencing reads with a low probability of being correctly aligned to the reference genome, thereby reducing false positive variant calls caused by mismapped reads.
Developer demonstrating multi-agent tool use, agent tool selection interface on laptop, casual tech demo moment.
ALIGNMENT QUALITY CONTROL

What is Mapping Quality Filtering?

Mapping quality filtering is the computational process of discarding sequencing reads with a low probability of correct genomic alignment to reduce false positive variant calls caused by mismapped reads.

Mapping quality filtering is a critical preprocessing step in variant calling pipelines that removes aligned reads whose reported genomic position is likely incorrect. The mapping quality (MAPQ) score, computed by aligners like BWA-MEM or minimap2, is a Phred-scaled probability that the read's alignment is wrong. A MAPQ of 30 corresponds to a 1-in-1,000 chance of misalignment. By applying a minimum threshold—typically MAPQ ≥ 20 or 30—analysts eliminate reads mapping to repetitive regions, segmental duplications, or homologous sequences where the true origin is ambiguous.

Without stringent mapping quality filtering, mismapped reads introduce false positive variant calls by depositing non-reference alleles at incorrect loci. This is especially problematic for pseudogenes and low-complexity regions, where paralogous sequences confuse short-read aligners. The filter is applied using tools like samtools view -q on BAM files before variant calling. While essential for specificity, overly aggressive filtering can reduce sensitivity in highly polymorphic regions or create reference bias, necessitating careful threshold calibration against truth sets like Genome in a Bottle.

DATA INTEGRITY

Key Characteristics of Mapping Quality Filtering

Mapping quality filtering is a critical preprocessing step that discards sequencing reads with a low probability of being correctly aligned to the reference genome, directly reducing false positive variant calls caused by mismapped reads.

01

The Phred-Scaled MAPQ Score

The Mapping Quality (MAPQ) score is a Phred-scaled probability that the read is misaligned. A score of 30 implies a 1 in 1,000 chance of incorrect alignment, while a score of 0 indicates a multi-mapping read with no unique best hit. Filtering on a threshold (typically MAPQ ≥ 20 or 30) is the primary mechanism for removing ambiguous reads from repetitive or paralogous regions.

MAPQ 30
99.9% Alignment Confidence
MAPQ 0
Multi-Mapper / Unmappable
02

Mismatch Density and Edit Distance

Beyond the aggregate MAPQ score, filtering often involves analyzing the edit distance or mismatch density of an alignment. A read with an unexpectedly high number of mismatches or gaps relative to the reference may represent a pseudogene or a structural variant rather than a true single-nucleotide variant. Hard-clipping or discarding reads with excessive soft-clipped bases prevents false variant calls near insertion/deletion breakpoints.

03

Multi-Mapping and Repeat Masking

Short reads originating from low-complexity regions or segmental duplications often align equally well to multiple genomic loci. Aligners typically assign a MAPQ of 0 to these reads. Filtering them out is essential to avoid spurious heterozygous calls caused by aggregating signal from paralogous sequences. Advanced pipelines may also use a k-mer uniqueness track to pre-emptively mask problematic regions.

04

Supplementary and Chimeric Read Filtering

A single sequenced fragment can produce multiple alignment records: a primary linear alignment and supplementary chimeric or split-read alignments. For standard variant calling, supplementary alignments must be flagged and filtered out (using SAM flag 2048) to prevent double-counting evidence. However, these reads are retained for structural variant detection to identify breakpoints.

05

Base Alignment Quality (BAQ) Adjustment

Standard MAPQ applies to the entire read, but local alignment artifacts near indels can cause systematic base-level errors. Base Alignment Quality (BAQ) is a computational adjustment that lowers the quality score of individual bases hidden within a gapped alignment. This prevents false single-nucleotide variant calls caused by the misplacement of insertions or deletions by the aligner.

06

Impact on Variant False Discovery Rate

Aggressive mapping quality filtering is the most effective single step for controlling the False Discovery Rate (FDR) in variant calling. By removing reads with MAPQ < 20, pipelines can eliminate the majority of false positives arising from mismapped reads in segmental duplications. However, overly strict filtering can cause allelic dropout in highly polymorphic regions, reducing sensitivity for true variants.

MAPPING QUALITY FILTERING

Frequently Asked Questions

Mapping quality filtering is a critical preprocessing step in variant calling pipelines that removes sequencing reads with a low probability of being correctly aligned to the reference genome, directly reducing false positive variant calls caused by mismapped reads in repetitive or paralogous genomic regions.

Mapping quality (MAPQ) is a Phred-scaled probability that a sequencing read is incorrectly aligned to the reference genome. It is calculated as MAPQ = -10 * log10(P{read is wrongly mapped}). A MAPQ of 20 indicates a 1% chance of misalignment, while a MAPQ of 30 indicates a 0.1% chance. Aligners like BWA-MEM and Bowtie2 compute MAPQ by evaluating the uniqueness of the alignment, the number of mismatches, and the presence of alternative mapping locations. Reads that map equally well to multiple genomic loci—common in segmental duplications and low-complexity regions—receive low MAPQ scores because the aligner cannot confidently resolve their true origin. The calculation incorporates the Smith-Waterman alignment score of the primary alignment compared to all secondary alignments, effectively quantifying the ratio of the best hit to the next-best hit.

QUALITY CONTROL COMPARISON

Mapping Quality Filtering vs. Related Quality Control Methods

A comparison of mapping quality filtering against other quality control methods used in variant calling pipelines, highlighting their primary targets, mechanisms, and roles in reducing false positive calls.

FeatureMapping Quality FilteringBase Quality Score Recalibration (BQSR)Variant Quality Score Recalibration (VQSR)

Primary Target

Read alignment accuracy

Per-base error probability

Variant call confidence

Input Data

MAPQ scores from aligner

Raw base quality scores + covariates

Variant annotations + truth sets

Stage in Pipeline

Post-alignment, pre-variant calling

Pre-variant calling

Post-variant calling

Corrects Systematic Errors

Uses Machine Learning

Requires Known Truth Set

Typical False Positive Reduction

30-70% of mismapped reads

Variable by platform

Up to 90% of artifacts

Primary Artifact Addressed

Mismapped reads, paralogous alignments

Sequencing chemistry errors

Systematic variant calling errors

Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.