pub struct BamConfig {
pub min_mapq: u8,
pub include_secondary: bool,
pub include_supplementary: bool,
pub partial: bool,
pub min_partial_coverage: f64,
pub min_region_quality: f64,
}Expand description
Filter and extraction settings for BAM reads.
This is the library equivalent of the CLI Opts fields that affect BAM extraction.
Construct with BamConfig::default for permissive defaults (no filters, spanning
reads only), then override individual fields as needed.
Fields§
§min_mapq: u8Minimum mapping quality (MAPQ) a read must have to be included.
Reads whose MAPQ is below this threshold are skipped. Default: 0 (no filter).
include_secondary: boolWhether to include secondary alignments (SAM flag 0x100).
Default: false (secondary alignments are skipped).
include_supplementary: boolWhether to include supplementary alignments (SAM flag 0x800).
Default: false (supplementary alignments are skipped).
partial: boolWhether to include reads that only partially overlap the BED region.
When false (the default), only reads whose alignment spans the entire
region — from region_start to region_end — are returned. When true,
reads that overlap any part of the region are included; the extracted
subsequence is clipped to whatever portion the read covers.
min_partial_coverage: f64Minimum fraction (0.0-1.0) of the requested (region ± flanks) window a
partial read must cover to be included. Reads/alignments below this
threshold are discarded, similar to liftOver’s -minMatch. Default: 0.0
(no filter — any overlap is accepted). Only meaningful when partial is
true; non-partial reads always cover the full window by construction, so
this is a no-op otherwise.
min_region_quality: f64Minimum mean Phred quality of the extracted subsequence.
After the CIGAR walk, the quality string of the extracted slice is scored
with crate::utils::calculate_qscore; reads below this
threshold are discarded. Default: 0.0 (no filter). Applies to BAM/CRAM
input regardless of output format — the read’s quality scores are always
present, whether or not --fastq is used for output.