|
|
@@ -648,8 +648,22 @@ impl NeoContig {
|
|
|
}
|
|
|
res
|
|
|
}
|
|
|
+
|
|
|
pub fn get_fasta(&self) -> String {
|
|
|
- String::new()
|
|
|
+ let res = String::new();
|
|
|
+ let fa_lines = self.contig.chars()
|
|
|
+ .collect::<Vec<char>>()
|
|
|
+ .chunks(60)
|
|
|
+ .map(|c| c.iter().collect::<String>())
|
|
|
+ .collect::<Vec<String>>()
|
|
|
+ .join("\n");
|
|
|
+
|
|
|
+ let mut name = String::new();
|
|
|
+ for s in self.alignments {
|
|
|
+ // contig:[pos-pos]
|
|
|
+ name = format!("{}{}:{}-{}_", name, s.ref_name, s.ref_range.0, s.ref_range.0 - 1);
|
|
|
+ }
|
|
|
+ format!(">{}\n{}", name, fa_lines)
|
|
|
}
|
|
|
}
|
|
|
pub struct Fasta {
|