Browse Source

Fix sub constit del depth

Thomas 7 months ago
parent
commit
8783ace12a
1 changed files with 16 additions and 16 deletions
  1. 16 16
      src/variant/variant_collection.rs

+ 16 - 16
src/variant/variant_collection.rs

@@ -498,8 +498,8 @@ impl VariantCollection {
                                         let seq = crate::io::fasta::sequence_range(
                                             &mut fasta_reader,
                                             &var.position.contig(),
-                                            del_repr.start as usize - 1,
-                                            del_repr.end as usize - 1,
+                                            del_repr.start.saturating_sub(1) as usize,
+                                            del_repr.end.saturating_sub(1) as usize,
                                         )?;
 
                                         match detect_repetition(&seq) {
@@ -512,8 +512,8 @@ impl VariantCollection {
                                     };
                                     // println!("TOL {tol}");
 
-                                    let end_qnames: Vec<Vec<u8>> = pileup_end
-                                        .iter()
+                                    // let end_qnames: Vec<Vec<u8>> = pileup_end
+                                    //     .iter()
                                         // .inspect(|e| {
                                         //     if let crate::collection::bam::PileBase::Del((_, l)) =
                                         //         e
@@ -521,22 +521,22 @@ impl VariantCollection {
                                         //         println!("{l}");
                                         //     }
                                         // })
-                                        .filter_map(|e| match e {
-                                            crate::collection::bam::PileBase::Del((qn, l))
-                                                if *l >= len.saturating_sub(tol).max(1)
-                                                    && *l <= len + tol =>
-                                            {
-                                                Some(qn.to_vec())
-                                            }
-                                            _ => None,
-                                        })
-                                        .collect();
+                                        // .filter_map(|e| match e {
+                                        //     crate::collection::bam::PileBase::Del((qn, l))
+                                        //         if *l >= len.saturating_sub(tol).max(1)
+                                        //             && *l <= len + tol =>
+                                        //     {
+                                        //         Some(qn.to_vec())
+                                        //     }
+                                        //     _ => None,
+                                        // })
+                                        // .collect();
                                     // println!("ends {}", end_qnames.len());
 
                                     let alt: u32 = pileup_start
                                         .iter()
                                         .map(|pb| match pb {
-                                            crate::collection::bam::PileBase::Del((qn, l))
+                                            crate::collection::bam::PileBase::Del((_qn, l))
                                                 if /* end_qnames.contains(qn) */
                                                      *l >= len.saturating_sub(tol).max(1)
                                                     && *l <= len + tol =>
@@ -549,7 +549,7 @@ impl VariantCollection {
 
                                     let depth = pileup_start.len().min(pileup_end.len());
 
-                                    debug!("{} {alt} / {depth} {len}", var.variant_id());
+                                    // debug!("{} {alt} / {depth} {len}", var.variant_id());
 
                                     anns.push(Annotation::ConstitAlt(alt as u16));
                                     anns.push(Annotation::ConstitDepth(depth as u16));