-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
extern crate clap; | ||
use std::collections::HashMap; | ||
|
||
use clap::{arg, Command}; | ||
use bio::io::fasta; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
use std::collections::HashMap; | ||
|
||
pub type NodeID = usize; | ||
pub type StringID = usize; | ||
|
||
pub trait SuffixNode<T> { | ||
fn set_parent(&mut self, parent: NodeID); | ||
fn get_parent(&self)->Option<&NodeID>; | ||
fn get_child(&self, child:&T)->Option<&NodeID>; | ||
fn get_child_mut(&mut self, child:&T)->Option<&mut NodeID>; | ||
fn set_child(&mut self, edge:T, child:NodeID); | ||
fn set_edge_length(&mut self, edge_length:usize); | ||
fn get_end(&self)->usize; | ||
fn get_edge_length(&self)-> usize; | ||
fn get_string_id(&self)->Option<&StringID>; | ||
fn set_string_id(&mut self, string_id:StringID); | ||
fn get_start(&self)->&usize; | ||
fn set_start(&mut self, new_start:usize); | ||
fn has_children(&self)->bool; | ||
fn get_children(&self)->&HashMap<T, NodeID>; | ||
fn is_leaf(&self)->bool; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
use crate::suffix_node::node::*; | ||
use std::collections::LinkedList; | ||
|
||
pub trait SuffixTree<T>{ | ||
fn root(&self)->&NodeID; | ||
fn is_leaf(&self, node_id: &NodeID)->bool; | ||
fn get_node_child(&self, node_id: &NodeID, edge_label: &T)->Option<&NodeID>; | ||
fn get_node_parent(&self, node_id: &NodeID)->Option<&NodeID>; | ||
fn get_node_depth(&self, node_id: &NodeID)->usize; | ||
fn get_suffix_link(&self, node_id: &NodeID) -> &usize; | ||
fn get_node_label(&self, node_id: &NodeID)->&[T]; | ||
fn get_node_path_label(&self, node_id: &NodeID)->&[T]; | ||
fn get_node_path(&self, node_id: &NodeID)->LinkedList<NodeID>; | ||
/// Checks if the input slice is a suffix of any of the strings present in the tree. | ||
fn is_suffix(&self, s:&[T])->bool; | ||
} |