Thomas 1 year ago
parent
commit
8f851f3bbb
2 changed files with 3 additions and 4 deletions
  1. 2 3
      src/bin.rs
  2. 1 1
      src/lib.rs

+ 2 - 3
src/bin.rs

@@ -271,7 +271,7 @@ fn compute_mad(data: &[f64], median: f64) -> f64 {
     compute_median(&deviations)
 }
 
-pub fn scan_outliers(bam_path: &str, contig: &str, start: u32, end: u32, length: u32) -> Vec<(String, usize, f64, bool, f64, bool)> {
+pub fn scan_outliers(bam_path: &str, contig: &str, start: u32, end: u32, length: u32) -> Vec<(u32, usize, f64, bool, f64, bool)> {
     let mut starts = Vec::new();
     let mut current = start;
     while current <= end {
@@ -318,10 +318,9 @@ pub fn scan_outliers(bam_path: &str, contig: &str, start: u32, end: u32, length:
     let filtered_se_indices = filter_outliers_modified_z_score_with_indices(se_ratios, indices);
 
     ratios.iter().map(|(p, n, sa, se)| {
-        let end = p + length - 1;
         let sa_outlier = filtered_sa_indices.contains(p);
         let se_outlier = filtered_se_indices.contains(p);
-        (format!("{contig}:{p}-{end}"), *n, *sa, sa_outlier, *se, se_outlier)
+        (*p, *n, *sa, sa_outlier, *se, se_outlier)
 
     }).collect()
 }

+ 1 - 1
src/lib.rs

@@ -252,6 +252,6 @@ mod tests {
         scan_outliers(&diag_bam_path, contig, start, end, bin_length)
             .iter()
             .filter(|(_, _, _, sa_outlier, _, se_outlier)| *sa_outlier || *se_outlier)
-            .for_each(|(pos, n, sa, _, se, _)| info!("{pos}\t{n}\t{sa}\t{se}"));
+            .for_each(|(pos, n, sa, _, se, _)| info!("{}:{pos}-{}\t{n}\t{sa}\t{se}", contig, pos + bin_length - 1));
     }
 }