Thomas 2 years ago
parent
commit
bc5b3847fb
1 changed files with 5 additions and 6 deletions
  1. 5 6
      src/lib.rs

+ 5 - 6
src/lib.rs

@@ -1,6 +1,6 @@
 // MIT License
 
-// Copyright (c) [2022] [Thomas Stimlé]
+// Copyright (c) [2022] [Thomas Steimlé]
 
 // Permission is hereby granted, free of charge, to any person obtaining a copy
 // of this software and associated documentation files (the "Software"), to deal
@@ -20,7 +20,6 @@
 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 // SOFTWARE.
 
-
 use std::{ops::Range, collections::{HashMap, HashSet}};
 use petgraph::{graph::{Graph, NodeIndex, EdgeIndex}, Undirected};
 use kseq::parse_path;
@@ -657,13 +656,13 @@ impl NeoContig {
         .collect::<Vec<String>>()
         .join("\n");
 
-        let mut name = String::new();
+        let mut names: Vec<String> = Vec::new();
         for s in &self.alignments {
             // contig:[pos-pos]
-            name = format!("{}{}:{}-{}_", name, s.ref_name,
-            s.ref_range.start, s.ref_range.end - 1);
+            names.push(format!("{}{}:{}-{}", name, s.ref_name,
+            s.ref_range.start, s.ref_range.end - 1));
         }
-        format!(">{}\n{}", name, fa_lines)
+        format!(">{}\n{}", names.join("_"), fa_lines)
     }
 }
 pub struct Fasta {