Skip to content

Commit

Permalink
skip over reads with invalid cigar
Browse files Browse the repository at this point in the history
  • Loading branch information
pmarks committed Apr 21, 2021
1 parent de23b57 commit 3901805
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "vartrix"
version = "1.1.19"
version = "1.1.20"
authors = ["Ian Fiddes <[email protected]>", "Patrick Marks <[email protected]>"]
edition = "2018"

Expand Down
10 changes: 7 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -793,9 +793,13 @@ pub fn useful_alignment(haps: &VariantHaps, rec: &bam::Record) -> Result<bool, E
let cigar = rec.cigar();
for i in haps.locus.start..=haps.locus.end {
// Don't include soft-clips but do include deletions
let t = cigar.read_pos(i as u32, false, true)?;
if t.is_some() {
return Ok(true);
match cigar.read_pos(i as u32, false, true) {
Ok(Some(_)) => return Ok(true),
Ok(None) => (),
Err(e) => {
info!("Skipping read {:?} due to invalid CIGAR: {}", rec, e);
return Ok(false);
}
}
}
Ok(false)
Expand Down

0 comments on commit 3901805

Please sign in to comment.