1 | #include "include.hxx" |
---|
2 | #include "PH_display.hxx" |
---|
3 | |
---|
4 | extern void ph_view_matrix_cb(AW_window *); |
---|
5 | extern void ph_view_species_cb(AW_window *,AW_CL,AW_CL); |
---|
6 | extern void ph_view_filter_cb(AW_window *,AW_CL,AW_CL); |
---|
7 | extern void ph_calculate_matrix_cb(AW_window *,AW_CL,AW_CL); |
---|
8 | extern void create_save_matrix_window(AW_root *,char *); |
---|
9 | extern void display_status(AW_window *,AW_CL,AW_CL); |
---|
10 | |
---|
11 | AW_HEADER_MAIN |
---|
12 | AW_window *create_tree_window(AW_root *aw_root); |
---|
13 | |
---|
14 | GBDATA *gb_main; |
---|
15 | char **filter_text; |
---|
16 | |
---|
17 | void create_filter_text() |
---|
18 | { |
---|
19 | filter_text = (char **) calloc(5,sizeof (char *)); |
---|
20 | for(int i=0;i<5;i++) |
---|
21 | filter_text[i] = new char[100]; |
---|
22 | strcpy(filter_text[0],"don't count "); |
---|
23 | strcpy(filter_text[1],"don't use column when maximal "); |
---|
24 | strcpy(filter_text[2],"forget whole column "); |
---|
25 | strcpy(filter_text[3],"use like another valid base/acid while not maximal"); |
---|
26 | strcpy(filter_text[4],"use like uppercase character (ACGTU) "); |
---|
27 | } |
---|
28 | |
---|
29 | void startup_sequence_cb(AW_window *aww,void *cd1) |
---|
30 | { |
---|
31 | PHDATA *phd; |
---|
32 | char *use,*load_what; |
---|
33 | AW_root *aw_root; |
---|
34 | |
---|
35 | if(aww) aww->hide(); |
---|
36 | aw_root=(AW_root *) cd1; |
---|
37 | // loading database |
---|
38 | GB_push_transaction(gb_main); |
---|
39 | if(GBT_get_alignment_len(gb_main,aw_root->awar("phyl/alignment")->read_string())<1) |
---|
40 | aw_root->awar("phyl/which_species")->write_string(GBT_get_default_alignment(gb_main)); |
---|
41 | GB_pop_transaction(gb_main); |
---|
42 | |
---|
43 | use = aw_root->awar("phyl/alignment")->read_string(); |
---|
44 | load_what = aw_root->awar("phyl/which_species")->read_string(); // all, marked ... |
---|
45 | phd=new PHDATA(aw_root); |
---|
46 | GB_set_cache_size(gb_main, PH_DB_CACHE_SIZE); |
---|
47 | phd->load(use); |
---|
48 | phd->ROOT = phd; |
---|
49 | long len = PHDATA::ROOT->get_seq_len(); |
---|
50 | aw_root->awar("phyl/filter/stopcol")->write_int(len ); |
---|
51 | aw_root->awar("phyl/filter/startcol")->set_minmax(0,len); |
---|
52 | aw_root->awar("phyl/filter/stopcol")->set_minmax(0,len); |
---|
53 | |
---|
54 | ph_view_species_cb(0,0,0); |
---|
55 | } |
---|
56 | |
---|
57 | |
---|
58 | |
---|
59 | void ap_exit(AW_window *aw_window,AP_root *ap_root) |
---|
60 | { |
---|
61 | AWUSE(aw_window); |
---|
62 | if (ap_root->gb_main) GB_close(ap_root->gb_main); |
---|
63 | printf("\nGoodbye\n"); |
---|
64 | exit(0); |
---|
65 | } |
---|
66 | |
---|
67 | |
---|
68 | void expose_callb(AW_window *aw,AW_CL cd1,AW_CL cd2) |
---|
69 | { |
---|
70 | AWUSE(aw);AWUSE(cd1);AWUSE(cd2); |
---|
71 | |
---|
72 | if(AP_display::apdisplay->displayed()!=NONE) |
---|
73 | { |
---|
74 | AP_display::apdisplay->clear_window(); |
---|
75 | AP_display::apdisplay->display(); |
---|
76 | } |
---|
77 | else // startup |
---|
78 | { |
---|
79 | //startup_sequence_cb(0,aw->get_root()); |
---|
80 | } |
---|
81 | } // expose_callb |
---|
82 | |
---|
83 | |
---|
84 | void resize_callb(AW_window *aw,AW_CL cd1,AW_CL cd2) |
---|
85 | { |
---|
86 | AWUSE(aw);AWUSE(cd1);AWUSE(cd2); |
---|
87 | if(AP_display::apdisplay) |
---|
88 | { |
---|
89 | AP_display::apdisplay->resized(); |
---|
90 | AP_display::apdisplay->display(); |
---|
91 | } |
---|
92 | } |
---|
93 | // total_cells_horiz=PHDATA::ROOT->get_seq_len(); |
---|
94 | // { if(PHDATA::ROOT->markerline[x]>=0.0) |
---|
95 | |
---|
96 | static GB_ERROR PH_create_ml_multiline_SAI(GB_CSTR sai_name, int nr, GBDATA **gb_sai_ptr) { |
---|
97 | GBDATA *gb_sai = GBT_create_SAI(gb_main, sai_name); |
---|
98 | GBDATA *gbd, *gb2; |
---|
99 | GB_ERROR error = 0; |
---|
100 | |
---|
101 | for (gbd = GB_find(gb_sai,0,0,down_level); gbd; gbd = gb2) { |
---|
102 | gb2 = GB_find(gbd,0,0,this_level|search_next); |
---|
103 | const char *key = GB_read_key_pntr(gbd); |
---|
104 | if (!strcmp(key,"name")) continue; |
---|
105 | if (!strncmp(key,"ali_",4)) continue; |
---|
106 | error = GB_delete(gbd); |
---|
107 | if (error) break; |
---|
108 | } |
---|
109 | |
---|
110 | if (!error) { |
---|
111 | GBDATA *gb_ali = GB_search(gb_sai,PHDATA::ROOT->use,GB_FIND); |
---|
112 | if (gb_ali) { |
---|
113 | for (gbd = GB_find(gb_ali,0,0,down_level); gbd; gbd = gb2) { |
---|
114 | gb2 = GB_find(gbd,0,0,this_level|search_next); |
---|
115 | const char *key = GB_read_key_pntr(gbd); |
---|
116 | if (!strcmp(key,"data")) continue; |
---|
117 | if (!strcmp(key,"_TYPE")) continue; |
---|
118 | error = GB_delete(gbd); |
---|
119 | if (error) break; |
---|
120 | } |
---|
121 | } |
---|
122 | } |
---|
123 | |
---|
124 | GBDATA *gb_data = 0, *gb_TYPE = 0; |
---|
125 | |
---|
126 | if (!error) { |
---|
127 | gb_data = GBT_add_data(gb_sai,PHDATA::ROOT->use,"data",GB_STRING); |
---|
128 | if (!gb_data) error = GB_get_error(); |
---|
129 | } |
---|
130 | |
---|
131 | if (!error) { |
---|
132 | gb_TYPE = GBT_add_data(gb_sai,PHDATA::ROOT->use,"_TYPE",GB_STRING); |
---|
133 | if (!gb_TYPE) error = GB_get_error(); |
---|
134 | } |
---|
135 | |
---|
136 | if (!error) { |
---|
137 | AW_window *main_win = PH_used_windows::windowList->phylo_main_window; |
---|
138 | long minhom = main_win->get_root()->awar("phyl/filter/minhom")->read_int(); |
---|
139 | long maxhom = main_win->get_root()->awar("phyl/filter/maxhom")->read_int(); |
---|
140 | long startcol = main_win->get_root()->awar("phyl/filter/startcol")->read_int(); |
---|
141 | long stopcol = main_win->get_root()->awar("phyl/filter/stopcol")->read_int(); |
---|
142 | long len = PHDATA::ROOT->get_seq_len(); |
---|
143 | char *data = (char *)calloc(sizeof(char),(int)len+1); |
---|
144 | int x; |
---|
145 | float *markerline = PHDATA::ROOT->markerline; |
---|
146 | |
---|
147 | for (x=0;x<len;x++) { |
---|
148 | char c; |
---|
149 | |
---|
150 | if (x<startcol || x>stopcol) { |
---|
151 | c = '.'; |
---|
152 | } |
---|
153 | else { |
---|
154 | float ml = markerline[x]; |
---|
155 | |
---|
156 | if (ml>=0.0 && ml>=minhom && ml<=maxhom) { |
---|
157 | int digit = -1; |
---|
158 | switch (nr) { |
---|
159 | case 0: // hundred |
---|
160 | if (ml>=100.0) digit = 1; |
---|
161 | break; |
---|
162 | case 1: // ten |
---|
163 | if (ml>=10.0) digit = int(ml/10); |
---|
164 | break; |
---|
165 | case 2: // one |
---|
166 | digit = int(ml); |
---|
167 | break; |
---|
168 | default: |
---|
169 | gb_assert(0); |
---|
170 | break; |
---|
171 | } |
---|
172 | if (digit<0) c = '-'; |
---|
173 | else c = '0'+digit%10; |
---|
174 | } |
---|
175 | else { |
---|
176 | c = '-'; |
---|
177 | } |
---|
178 | } |
---|
179 | |
---|
180 | data[x] = c; |
---|
181 | } |
---|
182 | data[len] = 0; |
---|
183 | |
---|
184 | GB_write_string(gb_data, data); |
---|
185 | |
---|
186 | char buffer[1024]; |
---|
187 | sprintf(buffer,"FMX: Filter by Maximum Frequency: " |
---|
188 | "Start %li; Stop %li; Minhom %li%%; Maxhom %li%%", |
---|
189 | startcol, stopcol, minhom, maxhom); |
---|
190 | |
---|
191 | GB_write_string(gb_TYPE,buffer); |
---|
192 | |
---|
193 | delete data; |
---|
194 | } |
---|
195 | |
---|
196 | |
---|
197 | if (!error) *gb_sai_ptr = gb_sai; |
---|
198 | return error; |
---|
199 | } |
---|
200 | |
---|
201 | void PH_save_ml_multiline_cb(AW_window *aww) { |
---|
202 | GB_begin_transaction(gb_main); |
---|
203 | GB_ERROR error = 0; |
---|
204 | char *fname = aww->get_root()->awar("tmp/phylo/markerlinename")->read_string(); |
---|
205 | int fname_len = strlen(fname); |
---|
206 | { |
---|
207 | char *digit_appended = (char*)malloc(fname_len+2); |
---|
208 | memcpy(digit_appended, fname, fname_len); |
---|
209 | strcpy(digit_appended+fname_len, "0"); |
---|
210 | |
---|
211 | free(fname); |
---|
212 | fname = digit_appended; |
---|
213 | } |
---|
214 | GBDATA *gb_sai[3]; |
---|
215 | int i; |
---|
216 | for (i=0; !error && i<3; i++) { |
---|
217 | fname[fname_len] = '0'+i; |
---|
218 | error = PH_create_ml_multiline_SAI(fname, i, &gb_sai[i]); |
---|
219 | } |
---|
220 | |
---|
221 | delete fname; |
---|
222 | |
---|
223 | if (error) { |
---|
224 | GB_abort_transaction(gb_main); |
---|
225 | aw_message(error); |
---|
226 | }else{ |
---|
227 | GB_commit_transaction(gb_main); |
---|
228 | } |
---|
229 | } |
---|
230 | |
---|
231 | void PH_save_ml_cb(AW_window *aww) { |
---|
232 | GB_begin_transaction(gb_main); |
---|
233 | GB_ERROR error = 0; |
---|
234 | char *fname = aww->get_root()->awar("tmp/phylo/markerlinename")->read_string(); |
---|
235 | GBDATA *gb_sai = GBT_create_SAI(gb_main,fname); |
---|
236 | GBDATA *gbd,*gb2; |
---|
237 | |
---|
238 | for (gbd = GB_find(gb_sai,0,0,down_level); gbd; gbd = gb2) { |
---|
239 | gb2 = GB_find(gbd,0,0,this_level|search_next); |
---|
240 | const char *key = GB_read_key_pntr(gbd); |
---|
241 | if (!strcmp(key,"name")) continue; |
---|
242 | if (!strncmp(key,"ali_",4)) continue; |
---|
243 | error = GB_delete(gbd); |
---|
244 | if (error) break; |
---|
245 | } |
---|
246 | |
---|
247 | if (!error) { |
---|
248 | GBDATA *gb_ali = GB_search(gb_sai,PHDATA::ROOT->use,GB_FIND); |
---|
249 | if (gb_ali) { |
---|
250 | for (gbd = GB_find(gb_ali,0,0,down_level); gbd; gbd = gb2) { |
---|
251 | gb2 = GB_find(gbd,0,0,this_level|search_next); |
---|
252 | const char *key = GB_read_key_pntr(gbd); |
---|
253 | if (!strcmp(key,"bits")) continue; |
---|
254 | if (!strcmp(key,"_TYPE")) continue; |
---|
255 | error = GB_delete(gbd); |
---|
256 | if (error) break; |
---|
257 | } |
---|
258 | } |
---|
259 | } |
---|
260 | |
---|
261 | GBDATA *gb_bits = 0, *gb_TYPE = 0; |
---|
262 | |
---|
263 | if (!error) { |
---|
264 | gb_bits = GBT_add_data(gb_sai,PHDATA::ROOT->use,"bits",GB_BITS); |
---|
265 | if (!gb_bits) error = GB_get_error(); |
---|
266 | } |
---|
267 | |
---|
268 | if (!error) { |
---|
269 | gb_TYPE = GBT_add_data(gb_sai,PHDATA::ROOT->use,"_TYPE",GB_STRING); |
---|
270 | if (!gb_TYPE) error = GB_get_error(); |
---|
271 | } |
---|
272 | |
---|
273 | if (!error) { |
---|
274 | AW_window *main_win = PH_used_windows::windowList->phylo_main_window; |
---|
275 | long minhom = main_win->get_root()->awar("phyl/filter/minhom")->read_int(); |
---|
276 | long maxhom = main_win->get_root()->awar("phyl/filter/maxhom")->read_int(); |
---|
277 | long startcol = main_win->get_root()->awar("phyl/filter/startcol")->read_int(); |
---|
278 | long stopcol = main_win->get_root()->awar("phyl/filter/stopcol")->read_int(); |
---|
279 | long len = PHDATA::ROOT->get_seq_len(); |
---|
280 | char *bits = (char *)calloc(sizeof(char),(int)len+1); |
---|
281 | int x; |
---|
282 | float *markerline = PHDATA::ROOT->markerline; |
---|
283 | |
---|
284 | for (x=0;x<len;x++) { |
---|
285 | int bit; |
---|
286 | |
---|
287 | if (x < startcol || x>stopcol) { |
---|
288 | bit = 0; |
---|
289 | } |
---|
290 | else { |
---|
291 | float ml = markerline[x]; |
---|
292 | |
---|
293 | if (ml>=0.0 && ml>=minhom && ml<=maxhom) bit = 1; |
---|
294 | else bit = 0; |
---|
295 | |
---|
296 | } |
---|
297 | bits[x] = '0'+bit; |
---|
298 | } |
---|
299 | |
---|
300 | GB_write_bits(gb_bits,bits,len,'0'); |
---|
301 | char buffer[1024]; |
---|
302 | sprintf(buffer,"FMX: Filter by Maximum Frequency: " |
---|
303 | "Start %li; Stop %li; Minhom %li%%; Maxhom %li%%", |
---|
304 | startcol, stopcol, minhom, maxhom); |
---|
305 | |
---|
306 | GB_write_string(gb_TYPE,buffer); |
---|
307 | |
---|
308 | delete bits; |
---|
309 | } |
---|
310 | delete fname; |
---|
311 | |
---|
312 | if (error) { |
---|
313 | GB_abort_transaction(gb_main); |
---|
314 | aw_message(error); |
---|
315 | }else{ |
---|
316 | GB_commit_transaction(gb_main); |
---|
317 | } |
---|
318 | } |
---|
319 | |
---|
320 | |
---|
321 | AW_window *PH_save_markerline(AW_root *root, AW_CL cl_multi_line) |
---|
322 | { |
---|
323 | int multi_line = int(cl_multi_line); // ==1 -> save three SAI's usable as column percentage |
---|
324 | |
---|
325 | root->awar_string("tmp/phylo/markerlinename","markerline",AW_ROOT_DEFAULT); |
---|
326 | |
---|
327 | AW_window_simple *aws = new AW_window_simple; |
---|
328 | |
---|
329 | if (multi_line) { |
---|
330 | aws->init( root, "EXPORT_FREQUENCY_LINES", "Export Frequency Lines", 100, 100 ); |
---|
331 | } |
---|
332 | else { |
---|
333 | aws->init( root, "EXPORT_MARKER_LINE", "Export Marker Line", 100, 100 ); |
---|
334 | } |
---|
335 | |
---|
336 | aws->load_xfig("phylo/save_markerline.fig"); |
---|
337 | |
---|
338 | aws->callback( AW_POPDOWN); |
---|
339 | aws->at("close"); |
---|
340 | aws->create_button("CLOSE","CLOSE","C"); |
---|
341 | |
---|
342 | aws->callback( AW_POPUP_HELP,(AW_CL)"ph_export_markerline.hlp"); |
---|
343 | aws->at("help"); |
---|
344 | aws->create_button("HELP","HELP","H"); |
---|
345 | |
---|
346 | aws->at("name"); |
---|
347 | aws->create_input_field("tmp/phylo/markerlinename"); |
---|
348 | |
---|
349 | aws->at("box"); |
---|
350 | awt_create_selection_list_on_extendeds(gb_main,aws,"tmp/phylo/markerlinename"); |
---|
351 | |
---|
352 | aws->at("save"); |
---|
353 | if (multi_line) aws->callback(PH_save_ml_multiline_cb); |
---|
354 | else aws->callback(PH_save_ml_cb); |
---|
355 | aws->create_button("EXPORT","EXPORT","E"); |
---|
356 | |
---|
357 | return aws; |
---|
358 | } |
---|
359 | |
---|
360 | AW_window *create_phyl_main_window(AW_root *aw_root,AP_root *ap_root,AWT_graphic * awd) |
---|
361 | { |
---|
362 | AWUSE(awd); |
---|
363 | AW_window_menu_modes *awm = new AW_window_menu_modes(); |
---|
364 | awm->init(aw_root,"ARB_PHYLO", "ARB_PHYLO", 830,630,0,0); |
---|
365 | |
---|
366 | // create menues and menu inserts with callbacks |
---|
367 | // |
---|
368 | |
---|
369 | AW_gc_manager gcmiddle = AW_manage_GC( awm, |
---|
370 | awm->get_device (AW_MIDDLE_AREA), |
---|
371 | PH_GC_0, PH_GC_0_DRAG, AW_GCM_DATA_AREA, |
---|
372 | resize_callb, 0,0, |
---|
373 | "#CC9AF8", |
---|
374 | "#SEQUENCE$#000000", |
---|
375 | "#MARKER$#FF0000", |
---|
376 | "NOT_MARKER$#A270C0", |
---|
377 | 0 ); |
---|
378 | AW_gc_manager gcbottom = AW_manage_GC( awm, |
---|
379 | awm->get_device (AW_BOTTOM_AREA), |
---|
380 | PH_GC_0, PH_GC_0_DRAG, AW_GCM_WINDOW_AREA, |
---|
381 | resize_callb, 0,0, |
---|
382 | "pink", |
---|
383 | "#FOOTER",0 ); |
---|
384 | |
---|
385 | GBUSE(gcbottom); |
---|
386 | |
---|
387 | // File menu |
---|
388 | awm->create_menu(0,"File","F"); |
---|
389 | awm->insert_menu_topic("export_filter","Export Filter", "E", "ph_export_markerline.hlp",AWM_ALL, (AW_CB)AW_POPUP,(AW_CL) PH_save_markerline, 0 ); |
---|
390 | awm->insert_menu_topic("export_freq","Export Frequencies", "F", "ph_export_markerline.hlp",AWM_ALL, (AW_CB)AW_POPUP,(AW_CL) PH_save_markerline, 1 ); |
---|
391 | awm->insert_menu_topic("quit","QUIT", "q", "quit.hlp", AWM_ALL, (AW_CB)ap_exit ,(AW_CL)ap_root,0); |
---|
392 | |
---|
393 | // Calculate menu |
---|
394 | awm->create_menu(0,"Calculate","C" ); |
---|
395 | awm->insert_menu_topic("calc_column_filter", "Column Filter", "F","no help",AWM_ALL,(AW_CB2)ph_view_filter_cb,(AW_CL) 0,(AW_CL) 0); |
---|
396 | |
---|
397 | // Config menu |
---|
398 | awm->create_menu(0,"Config","o"); |
---|
399 | awm->insert_menu_topic("config_column_filter","Column Filter", "F","no help", AWM_ALL, AW_POPUP,(AW_CL)create_filter_window,0); |
---|
400 | |
---|
401 | // Properties menu |
---|
402 | awm->create_menu("","Properties","P"); |
---|
403 | awm->insert_menu_topic("props_menu", "Menu: Colors and Fonts ...", "M","props_frame.hlp", AWM_ALL, AW_POPUP, (AW_CL)AW_preset_window, 0 ); |
---|
404 | awm->insert_menu_topic("props_data", "Data: Colors and Fonts ...", "D","ph_props_data.hlp",AWM_ALL, AW_POPUP, (AW_CL)AW_create_gc_window, (AW_CL)gcmiddle ); |
---|
405 | awm->insert_menu_topic("save_props", "Save Properties (in ~/.arb_prop/phylo.arb)","S","savedef.hlp",AWM_ALL, (AW_CB) AW_save_defaults, 0, 0 ); |
---|
406 | |
---|
407 | |
---|
408 | // set window areas |
---|
409 | awm->set_info_area_height( 30 ); |
---|
410 | awm->at(5,2); |
---|
411 | awm->auto_space(5,-2); |
---|
412 | |
---|
413 | awm->callback( (AW_CB1)ap_exit ,(AW_CL)ap_root); |
---|
414 | awm->button_length(0); |
---|
415 | awm->help_text("quit.hlp"); |
---|
416 | awm->create_button("QUIT","QUIT"); |
---|
417 | |
---|
418 | awm->callback(AW_POPUP_HELP,(AW_CL)"phylo.hlp"); |
---|
419 | awm->button_length(0); |
---|
420 | awm->create_button("HELP","HELP","H"); |
---|
421 | |
---|
422 | |
---|
423 | awm->set_bottom_area_height( 120 ); |
---|
424 | |
---|
425 | awm->set_expose_callback (AW_MIDDLE_AREA, expose_callb, (AW_CL)awm,0); |
---|
426 | awm->set_resize_callback (AW_MIDDLE_AREA, resize_callb, (AW_CL)awm,0); |
---|
427 | awm->set_expose_callback (AW_BOTTOM_AREA, display_status, (AW_CL)aw_root,0); |
---|
428 | awm->set_resize_callback (AW_BOTTOM_AREA, display_status, (AW_CL)aw_root,0); |
---|
429 | |
---|
430 | return (AW_window *)awm; |
---|
431 | } |
---|
432 | |
---|
433 | |
---|
434 | AW_window *create_select_alignment_window(AW_root *aw_root) |
---|
435 | { |
---|
436 | AW_window_simple *aws = new AW_window_simple; |
---|
437 | |
---|
438 | aws->init( aw_root,"SELECT_ALIGNMENT", "SELECT ALIGNMENT",10,10); |
---|
439 | aws->load_xfig("phylo/select_ali.fig"); |
---|
440 | aws->button_length(10); |
---|
441 | |
---|
442 | aws->at("done"); |
---|
443 | aws->callback((AW_CB1)startup_sequence_cb,(AW_CL) aw_root); |
---|
444 | aws->create_button("DONE","DONE","D"); |
---|
445 | |
---|
446 | aws->at("which_alignment"); |
---|
447 | awt_create_selection_list_on_ad(gb_main,(AW_window *)aws,"phyl/alignment","*="); |
---|
448 | return (AW_window *) aws; |
---|
449 | } |
---|
450 | |
---|
451 | |
---|
452 | |
---|
453 | PH_used_windows::PH_used_windows(void) |
---|
454 | { |
---|
455 | memset((char *) this,0,sizeof(PH_used_windows)); |
---|
456 | } |
---|
457 | |
---|
458 | // initialize 'globals' |
---|
459 | PH_used_windows *PH_used_windows::windowList = 0; |
---|
460 | AP_display *AP_display::apdisplay=0; |
---|
461 | PHDATA *PHDATA::ROOT = 0; |
---|
462 | |
---|
463 | |
---|
464 | int |
---|
465 | main(int argc, char **argv) |
---|
466 | { |
---|
467 | AP_root *apmain; |
---|
468 | AW_root *aw_root; |
---|
469 | char *error, **alignment_names; |
---|
470 | AW_default aw_default; |
---|
471 | PH_used_windows *puw = new PH_used_windows; |
---|
472 | AP_display *apd = new AP_display; |
---|
473 | int num_alignments; |
---|
474 | const char *db_server = ":"; |
---|
475 | |
---|
476 | aw_initstatus(); |
---|
477 | aw_root = new AW_root; |
---|
478 | aw_default = aw_root->open_default(".arb_prop/phylo.arb"); |
---|
479 | aw_root->init_variables(aw_default); |
---|
480 | aw_root->init("ARB_PHYL"); |
---|
481 | |
---|
482 | if (argc == 2) { |
---|
483 | db_server = argv[1]; |
---|
484 | } |
---|
485 | apmain = new AP_root; |
---|
486 | if ((error = apmain->open(db_server))) { |
---|
487 | aw_message(error); |
---|
488 | exit(-1); |
---|
489 | } |
---|
490 | create_filter_variables(aw_root, aw_default); |
---|
491 | create_matrix_variables(aw_root, aw_default); |
---|
492 | create_filter_text(); |
---|
493 | puw->phylo_main_window = create_phyl_main_window(aw_root, apmain, 0); |
---|
494 | puw->phylo_main_window->show(); |
---|
495 | puw->windowList = puw; |
---|
496 | |
---|
497 | apd->apdisplay = apd; |
---|
498 | |
---|
499 | //loading database |
---|
500 | GB_push_transaction(gb_main); |
---|
501 | alignment_names = GBT_get_alignment_names(gb_main); |
---|
502 | for (num_alignments = 0; alignment_names[num_alignments] != 0; num_alignments++); |
---|
503 | if (num_alignments > 1) { |
---|
504 | (create_select_alignment_window(aw_root))->show(); |
---|
505 | } else { |
---|
506 | aw_root->awar("phyl/alignment")->write_string( alignment_names[0]); |
---|
507 | startup_sequence_cb(0, aw_root); |
---|
508 | } |
---|
509 | GBT_free_names(alignment_names); |
---|
510 | GB_pop_transaction(gb_main); |
---|
511 | |
---|
512 | aw_root->main_loop(); |
---|
513 | return 0; |
---|
514 | } |
---|
515 | |
---|
516 | |
---|
517 | |
---|
518 | void AD_map_viewer(GBDATA *dummy,AD_MAP_VIEWER_TYPE) |
---|
519 | { |
---|
520 | AWUSE(dummy); |
---|
521 | } |
---|