|
|
@@ -112,7 +112,7 @@ impl Cigar {
|
|
|
pub struct Alignments {
|
|
|
pub query_sequence : String,
|
|
|
pub sam : Vec<Sam>,
|
|
|
- pub ranges : Vec<Vec<((i32, i32), (i32, i32))>>,
|
|
|
+ pub ranges : Vec<Vec<((String, i32, i32), (i32, i32))>>,
|
|
|
}
|
|
|
|
|
|
impl Alignments {
|
|
|
@@ -121,7 +121,14 @@ impl Alignments {
|
|
|
|
|
|
let mut res_ranges = Vec::new();
|
|
|
for sam in &res_sam {
|
|
|
- res_ranges.push(ranges_from_cigar(sam.pos, sam.cigar.clone(), sam.is_rc()));
|
|
|
+ res_ranges.push(
|
|
|
+ ranges_from_cigar(sam.pos, sam.cigar.clone(), sam.is_rc())
|
|
|
+ .into_iter()
|
|
|
+ .map(|(reference, query)| {
|
|
|
+ ((sam.ref_name.clone(), reference.0, reference.1), query)
|
|
|
+ })
|
|
|
+ .collect()
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
Alignments {
|
|
|
@@ -130,6 +137,9 @@ impl Alignments {
|
|
|
ranges: res_ranges
|
|
|
}
|
|
|
}
|
|
|
+ pub fn get_ranges(&self) {
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
pub fn revcomp(dna: &str) -> String {
|
|
|
@@ -262,7 +272,7 @@ mod tests {
|
|
|
let alns = Alignments::to_reference(&sequence, ref_path);
|
|
|
assert_eq!(
|
|
|
alns.ranges,
|
|
|
- vec![vec![((43453321, 43453131), (1, 191))], vec![((22908007, 22908123), (195, 311))]]
|
|
|
+ vec![vec![(("chr2".to_string(), 43453321, 43453131), (1, 191))], vec![(("chr14".to_string(), 22908007, 22908123), (195, 311))]]
|
|
|
);
|
|
|
}
|
|
|
#[test]
|
|
|
@@ -283,7 +293,7 @@ mod tests {
|
|
|
|
|
|
assert_eq!(
|
|
|
alns.ranges,
|
|
|
- vec![vec![((22908232, 22908007), (1, 226))], vec![((43453131, 43453227), (230, 326))]]
|
|
|
+ vec![vec![(("chr14".to_string(), 22908232, 22908007), (1, 226))], vec![(("chr2".to_string(), 43453131, 43453227), (230, 326))]]
|
|
|
);
|
|
|
}
|
|
|
}
|