INNER CODE UNIT · Rust
check_pair
mbhall88/rasusa · src/alignment/mod.rs:40
fn check_pair(&self) -> Result<bool> {
// set up reader. Only the first 10 records are read below, so multithreaded BGZF
// decoding would pay worker-pool spin-up costs for no benefit - always use 1 thread here.
let mut reader = build_alignment_reader(&self.aln, NonZeroUsize::new(1).unwrap())?;
let header = reader.read_header()?;
// read records only to check what type of the data
for result in reader.records(&header).take(10) {
let record = result.context("Failed to parse BAM record")?;
if record.flags()?.is_segmented() {
return Ok(true);
}
}
Ok(false)
}
// a helper function to calculate target depth based on their input