diff --git a/vdj_ann/src/vdj_features.rs b/vdj_ann/src/vdj_features.rs index 579fac6d..d35260fb 100644 --- a/vdj_ann/src/vdj_features.rs +++ b/vdj_ann/src/vdj_features.rs @@ -466,9 +466,11 @@ pub fn fr3_start(aa: &[u8], chain_type: &str, verbose: bool) -> Option { ]; // Score positions. - + if cdr3_start < 42 - 2 { + return None; + } let mut score_pos = Vec::<(usize, isize)>::with_capacity(42 - 32 + 1); - for j in cdr3_start.saturating_sub(42 - 2)..=cdr3_start.saturating_sub(32 - 2) { + for j in cdr3_start - (42 - 2)..=cdr3_start - (32 - 2) { let mut score = 0; for (p, wm) in pwm.iter().enumerate() { for l in wm { @@ -525,7 +527,9 @@ pub fn fr3_start(aa: &[u8], chain_type: &str, verbose: bool) -> Option { ]; // Score positions. - + if cdr3_start < 36 { + return None; + } let mut score_pos = Vec::<(usize, usize)>::with_capacity(36 - 33 + 1); for j in cdr3_start - 36..=cdr3_start - 33 { let mut score = 0; @@ -569,7 +573,9 @@ pub fn fr3_start(aa: &[u8], chain_type: &str, verbose: bool) -> Option { ]; // Score positions. - + if cdr3_start < 38 { + return None; + } let mut score_pos = Vec::<(usize, usize)>::with_capacity(38 - 35 + 1); for j in cdr3_start - 38..=cdr3_start - 35 { let mut score = 0;