|
|
@@ -1,9 +1,9 @@
|
|
|
-use std::{time::Instant, ops::Range, collections::{HashMap, HashSet}};
|
|
|
+use std::{ops::Range, collections::{HashMap, HashSet}};
|
|
|
use petgraph::{graph::{Graph, NodeIndex, EdgeIndex}, Undirected};
|
|
|
use kseq::parse_path;
|
|
|
use faimm::IndexedFasta;
|
|
|
|
|
|
-struct SequencesGraph {
|
|
|
+pub struct SequencesGraph {
|
|
|
sequences: HashMap<NodeIndex, String>,
|
|
|
seq_hash : HashSet<String>,
|
|
|
names : HashMap<NodeIndex, String>,
|
|
|
@@ -16,7 +16,7 @@ struct SequencesGraph {
|
|
|
|
|
|
}
|
|
|
#[derive(Debug)]
|
|
|
-struct Overlap {
|
|
|
+pub struct Overlap {
|
|
|
id_a : NodeIndex,
|
|
|
range_a: Range<usize>,
|
|
|
id_b : NodeIndex,
|
|
|
@@ -344,7 +344,7 @@ impl SequencesGraph {
|
|
|
}
|
|
|
|
|
|
#[derive(Debug, Clone)]
|
|
|
-struct Sam {
|
|
|
+pub struct Sam {
|
|
|
query_name : String,
|
|
|
query_range: Range<usize>,
|
|
|
ref_name : String,
|
|
|
@@ -356,7 +356,7 @@ struct Sam {
|
|
|
}
|
|
|
|
|
|
impl Sam {
|
|
|
- fn new(query_name: String, flag: i32, ref_name: String, ref_pos: i64, cigar: String, sequence: String, fa: &Fasta) -> Self {
|
|
|
+ pub fn new(query_name: String, flag: i32, ref_name: String, ref_pos: i64, cigar: String, sequence: String, fa: &Fasta) -> Self {
|
|
|
let mut sequence = sequence;
|
|
|
let (mut ref_range, mut query_range, ref_cigar) = matched_range(&cigar, &flag, &mut sequence);
|
|
|
|
|
|
@@ -377,7 +377,7 @@ impl Sam {
|
|
|
}
|
|
|
}
|
|
|
#[derive(Debug, Clone)]
|
|
|
-struct NeoContig {
|
|
|
+pub struct NeoContig {
|
|
|
sequence_id: usize,
|
|
|
name: String,
|
|
|
contig : String,
|
|
|
@@ -387,11 +387,11 @@ struct NeoContig {
|
|
|
stretch : Vec<(NodeIndex, i32)>,
|
|
|
}
|
|
|
|
|
|
-struct Fasta {
|
|
|
+pub struct Fasta {
|
|
|
fa: IndexedFasta
|
|
|
}
|
|
|
impl Fasta {
|
|
|
- fn new (path: &str) -> Self {
|
|
|
+ pub fn new (path: &str) -> Self {
|
|
|
Fasta { fa: IndexedFasta::from_file(path).expect("Error opening fa") }
|
|
|
}
|
|
|
fn get_sequence (&self, contig: &str, start: usize, end: usize) -> String { // end is included
|