Skip to content

Commit 2eac8d7

Browse files
committed
style(derive/junction-annotation): group reported junctions by contig
1 parent 9be3850 commit 2eac8d7

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/derive/junction_annotation/results.rs

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,35 +41,42 @@ pub struct JunctionAnnotations {
4141
pub unannotated_reference: JunctionsMap,
4242
}
4343

44-
// TODO: This is a temporary implementation. It should be replaced with something better.
4544
impl Serialize for JunctionAnnotations {
4645
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
4746
let mut known = Vec::new();
4847
for (ref_name, junctions) in &self.known {
48+
let mut junctions_vec = Vec::new();
4949
for ((start, end), count) in junctions {
50-
known.push((ref_name, start.get(), end.get(), count));
50+
junctions_vec.push((start.get(), end.get(), count));
5151
}
52+
known.push((ref_name.clone(), junctions_vec));
5253
}
5354

5455
let mut partial_novel = Vec::new();
5556
for (ref_name, junctions) in &self.partial_novel {
57+
let mut junctions_vec = Vec::new();
5658
for ((start, end), count) in junctions {
57-
partial_novel.push((ref_name, start.get(), end.get(), count));
59+
junctions_vec.push((start.get(), end.get(), count));
5860
}
61+
partial_novel.push((ref_name.clone(), junctions_vec));
5962
}
6063

6164
let mut complete_novel = Vec::new();
6265
for (ref_name, junctions) in &self.complete_novel {
66+
let mut junctions_vec = Vec::new();
6367
for ((start, end), count) in junctions {
64-
complete_novel.push((ref_name, start.get(), end.get(), count));
68+
junctions_vec.push((start.get(), end.get(), count));
6569
}
70+
complete_novel.push((ref_name.clone(), junctions_vec));
6671
}
6772

6873
let mut unannotated_reference = Vec::new();
6974
for (ref_name, junctions) in &self.unannotated_reference {
75+
let mut junctions_vec = Vec::new();
7076
for ((start, end), count) in junctions {
71-
unannotated_reference.push((ref_name, start.get(), end.get(), count));
77+
junctions_vec.push((start.get(), end.get(), count));
7278
}
79+
unannotated_reference.push((ref_name.clone(), junctions_vec));
7380
}
7481

7582
let mut s = serializer.serialize_struct("JunctionAnnotations", 4)?;

0 commit comments

Comments
 (0)