Thomas vor 1 Jahr
Ursprung
Commit
069b8e9478
1 geänderte Dateien mit 5 neuen und 0 gelöschten Zeilen
  1. 5 0
      src/bin.rs

+ 5 - 0
src/bin.rs

@@ -14,6 +14,7 @@ pub struct Bin {
     pub end: u32,
     pub reads_store: HashMap<Vec<u8>, Record>,
     pub bam_reader: IndexedReader,
+    pub n_low_mapq: u32,
 }
 
 impl Bin {
@@ -30,10 +31,12 @@ impl Bin {
         bam_reader.fetch((contig, start, end))?;
 
         let mut reads_store: HashMap<Vec<u8>, Record> = HashMap::new();
+        let mut n_low_mapq = 0;
         for read in bam_reader.records() {
             let record = read.context("Error while parsing record")?;
             // Skip reads with low mapping quality
             if record.mapq() < mapq {
+                n_low_mapq += 1;
                 continue;
             }
             reads_store.insert(record.qname().to_vec(), record);
@@ -44,6 +47,7 @@ impl Bin {
             end,
             reads_store,
             bam_reader,
+            n_low_mapq,
         })
     }
 
@@ -226,6 +230,7 @@ fn compute_mad(data: &[f64], median: f64) -> f64 {
     compute_median(&deviations)
 }
 
+// TODO add n_low_mapq
 pub fn scan_outliers(
     bam_path: &str,
     contig: &str,