Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

feat: Return the status of unproductive contigs in is_valid function #287

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions vdj_ann/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ stats_utils = { version = "0.1", path = "../stats_utils" }
string_utils = { version = "0.1", path = "../string_utils" }
vector_utils = { version = "0.1", path = "../vector_utils" }
vdj_types = { version = "0.2", path = "../vdj_types" }
bitflags = "2.4.0"
18 changes: 7 additions & 11 deletions vdj_ann/src/annotate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,17 @@
use align_tools::affine_align;
use amino::{aa_seq, have_start};
use bio_edit::alignment::AlignmentOperation::{Del, Ins, Match, Subst, Xclip, Yclip};
use debruijn::{
dna_string::{DnaString, DnaStringSlice},
kmer::{Kmer12, Kmer20},
Mer, Vmer,
};
use debruijn::dna_string::{DnaString, DnaStringSlice};
use debruijn::kmer::{Kmer12, Kmer20};
use debruijn::{Mer, Vmer};
use io_utils::{fwrite, fwriteln};
use itertools::Itertools;
use serde::{Deserialize, Serialize};
use stats_utils::percent_ratio;
use std::cmp::{max, min};
use std::fmt::Write as _;
use std::{
cmp::{max, min},
fs::File,
io::{BufWriter, Write},
};
use std::fs::File;
use std::io::{BufWriter, Write};
use string_utils::{stringme, strme, TextUtils};
use vdj_types::{VdjChain, VdjRegion};
use vector_utils::{
Expand Down Expand Up @@ -228,16 +224,16 @@
}
}

pub fn annotate_seq_core(
b: &DnaString,
refdata: &RefData,
ann: &mut Vec<(i32, i32, i32, i32, i32)>,
allow_weak: bool,
allow_improper: bool,
abut: bool,
log: &mut Vec<u8>,
verbose: bool,
) {

Check warning on line 236 in vdj_ann/src/annotate.rs

View workflow job for this annotation

GitHub Actions / rust

this function has too many arguments (8/7)

warning: this function has too many arguments (8/7) --> vdj_ann/src/annotate.rs:227:1 | 227 | / pub fn annotate_seq_core( 228 | | b: &DnaString, 229 | | refdata: &RefData, 230 | | ann: &mut Vec<(i32, i32, i32, i32, i32)>, ... | 235 | | verbose: bool, 236 | | ) { | |__^ | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#too_many_arguments = note: `#[warn(clippy::too_many_arguments)]` on by default
// The DNA string representation is inefficient because it stores bases as packed k-mers
// which requires a lot of array bounds checks when unpacking which was a hot path
// we found when profiling the CI job. To avoid those in the inner
Expand Down Expand Up @@ -1596,8 +1592,8 @@
// deletion. Be very careful to respect this if editing!

let (mut win1, mut win2) = (false, false);
let c1 = m1 == m2 && !have_utr_align2 && err1_nu == err2_nu && outside1 > outside2;

Check warning on line 1595 in vdj_ann/src/annotate.rs

View workflow job for this annotation

GitHub Actions / rust

strict comparison of `f32` or `f64`

warning: strict comparison of `f32` or `f64` --> vdj_ann/src/annotate.rs:1595:54 | 1595 | let c1 = m1 == m2 && !have_utr_align2 && err1_nu == err2_nu && outside1 > outside2; | ^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(err1_nu - err2_nu).abs() < error_margin` | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#float_cmp = note: requested on the command line with `-W clippy::float-cmp`
let c2 = m2 == m1 && !have_utr_align1 && err2_nu == err1_nu && outside2 > outside1;

Check warning on line 1596 in vdj_ann/src/annotate.rs

View workflow job for this annotation

GitHub Actions / rust

strict comparison of `f32` or `f64`

warning: strict comparison of `f32` or `f64` --> vdj_ann/src/annotate.rs:1596:54 | 1596 | let c2 = m2 == m1 && !have_utr_align1 && err2_nu == err1_nu && outside2 > outside1; | ^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(err2_nu - err1_nu).abs() < error_margin` | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#float_cmp
if (zstop1 > zstop2 + 20 && (outside2 <= 10.0 || total2 - share <= 10))
|| (outside1 >= 10.0 && outside2 <= 1.0 && err1 - err2 <= 2.5)
{
Expand All @@ -1606,8 +1602,8 @@
} else if (outside2 <= 10.0 || total2 - share <= 10)
&& (m1 < m2
|| (m1 == m2 && err1 < err2 && !c2)
|| (m1 == m2 && err1 == err2 && outside1 > outside2)

Check warning on line 1605 in vdj_ann/src/annotate.rs

View workflow job for this annotation

GitHub Actions / rust

strict comparison of `f32` or `f64`

warning: strict comparison of `f32` or `f64` --> vdj_ann/src/annotate.rs:1605:37 | 1605 | || (m1 == m2 && err1 == err2 && outside1 > outside2) | ^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(err1 - err2).abs() < error_margin` | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#float_cmp
|| (m1 == m2 && err1 == err2 && outside1 == outside2 && t1 < t2)

Check warning on line 1606 in vdj_ann/src/annotate.rs

View workflow job for this annotation

GitHub Actions / rust

strict comparison of `f32` or `f64`

warning: strict comparison of `f32` or `f64` --> vdj_ann/src/annotate.rs:1606:37 | 1606 | || (m1 == m2 && err1 == err2 && outside1 == outside2 && t1 < t2) | ^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(err1 - err2).abs() < error_margin` | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#float_cmp

Check warning on line 1606 in vdj_ann/src/annotate.rs

View workflow job for this annotation

GitHub Actions / rust

strict comparison of `f32` or `f64`

warning: strict comparison of `f32` or `f64` --> vdj_ann/src/annotate.rs:1606:53 | 1606 | || (m1 == m2 && err1 == err2 && outside1 == outside2 && t1 < t2) | ^^^^^^^^^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(outside1 - outside2).abs() < error_margin` | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#float_cmp
|| c1)
{
win1 = true;
Expand All @@ -1623,8 +1619,8 @@
} else if (outside1 <= 10.0 || total1 - share <= 10)
&& (m2 < m1
|| (m2 == m1 && err2 < err1 && !c1)
|| (m2 == m1 && err2 == err1 && outside2 > outside1)

Check warning on line 1622 in vdj_ann/src/annotate.rs

View workflow job for this annotation

GitHub Actions / rust

strict comparison of `f32` or `f64`

warning: strict comparison of `f32` or `f64` --> vdj_ann/src/annotate.rs:1622:37 | 1622 | || (m2 == m1 && err2 == err1 && outside2 > outside1) | ^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(err2 - err1).abs() < error_margin` | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#float_cmp
|| (m2 == m1 && err2 == err1 && outside2 == outside1 && t2 < t1)

Check warning on line 1623 in vdj_ann/src/annotate.rs

View workflow job for this annotation

GitHub Actions / rust

strict comparison of `f32` or `f64`

warning: strict comparison of `f32` or `f64` --> vdj_ann/src/annotate.rs:1623:37 | 1623 | || (m2 == m1 && err2 == err1 && outside2 == outside1 && t2 < t1) | ^^^^^^^^^^^^ help: consider comparing them within some margin of error: `(err2 - err1).abs() < error_margin` | = note: `f32::EPSILON` and `f64::EPSILON` are available for the `error_margin` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#float_cmp
|| c2)
{
win2 = true;
Expand Down Expand Up @@ -3179,7 +3175,7 @@
let mut ann = Vec::<(i32, i32, i32, i32, i32)>::new();
annotate_seq(b, refdata, &mut ann, true, false, true);
let mut log = Vec::<u8>::new();
let productive = is_valid(b, refdata, &ann, false, &mut log, is_gd);
let productive = is_valid(b, refdata, &ann, false, &mut log, is_gd).productive;
ContigAnnotation::from_annotate_seq(
b,
q,
Expand Down
Loading
Loading