1 | // =============================================================== // |
---|
2 | // // |
---|
3 | // File : phylo.hxx // |
---|
4 | // Purpose : // |
---|
5 | // // |
---|
6 | // Institute of Microbiology (Technical University Munich) // |
---|
7 | // http://www.arb-home.de/ // |
---|
8 | // // |
---|
9 | // =============================================================== // |
---|
10 | |
---|
11 | #ifndef PHYLO_HXX |
---|
12 | #define PHYLO_HXX |
---|
13 | |
---|
14 | #ifndef ARBDB_BASE_H |
---|
15 | #include <arbdb_base.h> |
---|
16 | #endif |
---|
17 | #ifndef AW_BASE_HXX |
---|
18 | #include <aw_base.hxx> |
---|
19 | #endif |
---|
20 | #ifndef AP_MATRIX_HXX |
---|
21 | #include <AP_matrix.hxx> |
---|
22 | #endif |
---|
23 | #ifndef PH_FILTER_HXX |
---|
24 | #include "PH_filter.hxx" |
---|
25 | #endif |
---|
26 | |
---|
27 | #define ph_assert(cond) arb_assert(cond) |
---|
28 | |
---|
29 | enum { |
---|
30 | DONT_COUNT = 0, |
---|
31 | SKIP_COLUMN_IF_MAX = 1, |
---|
32 | SKIP_COLUMN_IF_OCCUR = 2, |
---|
33 | COUNT_DONT_USE_MAX = 3, |
---|
34 | TREAT_AS_UPPERCASE = 4, |
---|
35 | TREAT_AS_REGULAR = 5, |
---|
36 | |
---|
37 | FILTER_MODES, // has to be last! |
---|
38 | }; |
---|
39 | |
---|
40 | |
---|
41 | #define PH_DB_CACHE_SIZE 2000000 |
---|
42 | |
---|
43 | #define AP_F_LOADED ((AW_active)1) |
---|
44 | #define AP_F_NLOADED ((AW_active)2) |
---|
45 | #define AP_F_SEQUENCES ((AW_active)4) |
---|
46 | #define AP_F_MATRIX ((AW_active)8) |
---|
47 | #define AP_F_TREE ((AW_active)16) |
---|
48 | #define AP_F_ALL ((AW_active)-1) |
---|
49 | |
---|
50 | #define PH_CORRECTION_BANDELT_STRING "bandelt" |
---|
51 | |
---|
52 | #define NIL 0 |
---|
53 | |
---|
54 | // matrix definitions |
---|
55 | #define PH_TRANSFORMATION_JUKES_CANTOR_STRING "J+C" |
---|
56 | #define PH_TRANSFORMATION_KIMURA_STRING "KIMURA" |
---|
57 | #define PH_TRANSFORMATION_TAJIMA_NEI_STRING "T+N" |
---|
58 | #define PH_TRANSFORMATION_TAJIMA_NEI_PAIRWISE_STRING "T+N-P" |
---|
59 | #define PH_TRANSFORMATION_BANDELT_STRING "B" |
---|
60 | #define PH_TRANSFORMATION_BANDELT_JC_STRING "B+J+C" |
---|
61 | #define PH_TRANSFORMATION_BANDELT2_STRING "B2" |
---|
62 | #define PH_TRANSFORMATION_BANDELT2_JC_STRING "B2+J+C" |
---|
63 | |
---|
64 | enum PH_CORRECTION { |
---|
65 | PH_CORRECTION_NONE, |
---|
66 | PH_CORRECTION_BANDELT |
---|
67 | }; |
---|
68 | |
---|
69 | |
---|
70 | enum { |
---|
71 | PH_GC_0, |
---|
72 | PH_GC_1, |
---|
73 | PH_GC_0_DRAG |
---|
74 | }; |
---|
75 | |
---|
76 | |
---|
77 | extern GBDATA *GLOBAL_gb_main; |
---|
78 | |
---|
79 | // make awars : |
---|
80 | void PH_create_matrix_variables(AW_root *aw_root, AW_default aw_def); |
---|
81 | void PH_create_filter_variables(AW_root *aw_root, AW_default aw_def); |
---|
82 | |
---|
83 | AW_window *PH_create_filter_window(AW_root *aw_root); |
---|
84 | |
---|
85 | |
---|
86 | |
---|
87 | enum display_type { NONE, species_dpy, filter_dpy, matrix_dpy, tree_dpy }; |
---|
88 | |
---|
89 | |
---|
90 | typedef double AP_FLOAT; |
---|
91 | |
---|
92 | enum PH_TRANSFORMATION { |
---|
93 | PH_TRANSFORMATION_NONE, |
---|
94 | PH_TRANSFORMATION_JUKES_CANTOR, |
---|
95 | PH_TRANSFORMATION_KIMURA, |
---|
96 | PH_TRANSFORMATION_TAJIMA_NEI, |
---|
97 | PH_TRANSFORMATION_TAJIMA_NEI_PAIRWISE, |
---|
98 | PH_TRANSFORMATION_BANDELT, |
---|
99 | PH_TRANSFORMATION_BANDELT_JC, |
---|
100 | PH_TRANSFORMATION_BANDELT2, |
---|
101 | PH_TRANSFORMATION_BANDELT2_JC |
---|
102 | }; |
---|
103 | |
---|
104 | // -------------------------- |
---|
105 | // class definitions |
---|
106 | // -------------------------- |
---|
107 | |
---|
108 | class PH_root { |
---|
109 | private: |
---|
110 | char *use; |
---|
111 | |
---|
112 | public: |
---|
113 | class AWT_graphic *display; |
---|
114 | GB_ERROR open(const char *db_server); |
---|
115 | GBDATA *gb_main; |
---|
116 | }; |
---|
117 | |
---|
118 | |
---|
119 | struct elem; |
---|
120 | |
---|
121 | class PHDATA : virtual Noncopyable { |
---|
122 | // connection to database |
---|
123 | // pointers to all elements and important values of the database |
---|
124 | |
---|
125 | struct PHENTRY { |
---|
126 | unsigned int key; |
---|
127 | char *name; |
---|
128 | char *full_name; |
---|
129 | GBDATA *gb_species_data_ptr; |
---|
130 | PHENTRY *next; |
---|
131 | PHENTRY *prev; |
---|
132 | int group_members; // >0: this elem is grouphead |
---|
133 | elem *first_member; // !=NULL: elem is grouphead |
---|
134 | bool selected; |
---|
135 | }; |
---|
136 | unsigned int last_key_number; |
---|
137 | long seq_len; |
---|
138 | |
---|
139 | AW_root *aw_root; // only link |
---|
140 | |
---|
141 | public: |
---|
142 | GBDATA *gb_main; |
---|
143 | char *use; |
---|
144 | PHENTRY *entries; |
---|
145 | PHENTRY **hash_elements; |
---|
146 | unsigned int nentries; // total number of entries |
---|
147 | static PHDATA *ROOT; // 'global' pointer |
---|
148 | AP_smatrix *distance_table; // weights between different characters |
---|
149 | AP_smatrix *matrix; // calculated matrix |
---|
150 | float *markerline; |
---|
151 | |
---|
152 | PHDATA(AW_root *awr); |
---|
153 | ~PHDATA(); |
---|
154 | |
---|
155 | char *load(char *use); // open database and get pointers to it |
---|
156 | char *unload(); |
---|
157 | GB_ERROR save(char *filename); |
---|
158 | void print(); |
---|
159 | GB_ERROR calculate_matrix(const char *cancel, double alpha, PH_TRANSFORMATION transformation); |
---|
160 | long get_seq_len() { return seq_len; }; |
---|
161 | |
---|
162 | }; |
---|
163 | |
---|
164 | #else |
---|
165 | #error phylo.hxx included twice |
---|
166 | #endif // PHYLO_HXX |
---|