|
|
@@ -442,7 +442,7 @@ impl NeoContig {
|
|
|
self.alignments = alignments;
|
|
|
}
|
|
|
|
|
|
- pub fn make_aln (&self) -> Vec<Vec<u8>> {
|
|
|
+ pub fn make_aln (&self, print_sequences: Option<bool>) -> Vec<Vec<u8>> {
|
|
|
println!("== {} ============", self.name);
|
|
|
let contig_len = self.contig.len();
|
|
|
let mut lines: Vec<Vec<u8>> = Vec::new();
|
|
|
@@ -490,20 +490,22 @@ impl NeoContig {
|
|
|
lines.push(contig.clone());
|
|
|
|
|
|
// Sequences
|
|
|
- if self.stretch.len() > 0 {
|
|
|
- let decal = -self.stretch[0].1; // first have to be leftmost
|
|
|
- for (node_index, offset) in self.stretch.iter() {
|
|
|
- let seq = self.sequences.get(&node_index).unwrap();
|
|
|
- let name = self.sequences_names.get(&node_index).unwrap();
|
|
|
- let mut l = format!("{}{}", " ".repeat((offset + decal) as usize).to_string(), seq).as_bytes().to_vec();
|
|
|
- let mut ll = format!("{} - {}", " ".repeat(contig_len - l.len()).to_string(), name).as_bytes().to_vec();
|
|
|
- l.append(&mut ll);
|
|
|
- lines.push(l);
|
|
|
+ if let Some(show_seq) = print_sequences {
|
|
|
+ if show_seq && self.stretch.len() > 0 {
|
|
|
+ let decal = -self.stretch[0].1; // first have to be leftmost
|
|
|
+ for (node_index, offset) in self.stretch.iter() {
|
|
|
+ let seq = self.sequences.get(&node_index).unwrap();
|
|
|
+ let name = self.sequences_names.get(&node_index).unwrap();
|
|
|
+ let mut l = format!("{}{}", " ".repeat((offset + decal) as usize).to_string(), seq).as_bytes().to_vec();
|
|
|
+ let mut ll = format!("{} - {}", " ".repeat(contig_len - l.len()).to_string(), name).as_bytes().to_vec();
|
|
|
+ l.append(&mut ll);
|
|
|
+ lines.push(l);
|
|
|
+ }
|
|
|
}
|
|
|
+ // Contig
|
|
|
+ lines.push(contig);
|
|
|
}
|
|
|
-
|
|
|
- // Contig
|
|
|
- lines.push(contig);
|
|
|
+
|
|
|
|
|
|
// other ref
|
|
|
if self.alignments.len() > 1 {
|
|
|
@@ -538,14 +540,13 @@ impl NeoContig {
|
|
|
.collect();
|
|
|
l.append(&mut filtered_ref);
|
|
|
lines.push(l);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
lines
|
|
|
}
|
|
|
|
|
|
pub fn print_stretch(&self) {
|
|
|
- for line in self.make_aln() {
|
|
|
+ for line in self.make_aln(Some(false)) {
|
|
|
println!("{}", String::from_utf8_lossy(&line));
|
|
|
}
|
|
|
}
|