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 nspecies; |
---|
30 | long nsets; |
---|
31 | |
---|
32 | AWT_species_set **sets; |
---|
33 | int diff_bits[256]; |
---|
34 | |
---|
35 | arb_progress *progress; |
---|
36 | GBDATA *gb_main; |
---|
37 | GB_HASH *species_hash; |
---|
38 | |
---|
39 | public: |
---|
40 | AWT_species_set_root(GBDATA *gb_main, long nspecies_, arb_progress *progress_); |
---|
41 | ~AWT_species_set_root(); |
---|
42 | |
---|
43 | void add(const char *species_name); // max nspecies |
---|
44 | void add(AWT_species_set *set); // max 2 * nspecies !!! |
---|
45 | AWT_species_set *search_best_match(const AWT_species_set *set, long& best_cost); |
---|
46 | int search_and_remember_best_match_and_log_errors(const AWT_species_set *set, FILE *log_file); |
---|
47 | GB_ERROR copy_node_information(FILE *log, bool delete_old_nodes, bool nodes_with_marked_only); |
---|
48 | AWT_species_set *find_best_matches_info(AP_tree *tree_source, FILE *log, bool setinner_node); |
---|
49 | AWT_species_set *move_tree_2_ssr(AP_tree *node); |
---|
50 | |
---|
51 | void finish(GB_ERROR& error); |
---|
52 | |
---|
53 | long bitstring_bytes() const { return nspecies/8 + 1; } |
---|
54 | long bitstring_longs() const { return bitstring_bytes()/sizeof(long) + 1; } |
---|
55 | |
---|
56 | long get_species_index(const char *species_name) const { return GBS_read_hash(species_hash, species_name); } |
---|
57 | }; |
---|
58 | |
---|
59 | |
---|
60 | class AWT_species_set : virtual Noncopyable { |
---|
61 | void init(AP_tree *nodei, const AWT_species_set_root *ssr); |
---|
62 | public: |
---|
63 | // @@@ make member private |
---|
64 | unsigned char *bitstring; |
---|
65 | |
---|
66 | int unfound_species_count; |
---|
67 | double best_cost; |
---|
68 | AP_tree *best_node; |
---|
69 | AP_tree *node; |
---|
70 | |
---|
71 | // REAL PUBLIC: |
---|
72 | |
---|
73 | AWT_species_set(AP_tree *nodei, const AWT_species_set_root *ssr, const char *species_name); |
---|
74 | 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 |
---|
75 | ~AWT_species_set(); |
---|
76 | |
---|
77 | bool is_leaf_set() const { return node && node->is_leaf(); } // @@@ might be wrong for zombies |
---|
78 | }; |
---|
79 | |
---|
80 | #else |
---|
81 | #error NT_species_set.h included twice |
---|
82 | #endif // NT_SPECIES_SET_H |
---|