| 1 | // =============================================================== // |
|---|
| 2 | // // |
|---|
| 3 | // File : NT_species_set.h // |
|---|
| 4 | // Purpose : // |
|---|
| 5 | // // |
|---|
| 6 | // Institute of Microbiology (Technical University Munich) // |
|---|
| 7 | // http://www.arb-home.de/ // |
|---|
| 8 | // // |
|---|
| 9 | // =============================================================== // |
|---|
| 10 | |
|---|
| 11 | #ifndef NT_SPECIES_SET_H |
|---|
| 12 | #define NT_SPECIES_SET_H |
|---|
| 13 | |
|---|
| 14 | #ifndef NT_TREE_CMP_H |
|---|
| 15 | #include "NT_tree_cmp.h" |
|---|
| 16 | #endif |
|---|
| 17 | #ifndef ARBTOOLS_H |
|---|
| 18 | #include <arbtools.h> |
|---|
| 19 | #endif |
|---|
| 20 | #ifndef AP_TREE_HXX |
|---|
| 21 | #include <AP_Tree.hxx> |
|---|
| 22 | #endif |
|---|
| 23 | |
|---|
| 24 | class AWT_species_set; |
|---|
| 25 | class arb_progress; |
|---|
| 26 | |
|---|
| 27 | class AWT_species_set_root : virtual Noncopyable { |
|---|
| 28 | long species_counter; |
|---|
| 29 | long nsets; |
|---|
| 30 | AWT_species_set **sets; |
|---|
| 31 | int diff_bits[256]; |
|---|
| 32 | |
|---|
| 33 | arb_progress *progress; |
|---|
| 34 | |
|---|
| 35 | public: |
|---|
| 36 | long nspecies; |
|---|
| 37 | GBDATA *gb_main; |
|---|
| 38 | GB_HASH *species_hash; |
|---|
| 39 | |
|---|
| 40 | // REAL PUBLIC |
|---|
| 41 | AWT_species_set_root(GBDATA *gb_main, long nspecies, arb_progress *progress_); |
|---|
| 42 | ~AWT_species_set_root(); |
|---|
| 43 | |
|---|
| 44 | void add(const char *species_name); // max nspecies |
|---|
| 45 | void add(AWT_species_set *set); // max 2 * nspecies !!! |
|---|
| 46 | AWT_species_set *search_best_match(const AWT_species_set *set, long& best_cost); |
|---|
| 47 | int search_and_remember_best_match_and_log_errors(const AWT_species_set *set, FILE *log_file); |
|---|
| 48 | GB_ERROR copy_node_information(FILE *log, bool delete_old_nodes, bool nodes_with_marked_only); |
|---|
| 49 | AWT_species_set *find_best_matches_info(AP_tree *tree_source, FILE *log, bool setinner_node); |
|---|
| 50 | AWT_species_set *move_tree_2_ssr(AP_tree *node); |
|---|
| 51 | |
|---|
| 52 | void finish(GB_ERROR& error); |
|---|
| 53 | |
|---|
| 54 | long bitstring_bytes() const { return nspecies/8 + 1; } |
|---|
| 55 | long bitstring_longs() const { return bitstring_bytes()/sizeof(long) + 1; } |
|---|
| 56 | }; |
|---|
| 57 | |
|---|
| 58 | |
|---|
| 59 | class AWT_species_set : virtual Noncopyable { |
|---|
| 60 | void init(AP_tree *nodei, const AWT_species_set_root *ssr); |
|---|
| 61 | public: |
|---|
| 62 | // @@@ make member private |
|---|
| 63 | unsigned char *bitstring; |
|---|
| 64 | |
|---|
| 65 | int unfound_species_count; |
|---|
| 66 | double best_cost; |
|---|
| 67 | AP_tree *best_node; |
|---|
| 68 | AP_tree *node; |
|---|
| 69 | |
|---|
| 70 | // REAL PUBLIC: |
|---|
| 71 | |
|---|
| 72 | AWT_species_set(AP_tree *nodei, const AWT_species_set_root *ssr, const char *species_name); |
|---|
| 73 | AWT_species_set(AP_tree *nodei, const AWT_species_set_root *ssr, const AWT_species_set *l, const AWT_species_set *r); // or of two subsets |
|---|
| 74 | ~AWT_species_set(); |
|---|
| 75 | |
|---|
| 76 | bool is_leaf_set() const { return node && node->is_leaf; } // @@@ might be wrong for zombies |
|---|
| 77 | }; |
|---|
| 78 | |
|---|
| 79 | #else |
|---|
| 80 | #error NT_species_set.h included twice |
|---|
| 81 | #endif // NT_SPECIES_SET_H |
|---|