| 1 | #include "algorithm" |
| 2 | #include "iostream" |
| 3 | #include "vector" |
| 4 | |
| 5 | #ifndef suffix_tree |
| 6 | #define suffix_tree |
| 7 | |
| 8 | const std::string alphabet = "ATGCRYSWKMBDHVN-X#@"; |
| 9 | const unsigned int MAX_CHAR = alphabet.length(); |
| 10 | const int MAX_SIZE = 300; |
| 11 | const int MIN_LENGTH = 3; |
| 12 | const int MAX_MISMATCHES = 2; |
| 13 | |
| 14 | class suffix_node { |
| 15 | public: |
| 16 | int begin, nchildren, *end; |
| 17 | suffix_node **children, *parent, *suffix_link; |
| 18 | suffix_node(int b, int *e, suffix_node *p, suffix_node *l); |
| 19 | bool is_leaf_node(); |
| 20 | bool contains_child(int ext); |
| 21 | int get_length(); |
| 22 | int get_depth(); |
| 23 | std::string get_longest_common_substring(std::string s1, std::string s2); |
| 24 | std::string get_path(std::string s); |
| 25 | void extend_path(int *e); |
| 26 | suffix_node *add_child(int ext, int b, int *e, suffix_node *l); |
| 27 | void add_child(suffix_node *c, int ext); |
| 28 | suffix_node *get_child(int ext); |
| 29 | bool contains_depth(int depth); |
| 30 | void print(std::string s); |
| 31 | bool walk_next(int &beg, int &suffix_length); |
| 32 | }; |
| 33 | |
| 34 | suffix_node *build_suffix_tree(std::string s); |
| 35 | std::string get_reverse_complement(std::string rev_read); |
| 36 | std::vector<std::string> read_adapters_from_fasta(std::string p, std::string n); |
| 37 | int trim_adapter(std::string f1, std::string f2, std::string adp_path, |
| 38 | std::string p); |
| 39 | |
| 40 | #endif |