|
|
@@ -1,5 +1,4 @@
|
|
|
use duct::cmd;
|
|
|
-use faimm::IndexedFasta;
|
|
|
|
|
|
fn main() {
|
|
|
let ref_path = "/home/thomas/NGS/ref/hg19.fa";
|
|
|
@@ -291,19 +290,19 @@ pub fn format_seq(name: &str, sequence: &str, line_size: usize) -> String {
|
|
|
format!(">{name}\n{res}")
|
|
|
}
|
|
|
|
|
|
-pub fn compose_seq(ref_path: &str, ranges: Vec<(String, i32, i32)>) -> String {
|
|
|
- let fa = IndexedFasta::from_file(ref_path).expect("Error opening fa");
|
|
|
+// pub fn compose_seq(ref_path: &str, ranges: Vec<(String, i32, i32)>) -> String {
|
|
|
+// let fa = IndexedFasta::from_file(ref_path).expect("Error opening fa");
|
|
|
|
|
|
- let mut sequence = String::new();
|
|
|
- for (contig, start, stop) in ranges {
|
|
|
- let chr_index = fa.fai().tid(&contig).expect("Cannot find chr in index");
|
|
|
- if start < stop {
|
|
|
- let v = fa.view(chr_index, start as usize,stop as usize).expect("Cannot get .fa view");
|
|
|
- sequence = format!("{}{}", sequence, v.to_string());
|
|
|
- } else {
|
|
|
- let v = fa.view(chr_index, stop as usize, start as usize).expect("Cannot get .fa view");
|
|
|
- sequence = format!("{}{}", sequence, revcomp(&v.to_string()));
|
|
|
- }
|
|
|
- }
|
|
|
- sequence
|
|
|
-}
|
|
|
+// let mut sequence = String::new();
|
|
|
+// for (contig, start, stop) in ranges {
|
|
|
+// let chr_index = fa.fai().tid(&contig).expect("Cannot find chr in index");
|
|
|
+// if start < stop {
|
|
|
+// let v = fa.view(chr_index, start as usize,stop as usize).expect("Cannot get .fa view");
|
|
|
+// sequence = format!("{}{}", sequence, v.to_string());
|
|
|
+// } else {
|
|
|
+// let v = fa.view(chr_index, stop as usize, start as usize).expect("Cannot get .fa view");
|
|
|
+// sequence = format!("{}{}", sequence, revcomp(&v.to_string()));
|
|
|
+// }
|
|
|
+// }
|
|
|
+// sequence
|
|
|
+// }
|