Thomas 3 年之前
父节点
当前提交
62c6b43e43
共有 1 个文件被更改,包括 12 次插入15 次删除
  1. 12 15
      src/lib.rs

+ 12 - 15
src/lib.rs

@@ -126,7 +126,7 @@ impl SequencesGraph {
         }
     }
 
-    pub fn draw_edges (&mut self) {
+    pub fn draw_edges (&mut self) { 
         let idx: Vec<NodeIndex> = self.graph.node_indices().collect();
         let n_nodes = idx.len();
         for x in 0..n_nodes {
@@ -301,6 +301,7 @@ impl SequencesGraph {
         }
 
         if *res.last().unwrap() == b'N' {
+            println!("LAST RM");
             res.pop();
         }
         res
@@ -516,7 +517,6 @@ impl NeoContig {
             // Contig
             lines.push(contig);
         }
-        
 
         // other ref
         if self.alignments.len() > 1 {
@@ -524,7 +524,7 @@ impl NeoContig {
             let ref_spaces = " ".repeat(self.alignments[1].query_range.start).as_bytes().to_vec();
 
             // match pipes
-            let mut match_pipes = self.alignments[1].ref_cigar.as_bytes().iter().filter(|c| **c == b"M"[0]).map(|_| b"|"[0])
+            let mut match_pipes = self.alignments[1].ref_cigar.as_bytes().iter().filter(|c| **c == b'M').map(|_| b'|')
             .collect::<Vec<u8>>();
             let mut l = ref_spaces.clone();
             l.append(&mut match_pipes);
@@ -611,8 +611,6 @@ fn matched_range (cigar: &str, flag: &i32, matched_seq: &mut str) -> (Range<usiz
     let mut ref_pos = 0;
     let mut ref_cigar_string = "".to_string();
 
-    // let mut pos = 0;
-
     let mut first_m = true;
     let n_op = cigar.split("").filter(|c| all_op.contains(c)).count();
     let mut curr_op = 1;
@@ -657,9 +655,8 @@ fn matched_range (cigar: &str, flag: &i32, matched_seq: &mut str) -> (Range<usiz
                         let toadd = f.repeat(current_add);
                         ref_cigar_string.push_str(&toadd);
                     }
-                    // pos += current_add;
                 }
-            },
+            }
         }
     }
 
@@ -684,17 +681,17 @@ fn revcomp(dna: &str) -> String{
 
 fn switch_base(c:char) -> char {
     match c {
-        'a' => 't' ,
-        'c' => 'g' ,
-        't' => 'a' ,
-        'g' => 'c' ,
+        'a' => 't',
+        'c' => 'g',
+        't' => 'a',
+        'g' => 'c',
         'u' => 'a',
-        'A' => 'T' ,
-        'C' => 'G' ,
-        'T' => 'A' ,
+        'A' => 'T',
+        'C' => 'G',
+        'T' => 'A',
         'G' => 'C',
         'U' => 'A',
-        _ => 'N'
+        _   => 'N'
     }
 }