Skip to content

Commit

Permalink
Update to noodles 0.52.0
Browse files Browse the repository at this point in the history
  • Loading branch information
zaeleus committed Sep 21, 2023
1 parent 2418e9a commit d6da417
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions 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
Expand Up @@ -19,7 +19,7 @@ flate2 = "1.0.14"
git-testament = "0.2.0"
interval-tree = { git = "https://github.com/zaeleus/interval-tree.git", rev = "e303d7254d53de5c418d6079d4b66c30c10958d4" }
mimalloc = { version = "0.1.26", default-features = false }
noodles = { version = "0.50.0", features = ["bam", "bgzf", "core", "gff", "sam"] }
noodles = { version = "0.52.0", features = ["bam", "bgzf", "core", "gff", "sam"] }
noodles-bgzf = { version = "0.24.0", features = ["libdeflate"] }
thiserror = "1.0.40"
tracing = "0.1.25"
Expand Down
8 changes: 4 additions & 4 deletions src/count.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ pub fn count_single_end_record(
let start = record.alignment_start()?.expect("missing alignment start");
let intervals = MatchIntervals::new(&cigar, start);

let flags = record.flags()?;
let flags = record.flags();
let is_reverse = match strand_specification {
StrandSpecification::Reverse => !flags.is_reverse_complemented(),
_ => flags.is_reverse_complemented(),
Expand Down Expand Up @@ -254,7 +254,7 @@ pub fn count_paired_end_record_pair(
let start = r1.alignment_start()?.expect("missing alignment start");
let intervals = MatchIntervals::new(&cigar, start);

let f1 = r1.flags()?;
let f1 = r1.flags();
let is_reverse = match strand_specification {
StrandSpecification::Reverse => !f1.is_reverse_complemented(),
_ => f1.is_reverse_complemented(),
Expand All @@ -271,7 +271,7 @@ pub fn count_paired_end_record_pair(
let start = r2.alignment_start()?.expect("missing alignment start");
let intervals = MatchIntervals::new(&cigar, start);

let f2 = r2.flags()?;
let f2 = r2.flags();
let is_reverse = match strand_specification {
StrandSpecification::Reverse => f2.is_reverse_complemented(),
_ => !f2.is_reverse_complemented(),
Expand Down Expand Up @@ -308,7 +308,7 @@ pub fn count_paired_end_singleton_record(
let start = record.alignment_start()?.expect("missing alignment start");
let intervals = MatchIntervals::new(&cigar, start);

let flags = record.flags()?;
let flags = record.flags();
let is_reverse = match SegmentPosition::try_from(flags) {
Ok(SegmentPosition::First) => match strand_specification {
StrandSpecification::Reverse => !flags.is_reverse_complemented(),
Expand Down
6 changes: 3 additions & 3 deletions src/count/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ impl Filter {
}

pub fn filter(&self, record: &bam::lazy::Record) -> io::Result<Option<Event>> {
let flags = record.flags()?;
let flags = record.flags();

if flags.is_unmapped() {
return Ok(Some(Event::Unmapped));
Expand Down Expand Up @@ -79,8 +79,8 @@ impl Filter {
r1: &bam::lazy::Record,
r2: &bam::lazy::Record,
) -> io::Result<Option<Event>> {
let f1 = r1.flags()?;
let f2 = r2.flags()?;
let f1 = r1.flags();
let f2 = r2.flags();

if f1.is_unmapped() && f2.is_unmapped() {
return Ok(Some(Event::Unmapped));
Expand Down
2 changes: 1 addition & 1 deletion src/detect.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ where
for result in reader.lazy_records().take(MAX_RECORDS) {
let record = result?;

let flags = record.flags()?;
let flags = record.flags();

if flags.is_unmapped() || flags.is_secondary() || flags.is_supplementary() {
continue;
Expand Down
6 changes: 3 additions & 3 deletions src/record_pairs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,14 @@ where
}

fn is_not_primary(record: &bam::lazy::Record) -> io::Result<bool> {
let flags = record.flags()?;
let flags = record.flags();
Ok(flags.is_secondary() || flags.is_supplementary())
}

fn key(record: &bam::lazy::Record) -> io::Result<RecordKey> {
Ok((
record.read_name().map(|buf| buf.as_ref().to_vec()),
SegmentPosition::try_from(record.flags()?)
SegmentPosition::try_from(record.flags())
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?,
record.reference_sequence_id()?,
record.alignment_start()?,
Expand All @@ -100,7 +100,7 @@ fn key(record: &bam::lazy::Record) -> io::Result<RecordKey> {
fn mate_key(record: &bam::lazy::Record) -> io::Result<RecordKey> {
Ok((
record.read_name().map(|buf| buf.as_ref().to_vec()),
SegmentPosition::try_from(record.flags()?)
SegmentPosition::try_from(record.flags())
.map(|p| p.mate())
.map_err(|e| io::Error::new(io::ErrorKind::InvalidData, e))?,
record.mate_reference_sequence_id()?,
Expand Down

0 comments on commit d6da417

Please sign in to comment.