ARB
GEN_map.cxx
Go to the documentation of this file.
1 // =============================================================== //
2 // //
3 // File : GEN_map.cxx //
4 // Purpose : //
5 // //
6 // Coded by Ralf Westram (coder@reallysoft.de) in 2001 //
7 // Institute of Microbiology (Technical University Munich) //
8 // http://www.arb-home.de/ //
9 // //
10 // =============================================================== //
11 
12 #include "GEN_local.hxx"
13 #include "GEN_gene.hxx"
14 #include "GEN_graphic.hxx"
15 #include "GEN_nds.hxx"
16 #include "EXP_local.hxx"
17 
18 #include <dbui.h>
19 #include <db_query.h>
20 
21 #include <awt.hxx>
22 #include <awt_prompt.hxx>
23 #include <awt_input_mask.hxx>
24 
25 #include <aw_preset.hxx>
26 #include <aw_awars.hxx>
27 #include <aw_question.hxx>
28 #include <AW_rename.hxx>
29 #include <aw_msg.hxx>
30 #include <aw_root.hxx>
31 
32 #include <adGene.h>
33 #include <ad_cb.h>
34 
35 #include <arb_progress.h>
36 #include <rootAsWin.h>
37 #include <mode_text.h>
38 
39 #include <map>
40 
41 using namespace std;
42 
43 extern GBDATA *GLOBAL_gb_main;
44 
45 // -----------------------
46 // GEN_map_window
47 
48 class GEN_map_window : public AW_window_menu_modes { // derived from a Noncopyable
49  int window_nr;
50  GEN_graphic *gen_graphic;
51  AWT_canvas *gen_canvas;
52 
53 public:
54  GEN_map_window(int window_nr_) :
56  window_nr(window_nr_),
57  gen_graphic(NULp),
58  gen_canvas(NULp)
59  {}
60 
61  void init(AW_root *root, GBDATA *gb_main);
62 
63  GEN_graphic *get_graphic() const { gen_assert(gen_graphic); return gen_graphic; }
64  AWT_canvas *get_canvas() const { gen_assert(gen_canvas); return gen_canvas; }
65  int get_nr() const { return window_nr; }
66 
67  GBDATA *get_gb_main() const { return get_canvas()->gb_main; }
68 };
69 
70 // ------------------------
71 // GEN_map_manager
72 
73 DECLARE_CBTYPE_FVV_AND_BUILDERS(GenmapWindowCallback, void, GEN_map_window*); // generates makeGenmapWindowCallback
74 
75 class GEN_map_manager : virtual Noncopyable {
76  static AW_root *aw_root;
77  static GBDATA *gb_main;
78  static GEN_map_manager *the_manager; // there can be only one!
79 
80  int window_counter;
81  GEN_map_window **windows; // array of managed windows
82  int windows_size; // size of 'windows' array
83 
84 public:
85 
87 
88  static bool initialized() { return aw_root; }
89  static void initialize(AW_root *aw_root_, GBDATA *gb_main_) { aw_root = aw_root_; gb_main = gb_main_; }
90 
91  static GEN_map_manager *get_map_manager();
92 
93  GEN_map_window *get_map_window(int nr);
94 
95  int no_of_managed_windows() { return window_counter; }
96 
97  static void with_all_mapped_windows(const GenmapWindowCallback& gwcb);
98  static void with_all_mapped_windows(void (*cb)(GEN_map_window*)) { with_all_mapped_windows(makeGenmapWindowCallback(cb)); }
99 };
100 
101 // ____________________________________________________________
102 // start of implementation of class GEN_map_manager:
103 
104 AW_root *GEN_map_manager::aw_root = NULp;
105 GBDATA *GEN_map_manager::gb_main = NULp;
106 GEN_map_manager *GEN_map_manager::the_manager = NULp;
107 
109  window_counter(0),
110  windows(new GEN_map_window *[5]),
111  windows_size(5)
112 {
113  gen_assert(!the_manager); // only one instance allowed
114  the_manager = this;
115 }
116 
118  if (!the_manager) {
119  gen_assert(aw_root); // call initialize() before!
120  new GEN_map_manager; // sets the manager
121  gen_assert(the_manager);
122  }
123  return the_manager;
124 }
125 
126 void GEN_map_manager::with_all_mapped_windows(const GenmapWindowCallback& gwcb) {
127  if (aw_root) { // no genemap opened yet
129  int winCount = mm->no_of_managed_windows();
130  for (int nr = 0; nr<winCount; ++nr) {
131  gwcb(mm->get_map_window(nr));
132  }
133  }
134 }
135 
137  gen_assert(aw_root);
138  gen_assert(nr >= 0);
139  if (nr<window_counter) {
140  return windows[nr]; // window has already been created before
141  }
142 
143  gen_assert(nr == window_counter); // increase nr sequentially!
144 
145  window_counter++;
146  if (window_counter>windows_size) {
147  int new_windows_size = windows_size+5;
148  GEN_map_window **new_windows = new GEN_map_window*[new_windows_size];
149 
150  for (int i = 0; i<windows_size; ++i) new_windows[i] = windows[i];
151 
152  delete [] windows;
153  windows = new_windows;
154  windows_size = new_windows_size;
155  }
156 
157  gen_assert(nr<windows_size);
158 
159  windows[nr] = new GEN_map_window(nr);
160  windows[nr]->init(aw_root, gb_main);
161 
162  return windows[nr];
163 }
164 
165 // -end- of implementation of class GEN_map_manager.
166 
167 
168 
169 const char *GEN_window_local_awar_name(const char *awar_name, int window_nr) {
170  return GBS_global_string("%s_%i", awar_name, window_nr);
171 }
172 
174  AWT_auto_refresh allowed_on(win->get_canvas());
175  win->get_graphic()->get_gen_root()->reinit_NDS();
176  win->get_canvas()->request_refresh();
177 }
178 
179 static void GEN_NDS_changed(GBDATA *gb_viewkey) {
180  GBDATA *gb_main = GB_get_root(gb_viewkey);
181  GEN_make_node_text_init(gb_main);
183 }
184 
188  GBDATA *gb_gene_data; // callback was installed for this gene_data
189 
190  gene_container_changed_cb_data() : canvas(NULp), graphic(NULp), gb_gene_data(NULp) {}
191  gene_container_changed_cb_data(AWT_canvas *canvas_, GEN_graphic *graphic_, GBDATA *gb_gene_data_) :
192  canvas(canvas_),
193  graphic(graphic_),
194  gb_gene_data(gb_gene_data_)
195  {}
196 };
197 
199  AWT_auto_refresh allowed_on(cb_data->canvas);
200  cb_data->graphic->reinit_gen_root(cb_data->canvas, true);
201  cb_data->canvas->request_refresh();
202 }
203 
204 int GEN_find_windowNr_for(GEN_graphic *wanted_graphic) {
205  // returns window_nr of GEN_map_window using 'wanted_graphic' (or -1)
208  for (int window_nr = 0; window_nr<mapman->no_of_managed_windows(); ++window_nr) {
209  GEN_map_window *mapwin = mapman->get_map_window(window_nr);
210  if (mapwin && mapwin->get_graphic() == wanted_graphic) {
211  return window_nr;
212  }
213  }
214  }
215  return -1;
216 }
217 
219  int window_nr = GEN_find_windowNr_for(gg);
220  gen_assert(window_nr>=0);
221 
222  GBDATA *gb_gene_data = NULp;
223  if (window_nr>=0) {
224  const char *organism = gg->get_aw_root()->awar(AWAR_LOCAL_ORGANISM_NAME(window_nr))->read_char_pntr();
225  if (organism) {
226  GBDATA *gb_main = gg->get_gb_main();
227  GBDATA *gb_species = GBT_find_species(gb_main, organism);
228  if (gb_species) gb_gene_data = GEN_expect_gene_data(gb_species);
229  }
230  }
231 
232  return gb_gene_data;
233 }
234 
235 
237  typedef map<GEN_graphic*, gene_container_changed_cb_data> callback_dict;
238  static callback_dict installed_callbacks;
239 
240  callback_dict::iterator found = installed_callbacks.find(gg);
241  if (found == installed_callbacks.end()) {
242  gen_assert(install == INSTALL_CBS); // if not installing -> entry has to exist!
243  installed_callbacks[gg] = gene_container_changed_cb_data(gmw, gg, NULp);
244  found = installed_callbacks.find(gg);
245  gen_assert(found != installed_callbacks.end());
246  }
247 
248  gene_container_changed_cb_data *curr_cb_data = &(found->second);
249 
250  switch (install) {
251  case INSTALL_CBS: {
252  gen_assert(!curr_cb_data->gb_gene_data); // NULp means : no callback installed
253 
254  GBDATA *gb_main = gg->get_gb_main();
255  GB_transaction ta(gb_main);
256 
257  curr_cb_data->gb_gene_data = GEN_get_local_gene_data(gg);
258 
259  if (curr_cb_data->gb_gene_data) {
260  GB_add_callback(curr_cb_data->gb_gene_data, GB_CB_CHANGED_OR_DELETED, makeDatabaseCallback(GEN_gene_container_changed_cb, curr_cb_data));
261  }
262  break;
263  }
264  case REMOVE_CBS: {
265  if (curr_cb_data->gb_gene_data) { // if callback is installed
266  GB_remove_callback(curr_cb_data->gb_gene_data, GB_CB_CHANGED_OR_DELETED, makeDatabaseCallback(GEN_gene_container_changed_cb, curr_cb_data));
267  curr_cb_data->gb_gene_data = NULp;
268  }
269  break;
270  }
271  case FORGET_CBS: {
272  curr_cb_data->gb_gene_data = NULp;
273  break;
274  }
275  }
276 }
277 
278 static void GEN_jump_cb(AW_window *aww, bool force_center_if_fits) {
279  // force_center_if_fits==true => center gene if it fits into display
281 
282  AW_device *device = win->get_graphic()->get_device();
283  const AW_screen_area& screen = device->get_area_size();
284 #if defined(DEBUG)
285  printf("Window %i: screen is: %i/%i -> %i/%i\n", win->get_nr(), screen.l, screen.t, screen.r, screen.b);
286 #endif // DEBUG
287 
288  AWT_canvas *canvas = win->get_canvas();
289  AWT_auto_refresh allowed_on(canvas);
290  const GEN_root *gen_root = win->get_graphic()->get_gen_root();
291  if (gen_root) {
292  const AW::Rectangle& wrange = gen_root->get_selected_range();
293 
294  if (wrange.valid()) {
295 #if defined(DEBUG)
296  printf("Window %i: Draw world range of selected gene is: %f/%f -> %f/%f\n",
297  win->get_nr(), wrange.left(), wrange.top(), wrange.right(), wrange.bottom());
298 #endif // DEBUG
299 
300  AW::Rectangle srange = device->transform(wrange);
301 #if defined(DEBUG)
302  printf("Window %i: Draw screen range of selected gene is: %f/%f -> %f/%f\n",
303  win->get_nr(), srange.left(), srange.top(), srange.right(), srange.bottom());
304 #endif // DEBUG
305 
306  int scrollx = 0;
307  int scrolly = 0;
308 
309  if (srange.top() < 0) {
310  scrolly = AW_INT(srange.top())-2;
311  }
312  else if (srange.bottom() > screen.b) {
313  scrolly = AW_INT(srange.bottom())-screen.b+2;
314  }
315  if (srange.left() < 0) {
316  scrollx = AW_INT(srange.left())-2;
317  }
318  else if (srange.right() > screen.r) {
319  scrollx = AW_INT(srange.right())-screen.r+2;
320  }
321 
322  if (force_center_if_fits) {
323  if (!scrollx) { // no scrolling needed, i.e. gene fits onto display horizontally
324  int gene_center_x = AW_INT((srange.left()+srange.right())/2);
325  int screen_center_x = (screen.l+screen.r)/2;
326  scrollx = gene_center_x-screen_center_x;
327 #if defined(DEBUG)
328  printf("center x\n");
329 #endif // DEBUG
330  }
331  if (!scrolly) { // no scrolling needed, i.e. gene fits onto display vertically
332  int gene_center_y = AW_INT((srange.top()+srange.bottom())/2);
333  int screen_center_y = (screen.t+screen.b)/2;
334  scrolly = gene_center_y-screen_center_y;
335 #if defined(DEBUG)
336  printf("center y\n");
337 #endif // DEBUG
338  }
339  }
340 
341 #if defined(DEBUG)
342  printf("scroll %i/%i\n", scrollx, scrolly);
343 #endif // DEBUG
344 
345  canvas->scroll(scrollx, scrolly);
346  }
347  }
348  canvas->request_refresh();
349 }
350 
351 static void GEN_jump_cb_auto(AW_root *root, GEN_map_window *win, bool force_refresh, bool force_zoom_reset) {
352  AWT_canvas *ntw = win->get_canvas();
353  assert_no_auto_refresh_for(ntw); // otherwise jump doesn't work!
354 
355  int jump = root->awar(AWAR_GENMAP_AUTO_JUMP)->read_int();
356  if (jump || force_refresh || force_zoom_reset) {
357  AWT_auto_refresh allowed_on(ntw);
358  if (force_zoom_reset) ntw->request_zoom_reset();
359  ntw->request_refresh();
360  }
361  if (jump) {
362  GEN_jump_cb(win, false);
363  }
364 }
365 
367  {
368  AWT_auto_refresh allowed_on(win->get_canvas());
369  win->get_graphic()->reinit_gen_root(win->get_canvas(), false);
370  }
371  GEN_jump_cb_auto(awr, win, true, false);
372 }
373 
374 #define DISPLAY_TYPE_BIT(disp_type) (1<<(disp_type))
375 #define ALL_DISPLAY_TYPES (DISPLAY_TYPE_BIT(GEN_DISPLAY_STYLES)-1)
376 
378  AWT_auto_refresh allowed_on(win->get_canvas());
379  win->get_canvas()->request_refresh();
380 }
383 }
384 
385 static void GEN_map_window_refresh_if_display_type(GEN_map_window *win, bool zoom_reset, int display_type_mask) {
386  int my_display_type = win->get_graphic()->get_display_style();
387  if (display_type_mask & DISPLAY_TYPE_BIT(my_display_type)) {
388  if (zoom_reset) {
389  GEN_jump_cb_auto(AW_root::SINGLETON, win, true, true);
390  }
391  else {
393  }
394  }
395 }
396 
397 static void GEN_update_unlocked_organism_and_gene_awars(GEN_map_window *win, const char *organismName, const char *geneName) {
398  AW_root *aw_root = win->get_graphic()->get_aw_root();
399  int window_nr = win->get_nr();
400  if (!aw_root->awar(AWAR_LOCAL_ORGANISM_LOCK(window_nr))->read_int()) {
401  aw_root->awar(AWAR_LOCAL_ORGANISM_NAME(window_nr))->write_string(organismName);
402  }
403  if (!aw_root->awar(AWAR_LOCAL_GENE_LOCK(window_nr))->read_int()) {
404  aw_root->awar(AWAR_LOCAL_GENE_NAME(window_nr))->write_string(geneName);
405  }
406 }
407 
409  char *organism = awr->awar(AWAR_ORGANISM_NAME)->read_string();
410  char *gene = awr->awar(AWAR_GENE_NAME)->read_string();
411 
413 
414  free(gene);
415  free(organism);
416 }
417 
418 
419 static void GEN_local_lock_changed_cb(AW_root *awr, GEN_map_window *win, bool gene_lock) {
420  int window_nr = win->get_nr();
421 
422  const char *local_awar_name = NULp;
423  const char *local_lock_awar_name = NULp;
424  const char *global_awar_name = NULp;
425 
426  if (gene_lock) {
427  local_awar_name = AWAR_LOCAL_GENE_NAME(window_nr);
428  local_lock_awar_name = AWAR_LOCAL_GENE_LOCK(window_nr);
429  global_awar_name = AWAR_GENE_NAME;
430  }
431  else { // otherwise organism
432  local_awar_name = AWAR_LOCAL_ORGANISM_NAME(window_nr);
433  local_lock_awar_name = AWAR_LOCAL_ORGANISM_LOCK(window_nr);
434  global_awar_name = AWAR_ORGANISM_NAME;
435  }
436 
437  AW_awar *local_awar = awr->awar(local_awar_name);
438  AW_awar *global_awar = awr->awar(global_awar_name);
439 
440  int lock_value = awr->awar(local_lock_awar_name)->read_int();
441  if (lock_value == 0) { // lock has been removed -> map to global awar
442  local_awar->map(global_awar);
443  }
444  else { // lock has been installed -> unmap from global awar
445  local_awar->unmap();
446  char *content = global_awar->read_string();
447  local_awar->write_string(content);
448  free(content);
449  }
450 }
451 
452 // -------------------------------------
453 // display parameter change cb
454 
455 static void GEN_display_param_changed_cb(AW_root*, bool zoom_reset, int display_type_mask) {
456  GEN_map_manager::with_all_mapped_windows(makeGenmapWindowCallback(GEN_map_window_refresh_if_display_type, zoom_reset, display_type_mask));
457 }
458 inline void set_display_update_callback(AW_root *awr, const char *awar_name, bool zoom_reset, int display_type_mask) {
459  awr->awar(awar_name)->add_callback(makeRootCallback(GEN_display_param_changed_cb, zoom_reset, display_type_mask));
460 }
461 
462 // --------------------------
463 // View-local AWARS
464 
465 static void GEN_create_genemap_local_awars(AW_root *aw_root, AW_default /* def */, int window_nr) {
466  // awars local to each view
467 
468  aw_root->awar_int(AWAR_GENMAP_DISPLAY_TYPE(window_nr), GEN_DISPLAY_STYLE_RADIAL); // @@@ FIXME: make local
469 
470  aw_root->awar_string(AWAR_LOCAL_ORGANISM_NAME(window_nr), "");
471  aw_root->awar_string(AWAR_LOCAL_GENE_NAME(window_nr), "");
472 
473  aw_root->awar_int(AWAR_LOCAL_ORGANISM_LOCK(window_nr), 0);
474  aw_root->awar_int(AWAR_LOCAL_GENE_LOCK(window_nr), 0);
475 }
476 
478  int window_nr = win->get_nr();
479 
480  RootCallback nameChangedCb = makeRootCallback(GEN_local_organism_or_gene_name_changed_cb, win);
481  awr->awar(AWAR_LOCAL_ORGANISM_NAME(window_nr))->add_callback(nameChangedCb);
482  awr->awar(AWAR_LOCAL_GENE_NAME(window_nr)) ->add_callback(nameChangedCb);
483 
484  AW_awar *awar_lock_orga = awr->awar(AWAR_LOCAL_ORGANISM_LOCK(window_nr));
485  AW_awar *awar_lock_gene = awr->awar(AWAR_LOCAL_GENE_LOCK(window_nr));
486 
487  awar_lock_orga->add_callback(makeRootCallback(GEN_local_lock_changed_cb, win, false));
488  awar_lock_gene->add_callback(makeRootCallback(GEN_local_lock_changed_cb, win, true));
489 
490  awar_lock_orga->touch();
491  awar_lock_gene->touch();
492 }
493 
494 // ----------------------
495 // global AWARS
496 
497 static void GEN_create_genemap_global_awars(AW_root *aw_root, AW_default def, GBDATA *gb_main) {
498  // layout options:
499 
500  aw_root->awar_int(AWAR_GENMAP_ARROW_SIZE, 150)->set_minmax(0, 500);
501  aw_root->awar_int(AWAR_GENMAP_SHOW_HIDDEN, 0);
502  aw_root->awar_int(AWAR_GENMAP_SHOW_ALL_NDS, 0);
503 
504  aw_root->awar_int(AWAR_GENMAP_BOOK_BASES_PER_LINE, 15000)->set_minmax(1, 100000);
506  aw_root->awar_int(AWAR_GENMAP_BOOK_LINE_HEIGHT, 20)->set_minmax(0, 100);
507  aw_root->awar_int(AWAR_GENMAP_BOOK_LINE_SPACE, 5)->set_minmax(-20, 20);
508 
509  aw_root->awar_float(AWAR_GENMAP_VERTICAL_FACTOR_X, 1.0)->set_minmax(0, 10);
510  aw_root->awar_float(AWAR_GENMAP_VERTICAL_FACTOR_Y, 0.3)->set_minmax(0, 10);
511 
512  aw_root->awar_float(AWAR_GENMAP_RADIAL_INSIDE, 50)->set_minmax(0, 100);
513  aw_root->awar_float(AWAR_GENMAP_RADIAL_OUTSIDE, 4)->set_minmax(0, 100);
514 
515  // other options:
516 
517  aw_root->awar_int(AWAR_GENMAP_AUTO_JUMP, 1);
518 
519  GEN_create_nds_vars(aw_root, def, gb_main, makeDatabaseCallback(GEN_NDS_changed));
520 }
521 
523  enum { REFRESH_ONLY = 0, ZOOM_RESET = 1 };
524 
528 
533 
536 
539 
542 }
543 
544 
545 // --------------------------------------------------------------------------------
546 
548  const char *text = NULp;
549  switch (mode) {
550  case AWT_MODE_SELECT: text = MODE_TEXT_1BUTTON("SELECT", "click to select a gene"); break;
551  case AWT_MODE_INFO: text = MODE_TEXT_1BUTTON("INFO", "click for info"); break;
552 
553  case AWT_MODE_ZOOM: text = MODE_TEXT_STANDARD_ZOOMMODE(); break;
554 
555  default: text = no_mode_text_defined(); break;
556  }
557 
558  gen_assert(strlen(text) < AWAR_FOOTER_MAX_LEN); // text too long!
559 
560  aws->get_root()->awar(AWAR_FOOTER)->write_string(text);
561 
562  AWT_canvas *canvas = win->get_canvas();
563  AWT_auto_refresh allowed_on(canvas);
564 
565  canvas->set_mode(mode);
566  canvas->request_refresh();
567 }
568 
569 static void GEN_undo_cb(AW_window*, GB_UNDO_TYPE undo_type, GBDATA *gb_main) {
570  GB_ERROR error = GB_undo(gb_main, undo_type);
571  if (error) {
572  aw_message(error);
573  }
574  else {
575  GB_begin_transaction(gb_main);
576  GB_commit_transaction(gb_main);
577  }
578 }
579 
581  static AW_window_simple *aws = NULp;
582 
583  if (!aws) {
584  aws = new AW_window_simple;
585 
586  aws->init(awr, "GEN_OPTS", "Genemap options");
587  aws->load_xfig("gen_options.fig");
588 
589  aws->at("close");
590  aws->callback(AW_POPDOWN);
591  aws->create_button("CLOSE", "CLOSE", "C");
592 
593  aws->callback(makeHelpCallback("gen_options.hlp"));
594  aws->at("help");
595  aws->create_button("HELP", "HELP", "H");
596 
597  aws->auto_space(5, 5);
598  aws->label_length(26);
599 
600  const int FIELDWIDTH = 12;
601  const int SCALERWIDTH = 300;
602 
603  // all displays:
604  aws->at("arrow_size"); aws->create_input_field_with_scaler(AWAR_GENMAP_ARROW_SIZE, FIELDWIDTH, SCALERWIDTH);
605 
606  aws->at("show_hidden");
607  aws->label("Show hidden genes");
608  aws->create_toggle(AWAR_GENMAP_SHOW_HIDDEN);
609 
610  aws->at("show_all");
611  aws->label("Show NDS for all genes");
612  aws->create_toggle(AWAR_GENMAP_SHOW_ALL_NDS);
613 
614  aws->at("autojump");
615  aws->label("Auto jump to selected gene");
616  aws->create_toggle(AWAR_GENMAP_AUTO_JUMP);
617 
618  // book-style:
619  aws->at("base_pos"); aws->create_input_field_with_scaler(AWAR_GENMAP_BOOK_BASES_PER_LINE, FIELDWIDTH, SCALERWIDTH);
620  aws->at("width_factor"); aws->create_input_field_with_scaler(AWAR_GENMAP_BOOK_WIDTH_FACTOR, FIELDWIDTH, SCALERWIDTH, AW_SCALER_EXP_LOWER);
621  aws->at("line_height"); aws->create_input_field_with_scaler(AWAR_GENMAP_BOOK_LINE_HEIGHT, FIELDWIDTH, SCALERWIDTH, AW_SCALER_EXP_LOWER);
622  aws->at("line_space"); aws->create_input_field_with_scaler(AWAR_GENMAP_BOOK_LINE_SPACE, FIELDWIDTH, SCALERWIDTH);
623 
624  // vertical-style:
625  aws->at("factor_x"); aws->create_input_field_with_scaler(AWAR_GENMAP_VERTICAL_FACTOR_X, FIELDWIDTH, SCALERWIDTH, AW_SCALER_EXP_LOWER);
626  aws->at("factor_y"); aws->create_input_field_with_scaler(AWAR_GENMAP_VERTICAL_FACTOR_Y, FIELDWIDTH, SCALERWIDTH, AW_SCALER_EXP_LOWER);
627 
628  // radial style:
629  aws->at("inside"); aws->create_input_field_with_scaler(AWAR_GENMAP_RADIAL_INSIDE, FIELDWIDTH, SCALERWIDTH, AW_SCALER_EXP_LOWER);
630  aws->at("outside"); aws->create_input_field_with_scaler(AWAR_GENMAP_RADIAL_OUTSIDE, FIELDWIDTH, SCALERWIDTH, AW_SCALER_EXP_LOWER);
631  }
632  return aws;
633 }
634 
636  // only create one gc window for all genemap views
637  static AW_window *awgc = NULp;
638  if (!awgc) awgc = AW_create_gc_window_named(awr, gcman, "GENMAP_COLOR_DEF2", "Genemap colors and fonts"); // use named gc window (otherwise clashes with ARB_NTREE gc window)
639  return awgc;
640 }
641 
647 
648  GEN_PERFORM_MODES, // counter
649 };
650 
651 static const char *GEN_PERFORM_MODE_id[GEN_PERFORM_MODES] = {
652  "org_all",
653  "org_current",
654  "org_butcur",
655  "org_marked",
656 };
657 
658 inline string performmode_relative_id(const char *id, GEN_PERFORM_MODE pmode) {
659  return GBS_global_string("%s_%s", GEN_PERFORM_MODE_id[pmode], id);
660 }
661 
667 
668  // GEN_MARK_COLORED, done by awt_colorize_marked now
669  // GEN_UNMARK_COLORED,
670  // GEN_INVERT_COLORED,
671  // GEN_COLORIZE_MARKED,
672 
674 
679 };
680 
685 
689 };
690 
691 // --------------------------------------------------------------------------------
692 
693 inline bool nameIsUnique(const char *short_name, GBDATA *gb_species_data) {
694  return !GBT_find_species_rel_species_data(gb_species_data, short_name);
695 }
696 
697 static GB_ERROR GEN_species_add_entry(GBDATA *gb_pseudo, const char *key, const char *value) {
698  GB_ERROR error = NULp;
699  GB_clear_error();
700  GBDATA *gbd = GB_entry(gb_pseudo, key);
701 
702  if (!gbd) { // key does not exist yet -> create
703  gbd = GB_create(gb_pseudo, key, GB_STRING);
704  if (!gbd) error = GB_await_error();
705  }
706  else { // key exists
707  if (GB_read_type(gbd) != GB_STRING) { // test correct key type
708  error = GB_export_errorf("field '%s' exists and has wrong type", key);
709  }
710  }
711 
712  if (!error) error = GB_write_string(gbd, value);
713 
714  return error;
715 }
716 
717 static AW_repeated_question *ask_about_existing_gene_species = NULp;
718 static AW_repeated_question *ask_to_overwrite_alignment = NULp;
719 
720 struct EG2PS_data : virtual Noncopyable {
723  char *ali;
726  int duplicateSpecies; // counts created gene-species with identical ACC
727  bool nameProblem; // nameserver and DB disagree about names
728 
729  EG2PS_data(const char *ali_, GBDATA *gb_species_data_, long marked_genes_)
730  : progress(marked_genes_),
731  gb_species_data(gb_species_data_),
732  ali(ARB_strdup(ali_)),
733  existing(gb_species_data, marked_genes_),
734  duplicateSpecies(0),
735  nameProblem(false)
736  {
737  pseudo_hash = GEN_create_pseudo_species_hash(GB_get_root(gb_species_data), marked_genes_);
738  }
739 
741  if (duplicateSpecies>0) {
742  aw_message(GBS_global_string("There are %i duplicated gene-species (with identical sequence and accession number)\n"
743  "Duplicated gene-species got names with numerical postfixes ('.1', '.2', ...)"
744  , duplicateSpecies));
745  }
746  if (nameProblem) {
747  aw_message("Naming problems occurred.\nYou have to call 'Species/Synchronize IDs'!");
748  }
749  GBS_free_hash(pseudo_hash);
750  free(ali);
751  }
752 };
753 
754 static const char* readACC(GBDATA *gb_species_data, const char *name) {
755  const char *other_acc = NULp;
756  GBDATA *gb_other_species = GBT_find_species_rel_species_data(gb_species_data, name);
757  if (gb_other_species) {
758  GBDATA *gb_other_acc = GB_entry(gb_other_species, "acc");
759  if (gb_other_acc) other_acc = GB_read_char_pntr(gb_other_acc);
760  }
761  return other_acc;
762 }
763 
764 static void gen_extract_gene_2_pseudoSpecies(GBDATA *gb_species, GBDATA *gb_gene, EG2PS_data *eg2ps) {
765  char *gene_name = ARB_strdup(GBT_get_name_or_description(gb_gene));
766  char *species_name = ARB_strdup(GBT_get_name_or_description(gb_species));
767 
768  const char *full_species_name = GBT_read_char_pntr(gb_species, "full_name");
769  if (!full_species_name) full_species_name = species_name;
770 
771  char *full_name = GBS_global_string_copy("%s [%s]", full_species_name, gene_name);
772  char *sequence = GBT_read_gene_sequence(gb_gene, true, 0);
773  GB_ERROR error = NULp;
774 
775  if (!sequence) error = GB_await_error();
776  else {
777  const char *ali = eg2ps->ali;
778  long id = GBS_checksum(sequence, 1, ".-");
779  char acc[100];
780 
781  sprintf(acc, "ARB_GENE_%lX", id);
782 
783  // test if this gene has been already extracted to a gene-species
784 
785  GBDATA *gb_main = GB_get_root(gb_species);
786  GBDATA *gb_exist_geneSpec = GEN_find_pseudo_species(gb_main, species_name, gene_name, eg2ps->pseudo_hash);
787  bool create_new_gene_species = true;
788  char *short_name = NULp;
789 
790  if (gb_exist_geneSpec) {
791  char *existing_name = ARB_strdup(GBT_get_name_or_description(gb_exist_geneSpec));
792 
793  gen_assert(ask_about_existing_gene_species);
794  gen_assert(ask_to_overwrite_alignment);
795 
796  char *question = GBS_global_string_copy("Already have a gene-species for %s/%s ('%s')", species_name, gene_name, existing_name);
797  int answer = ask_about_existing_gene_species->get_answer("existing_pseudo_species", question, "Overwrite species,Insert new alignment,Skip,Create new", "all", true);
798 
799  create_new_gene_species = false;
800 
801  switch (answer) {
802  case 0: { // Overwrite species
803  // @@@ FIXME: delete species needed here
804  create_new_gene_species = true;
805  short_name = ARB_strdup(existing_name);
806  break;
807  }
808  case 1: { // Insert new alignment or overwrite alignment
809  GBDATA *gb_ali = GB_entry(gb_exist_geneSpec, ali);
810  if (gb_ali) { // the alignment already exists
811  char *question2 = GBS_global_string_copy("Gene-species '%s' already has data in '%s'", existing_name, ali);
812  int overwrite_answer = ask_to_overwrite_alignment->get_answer("overwrite_gene_data", question2, "Overwrite data,Skip", "all", true);
813 
814  if (overwrite_answer == 1) error = GBS_global_string("Skipped gene-species '%s' (already had data in alignment)", existing_name); // Skip
815  else if (overwrite_answer == 2) error = "Aborted."; // Abort
816  // @@@ FIXME: overwrite data is missing
817 
818  free(question2);
819  }
820  break;
821  }
822  case 2: { // Skip existing ones
823  error = GBS_global_string("Skipped gene-species '%s'", existing_name);
824  break;
825  }
826  case 3: { // Create with new name
827  create_new_gene_species = true;
828  break;
829  }
830  case 4: { // Abort
831  error = "Aborted.";
832  break;
833  }
834  default: gen_assert(0);
835  }
836  free(question);
837  free(existing_name);
838  }
839 
840  if (!error) {
841  if (create_new_gene_species) {
842  if (!short_name) { // create a new name
843  error = AWTC_generate_one_name(gb_main, full_name, acc, NULp, short_name);
844  if (!error) { // name has been created
845  if (eg2ps->existing.name_known(short_name)) { // nameserver-generated name is already in use
846  const char *other_acc = readACC(eg2ps->gb_species_data, short_name);
847  if (other_acc) {
848  if (strcmp(acc, other_acc) == 0) { // duplicate (gene-)species -> generate postfixed name
849  char *newName = NULp;
850  for (int postfix = 1; ; ++postfix) {
851  newName = GBS_global_string_copy("%s.%i", short_name, postfix);
852  if (!eg2ps->existing.name_known(newName)) {
853  eg2ps->duplicateSpecies++;
854  break;
855  }
856 
857  other_acc = readACC(eg2ps->gb_species_data, newName);
858  if (!other_acc || strcmp(acc, other_acc) != 0) {
859  eg2ps->nameProblem = true;
860  error = GBS_global_string("Unexpected acc-mismatch for '%s'", newName);
861  break;
862  }
863  }
864 
865  if (!error) freeset(short_name, newName);
866  else free(newName);
867  }
868  else { // different acc, but uses name generated by nameserver
869  eg2ps->nameProblem = true;
870  error = GBS_global_string("acc of '%s' differs from acc stored in nameserver", short_name);
871  }
872  }
873  else { // can't detect acc of existing species
874  eg2ps->nameProblem = true;
875  error = GBS_global_string("can't detect acc of species '%s'", short_name);
876  }
877  }
878  }
879  if (error) { // try to make a random name
880  const char *msg = GBS_global_string("%s\nGenerating a random name instead.", error);
881  aw_message(msg);
882  error = NULp;
883 
884  short_name = AWTC_generate_random_name(eg2ps->existing);
885  if (!short_name) error = GBS_global_string("Failed to create a new name for pseudo gene-species '%s'", full_name);
886  }
887  }
888 
889  if (!error) { // create the species
890  gen_assert(short_name);
891  gb_exist_geneSpec = GBT_find_or_create_species(gb_main, short_name, true);
892  if (!gb_exist_geneSpec) error = GB_export_errorf("Failed to create pseudo-species '%s'", short_name);
893  else eg2ps->existing.add_name(short_name);
894  }
895  }
896  else {
897  gen_assert(gb_exist_geneSpec); // do not generate new or skip -> should only occur when gene-species already existed
898  }
899 
900  if (!error) { // write sequence data
901  GBDATA *gb_data = GBT_add_data(gb_exist_geneSpec, ali, "data", GB_STRING);
902  if (!gb_data) error = GB_await_error();
903  else error = GB_write_string(gb_data, sequence);
904  }
905 
906  // write other entries:
907  if (!error) error = GEN_species_add_entry(gb_exist_geneSpec, "full_name", full_name);
908  if (!error) error = GEN_species_add_entry(gb_exist_geneSpec, "ARB_origin_species", species_name);
909  if (!error) error = GEN_species_add_entry(gb_exist_geneSpec, "ARB_origin_gene", gene_name);
910  if (!error) GEN_add_pseudo_species_to_hash(gb_exist_geneSpec, eg2ps->pseudo_hash);
911  if (!error) error = GEN_species_add_entry(gb_exist_geneSpec, "acc", acc);
912 
913  // copy codon_start and transl_table :
914  const char *codon_start = NULp;
915  const char *transl_table = NULp;
916  {
917  GBDATA *gb_codon_start = GB_entry(gb_gene, "codon_start");
918  GBDATA *gb_transl_table = GB_entry(gb_gene, "transl_table");
919 
920  if (gb_codon_start) codon_start = GB_read_char_pntr(gb_codon_start);
921  if (gb_transl_table) transl_table = GB_read_char_pntr(gb_transl_table);
922  }
923 
924  if (!error && codon_start) error = GEN_species_add_entry(gb_exist_geneSpec, "codon_start", codon_start);
925  if (!error && transl_table) error = GEN_species_add_entry(gb_exist_geneSpec, "transl_table", transl_table);
926  }
927 
928  free(short_name);
929  free(sequence);
930  }
931  if (error) aw_message(error);
932 
933  free(full_name);
934  free(species_name);
935  free(gene_name);
936 }
937 
938 static long gen_count_marked_genes = 0; // used to count marked genes
939 
940 static void do_mark_command_for_one_species(int imode, GBDATA *gb_species, AW_CL cl_user) {
941  GEN_MARK_MODE mode = (GEN_MARK_MODE)imode;
942 
943  for (GBDATA *gb_gene = GEN_first_gene(gb_species);
944  gb_gene;
945  gb_gene = GEN_next_gene(gb_gene))
946  {
947  bool mark_flag = GB_read_flag(gb_gene) != 0;
948  bool org_mark_flag = mark_flag;
949 
950  switch (mode) {
951  case GEN_MARK: mark_flag = 1; break;
952  case GEN_UNMARK: mark_flag = 0; break;
953  case GEN_INVERT_MARKED: mark_flag = !mark_flag; break;
954 
955  case GEN_COUNT_MARKED: {
956  if (mark_flag) ++gen_count_marked_genes;
957  break;
958  }
959  case GEN_EXTRACT_MARKED: {
960  if (mark_flag) {
961  EG2PS_data *eg2ps = (EG2PS_data*)cl_user;
962  gen_extract_gene_2_pseudoSpecies(gb_species, gb_gene, eg2ps);
963  eg2ps->progress.inc();
964  }
965  break;
966  }
967  default: {
968  GBDATA *gb_hidden = GB_entry(gb_gene, ARB_HIDDEN);
969  bool hidden = gb_hidden ? GB_read_byte(gb_hidden) != 0 : false;
970 
971  switch (mode) {
972  case GEN_MARK_HIDDEN: if (hidden) mark_flag = 1; break;
973  case GEN_UNMARK_HIDDEN: if (hidden) mark_flag = 0; break;
974  case GEN_MARK_VISIBLE: if (!hidden) mark_flag = 1; break;
975  case GEN_UNMARK_VISIBLE: if (!hidden) mark_flag = 0; break;
976  default: gen_assert(0); break;
977  }
978  }
979  }
980 
981  if (mark_flag != org_mark_flag) GB_write_flag(gb_gene, mark_flag ? 1 : 0);
982  }
983 }
984 
985 static void do_hide_command_for_one_species(int imode, GBDATA *gb_species, AW_CL /* cl_user */) {
986  GEN_HIDE_MODE mode = (GEN_HIDE_MODE)imode;
987 
988  for (GBDATA *gb_gene = GEN_first_gene(gb_species);
989  gb_gene;
990  gb_gene = GEN_next_gene(gb_gene))
991  {
992  bool marked = GB_read_flag(gb_gene) != 0;
993 
994  GBDATA *gb_hidden = GB_entry(gb_gene, ARB_HIDDEN);
995  bool hidden = gb_hidden ? (GB_read_byte(gb_hidden) != 0) : false;
996  bool org_hidden = hidden;
997 
998  switch (mode) {
999  case GEN_HIDE_ALL: hidden = true; break;
1000  case GEN_UNHIDE_ALL: hidden = false; break;
1001  case GEN_INVERT_HIDE_ALL: hidden = !hidden; break;
1002  case GEN_HIDE_MARKED: if (marked) hidden = true; break;
1003  case GEN_UNHIDE_MARKED: if (marked) hidden = false; break;
1004  case GEN_INVERT_HIDE_MARKED: if (marked) hidden = !hidden; break;
1005  default: gen_assert(0); break;
1006  }
1007 
1008  if (hidden != org_hidden) {
1009  if (!gb_hidden) gb_hidden = GB_create(gb_gene, ARB_HIDDEN, GB_BYTE);
1010  GB_write_byte(gb_hidden, hidden ? 1 : 0); // change gene visibility
1011  }
1012  }
1013 }
1014 
1015 static void GEN_perform_command(GBDATA *gb_main, GEN_PERFORM_MODE pmode,
1016  void (*do_command)(int cmode, GBDATA *gb_species, AW_CL cl_user), int mode, AW_CL cl_user) {
1017  GB_ERROR error = NULp;
1018 
1019  GB_begin_transaction(gb_main);
1020 
1021  switch (pmode) {
1023  for (GBDATA *gb_organism = GEN_first_organism(gb_main);
1024  gb_organism;
1025  gb_organism = GEN_next_organism(gb_organism))
1026  {
1027  do_command(mode, gb_organism, cl_user);
1028  }
1029  break;
1030  }
1032  for (GBDATA *gb_organism = GEN_first_marked_organism(gb_main);
1033  gb_organism;
1034  gb_organism = GEN_next_marked_organism(gb_organism))
1035  {
1036  do_command(mode, gb_organism, cl_user);
1037  }
1038  break;
1039  }
1041  GBDATA *gb_curr_organism = GEN_get_current_organism(gb_main);
1042  for (GBDATA *gb_organism = GEN_first_organism(gb_main);
1043  gb_organism;
1044  gb_organism = GEN_next_organism(gb_organism))
1045  {
1046  if (gb_organism != gb_curr_organism) do_command(mode, gb_organism, cl_user);
1047  }
1048  break;
1049  }
1051  GBDATA *gb_organism = GEN_get_current_organism(gb_main);
1052  if (!gb_organism) {
1053  error = "First you have to select a species.";
1054  }
1055  else {
1056  do_command(mode, gb_organism, cl_user);
1057  }
1058  break;
1059  }
1060  default: {
1061  gen_assert(0);
1062  break;
1063  }
1064  }
1065 
1066  GB_end_transaction_show_error(gb_main, error, aw_message);
1067 }
1068 
1070  GEN_unique_param(GBDATA *gb_main_, AW_CL unique_) :
1071  unique(unique_),
1072  gb_main(gb_main_)
1073  {}
1074 
1075  typedef map<AW_CL, GEN_unique_param> ExistingParams;
1076  static ExistingParams existing_params; // to ensure exactly one instance per 'command_mode'
1077 
1078  AW_CL unique;
1079 public:
1081 
1082  AW_CL get_unique() { return unique; }
1083 
1084  static GEN_unique_param *get(GBDATA *gb_main_, AW_CL unique_) { // get unique instance for each 'unique_'
1085  pair<ExistingParams::iterator, bool> created = existing_params.insert(ExistingParams::value_type(unique_, GEN_unique_param(gb_main_, unique_)));
1086  ExistingParams::iterator wanted = created.first;
1087  GEN_unique_param& param = wanted->second;
1088  return &param;
1089  }
1090 };
1091 GEN_unique_param::ExistingParams GEN_unique_param::existing_params;
1092 
1093 
1095  static GEN_command_mode_param *get(GBDATA *gb_main_, AW_CL command_mode_) { return (GEN_command_mode_param*)GEN_unique_param::get(gb_main_, command_mode_); }
1097 };
1098 
1099 
1102 }
1103 
1105  gen_count_marked_genes = 0;
1107 
1108  if ((GEN_MARK_MODE)param->get_command_mode() == GEN_COUNT_MARKED) {
1109  const char *where = NULp;
1110 
1111  switch (perform_mode) {
1112  case GEN_PERFORM_CURRENT_ORGANISM: where = "the current species"; break;
1113  case GEN_PERFORM_MARKED_ORGANISMS: where = "all marked species"; break;
1114  case GEN_PERFORM_ALL_ORGANISMS: where = "all species"; break;
1115  case GEN_PERFORM_ALL_BUT_CURRENT_ORGANISM: where = "all but the current species"; break;
1116  default: gen_assert(0); break;
1117  }
1118  aw_message(GBS_global_string("There are %li marked genes in %s", gen_count_marked_genes, where));
1119  }
1120 }
1121 
1123  static GEN_extract_mode_param *get(GBDATA *gb_main_, GEN_PERFORM_MODE perform_mode) { return (GEN_extract_mode_param*)GEN_unique_param::get(gb_main_, perform_mode); }
1125 };
1126 
1127 static GB_ERROR gene_extract_handler(const char *ali, GEN_extract_mode_param *param) {
1128  GBDATA *gb_main = param->gb_main;
1130 
1131  if (!error) {
1132  GB_transaction ta(gb_main);
1133  GBDATA *gb_ali = GBT_get_alignment(gb_main, ali);
1134 
1135  if (!gb_ali) {
1136  GB_clear_error(); // ali not found
1137  if (!GBT_create_alignment(gb_main, ali, 0, 0, 0, "dna")) {
1138  error = GB_await_error();
1139  }
1140  }
1141  }
1142 
1143  if (!error) {
1144  ask_about_existing_gene_species = new AW_repeated_question;
1145  ask_to_overwrite_alignment = new AW_repeated_question;
1146 
1147  arb_progress progress("Extracting pseudo-species");
1148  {
1149  EG2PS_data *eg2ps = NULp;
1150  {
1151  gen_count_marked_genes = 0;
1153 
1154  GB_transaction ta(gb_main);
1156  eg2ps = new EG2PS_data(ali, gb_species_data, gen_count_marked_genes);
1157  }
1158 
1160 
1162  delete eg2ps;
1163  }
1164 
1167  ask_to_overwrite_alignment = NULp;
1168  ask_about_existing_gene_species = NULp;
1169  }
1170  return error;
1171 }
1173  AWT_activate_prompt("Extract genes to alignment", "Enter the name of the alignment to extract to:", "ali_gene_", "Extract", makeResultHandler(gene_extract_handler, param), "", SRT_AUTOCORRECT_ALINAME);
1174 }
1175 
1177  UNMARK, // UNMARK and MARK have to be 0 and 1!
1181 };
1182 
1183 static void mark_organisms(AW_window*, MarkCommand mark, GBDATA *gb_main) {
1184  GB_transaction ta(gb_main);
1185 
1186  if (mark == MARK_UNMARK_REST) {
1187  GBT_mark_all(gb_main, 0); // unmark all species
1188  mark = MARK;
1189  }
1190 
1191  for (GBDATA *gb_org = GEN_first_organism(gb_main);
1192  gb_org;
1193  gb_org = GEN_next_organism(gb_org))
1194  {
1195  if (mark == INVERT) {
1196  GB_write_flag(gb_org, !GB_read_flag(gb_org)); // invert mark of organism
1197  }
1198  else {
1199  GB_write_flag(gb_org, mark); // mark/unmark organism
1200  }
1201  }
1202 }
1203 
1204 
1205 static void mark_gene_species(AW_window*, MarkCommand mark, GBDATA *gb_main) {
1206  GB_transaction ta(gb_main);
1207 
1208  if (mark == MARK_UNMARK_REST) {
1209  GBT_mark_all(gb_main, 0); // unmark all species
1210  mark = MARK;
1211  }
1212 
1213  for (GBDATA *gb_pseudo = GEN_first_pseudo_species(gb_main);
1214  gb_pseudo;
1215  gb_pseudo = GEN_next_pseudo_species(gb_pseudo))
1216  {
1217  if (mark == INVERT) {
1218  GB_write_flag(gb_pseudo, !GB_read_flag(gb_pseudo)); // invert mark of pseudo-species
1219  }
1220  else {
1221  GB_write_flag(gb_pseudo, mark); // mark/unmark gene-species
1222  }
1223  }
1224 }
1225 
1227  GB_transaction ta(gb_main);
1228  GB_HASH *organism_hash = GBT_create_organism_hash(gb_main);
1229 
1230  for (GBDATA *gb_pseudo = GEN_first_pseudo_species(gb_main);
1231  gb_pseudo;
1232  gb_pseudo = GEN_next_pseudo_species(gb_pseudo))
1233  {
1234  GBDATA *gb_gene = GEN_find_origin_gene(gb_pseudo, organism_hash);
1235  if (GB_read_flag(gb_gene)) {
1236  GB_write_flag(gb_pseudo, 1); // mark pseudo
1237  }
1238  }
1239 
1240  GBS_free_hash(organism_hash);
1241 }
1242 
1243 
1244 
1246  GB_transaction ta(gb_main);
1247 
1248  for (GBDATA *gb_species = GEN_first_organism(gb_main);
1249  gb_species;
1250  gb_species = GEN_next_organism(gb_species))
1251  {
1252  for (GBDATA *gb_gene = GEN_first_gene(gb_species);
1253  gb_gene;
1254  gb_gene = GEN_next_gene(gb_gene))
1255  {
1256  if (GB_read_flag(gb_gene)) {
1257  GB_write_flag(gb_species, 1);
1258  break; // continue with next organism
1259  }
1260  }
1261  }
1262 }
1264  GB_transaction ta(gb_main);
1265  char *ali = GBT_get_default_alignment(gb_main);
1266 
1267  for (GBDATA *gb_pseudo = GEN_first_pseudo_species(gb_main);
1268  gb_pseudo;
1269  gb_pseudo = GEN_next_pseudo_species(gb_pseudo))
1270  {
1271  GBDATA *gb_ali = GB_entry(gb_pseudo, ali);
1272  if (gb_ali) {
1273  GBDATA *gb_data = GB_entry(gb_ali, "data");
1274  if (gb_data) {
1275  GB_write_flag(gb_pseudo, 1);
1276  }
1277  }
1278  }
1279 }
1281  GB_transaction ta(gb_main);
1282  GB_HASH *organism_hash = GBT_create_organism_hash(gb_main);
1283 
1284  for (GBDATA *gb_pseudo = GEN_first_pseudo_species(gb_main);
1285  gb_pseudo;
1286  gb_pseudo = GEN_next_pseudo_species(gb_pseudo))
1287  {
1288  if (GB_read_flag(gb_pseudo)) {
1289  GBDATA *gb_gene = GEN_find_origin_gene(gb_pseudo, organism_hash);
1290  GB_write_flag(gb_gene, 1); // mark gene
1291  }
1292  }
1293 
1294  GBS_free_hash(organism_hash);
1295 }
1296 
1297 static void GEN_insert_extract_submenu(AW_window_menu_modes *awm, GBDATA *gb_main, const char *macro_prefix, const char *submenu_name, const char *hot_key, const char *help_file) {
1298  awm->insert_sub_menu(submenu_name, hot_key);
1299 
1300  char macro_name_buffer[50];
1301 
1302  sprintf(macro_name_buffer, "%s_of_current", macro_prefix);
1303  awm->insert_menu_topic(awm->local_id(macro_name_buffer), "of current species...", "c", help_file, AWM_ALL, makeWindowCallback(gene_extract_cb, GEN_extract_mode_param::get(gb_main, GEN_PERFORM_CURRENT_ORGANISM)));
1304 
1305  sprintf(macro_name_buffer, "%s_of_marked", macro_prefix);
1306  awm->insert_menu_topic(awm->local_id(macro_name_buffer), "of marked species...", "m", help_file, AWM_ALL, makeWindowCallback(gene_extract_cb, GEN_extract_mode_param::get(gb_main, GEN_PERFORM_MARKED_ORGANISMS)));
1307 
1308  sprintf(macro_name_buffer, "%s_of_all", macro_prefix);
1309  awm->insert_menu_topic(awm->local_id(macro_name_buffer), "of all species...", "a", help_file, AWM_ALL, makeWindowCallback(gene_extract_cb, GEN_extract_mode_param::get(gb_main, GEN_PERFORM_ALL_ORGANISMS)));
1310 
1311  awm->close_sub_menu();
1312 }
1313 
1314 static void GEN_insert_multi_submenu(AW_window_menu_modes *awm, const char *macro_prefix, const char *submenu_name, const char *hot_key,
1315  const char *help_file, void (*command)(AW_window*, GEN_PERFORM_MODE, GEN_command_mode_param*), GEN_command_mode_param *command_mode)
1316 {
1317  awm->insert_sub_menu(submenu_name, hot_key);
1318 
1319  char macro_name_buffer[50];
1320 
1321  sprintf(macro_name_buffer, "%s_of_current", macro_prefix);
1322  awm->insert_menu_topic(macro_name_buffer, "of current species", "c", help_file, AWM_ALL, makeWindowCallback(command, GEN_PERFORM_CURRENT_ORGANISM, command_mode));
1323 
1324  sprintf(macro_name_buffer, "%s_of_all_but_current", macro_prefix);
1325  awm->insert_menu_topic(macro_name_buffer, "of all but current species", "b", help_file, AWM_ALL, makeWindowCallback(command, GEN_PERFORM_ALL_BUT_CURRENT_ORGANISM, command_mode));
1326 
1327  sprintf(macro_name_buffer, "%s_of_marked", macro_prefix);
1328  awm->insert_menu_topic(macro_name_buffer, "of marked species", "m", help_file, AWM_ALL, makeWindowCallback(command, GEN_PERFORM_MARKED_ORGANISMS, command_mode));
1329 
1330  sprintf(macro_name_buffer, "%s_of_all", macro_prefix);
1331  awm->insert_menu_topic(macro_name_buffer, "of all species", "a", help_file, AWM_ALL, makeWindowCallback(command, GEN_PERFORM_ALL_ORGANISMS, command_mode));
1332 
1333  awm->close_sub_menu();
1334 }
1335 
1336 static void GEN_insert_mark_submenu(AW_window_menu_modes *awm, GBDATA *gb_main, const char *macro_prefix, const char *submenu_name, const char *hot_key, const char *help_file, GEN_MARK_MODE mark_mode) {
1337  GEN_insert_multi_submenu(awm, macro_prefix, submenu_name, hot_key, help_file, GEN_mark_command, GEN_command_mode_param::get(gb_main, mark_mode));
1338 }
1339 static void GEN_insert_hide_submenu(AW_window_menu_modes *awm, GBDATA *gb_main, const char *macro_prefix, const char *submenu_name, const char *hot_key, const char *help_file, GEN_HIDE_MODE hide_mode) {
1340  GEN_insert_multi_submenu(awm, macro_prefix, submenu_name, hot_key, help_file, GEN_hide_command, GEN_command_mode_param::get(gb_main, hide_mode));
1341 }
1342 
1343 #if defined(DEBUG)
1344 static AW_window *GEN_create_awar_debug_window(AW_root *aw_root) {
1345  static AW_window_simple *aws = NULp;
1346  if (!aws) {
1347  aws = new AW_window_simple;
1348 
1349  aws->init(aw_root, "DEBUG_AWARS", "DEBUG AWARS");
1350  aws->at(10, 10);
1351  aws->auto_space(10, 10);
1352 
1353  const int width = 50;
1354 
1355  ; aws->label("AWAR_SPECIES_NAME "); aws->create_input_field(AWAR_SPECIES_NAME, width);
1356  aws->at_newline(); aws->label("AWAR_ORGANISM_NAME "); aws->create_input_field(AWAR_ORGANISM_NAME, width);
1357  aws->at_newline(); aws->label("AWAR_GENE_NAME "); aws->create_input_field(AWAR_GENE_NAME, width);
1358  aws->at_newline(); aws->label("AWAR_COMBINED_GENE_NAME "); aws->create_input_field(AWAR_COMBINED_GENE_NAME, width);
1359  aws->at_newline(); aws->label("AWAR_EXPERIMENT_NAME "); aws->create_input_field(AWAR_EXPERIMENT_NAME, width);
1360  aws->at_newline(); aws->label("AWAR_COMBINED_EXPERIMENT_NAME"); aws->create_input_field(AWAR_COMBINED_EXPERIMENT_NAME, width);
1361  aws->at_newline(); aws->label("AWAR_PROTEOM_NAME "); aws->create_input_field(AWAR_PROTEOM_NAME, width);
1362  aws->at_newline(); aws->label("AWAR_PROTEIN_NAME "); aws->create_input_field(AWAR_PROTEIN_NAME, width);
1363 
1364  aws->window_fit();
1365  }
1366  return aws;
1367 }
1368 #endif // DEBUG
1369 
1370 // ---------------------------
1371 // user mask section
1372 
1376 
1377  const char *get_self_awar() const OVERRIDE {
1378  return AWAR_COMBINED_GENE_NAME;
1379  }
1381  return 12 + 1 + 40; // species-name+'/'+gene_name
1382  }
1383  GBDATA *current(AW_root *root, GBDATA *gb_main) const OVERRIDE { // give the current item
1384  char *species_name = root->awar(AWAR_ORGANISM_NAME)->read_string();
1385  char *gene_name = root->awar(AWAR_GENE_NAME)->read_string();
1386  GBDATA *gb_gene = NULp;
1387 
1388  if (species_name[0] && gene_name[0]) {
1389  GB_transaction ta(gb_main);
1390  GBDATA *gb_species = GBT_find_species(gb_main, species_name);
1391  if (gb_species) {
1392  gb_gene = GEN_find_gene(gb_species, gene_name);
1393  }
1394  }
1395 
1396  free(gene_name);
1397  free(species_name);
1398 
1399  return gb_gene;
1400  }
1401  const char *getKeyPath() const OVERRIDE { // give the keypath for items
1402  return CHANGE_KEY_PATH_GENES;
1403  }
1404 };
1405 
1407 
1408 static void GEN_open_mask_window(AW_window *aww, int id, GBDATA *gb_main) {
1409  const awt_input_mask_descriptor *descriptor = AWT_look_input_mask(id);
1410  gen_assert(descriptor);
1411  if (descriptor) {
1412  AWT_initialize_input_mask(aww->get_root(), gb_main, &item_type_gene, descriptor->get_internal_maskname(), descriptor->is_local_mask());
1413  }
1414 }
1415 
1418 }
1419 
1421  return QUERY::create_colorize_items_window(aw_root, gb_main, GEN_get_selector());
1422 }
1423 
1425  return QUERY::create_colorize_items_window(aw_root, gb_main, ORGANISM_get_selector());
1426 }
1427 
1428 static void GEN_create_organism_submenu(AW_window_menu_modes *awm, GBDATA *gb_main, bool submenu) {
1429  const char *title = "Organisms";
1430  const char *hotkey = "O";
1431 
1432  if (submenu) awm->insert_sub_menu(title, hotkey);
1433  else awm->create_menu(title, hotkey, AWM_ALL);
1434 
1435  {
1436  awm->insert_menu_topic("organism_info", "Organism information", "i", "sp_info.hlp", AWM_ALL, RootAsWindowCallback::simple(DBUI::popup_organism_info_window, gb_main));
1437 
1438  awm->sep______________();
1439 
1440  awm->insert_menu_topic("mark_organisms", "Mark All organisms", "A", "organism_mark.hlp", AWM_ALL, makeWindowCallback(mark_organisms, MARK, gb_main));
1441  awm->insert_menu_topic("mark_organisms_unmark_rest", "Mark all organisms, unmark Rest", "R", "organism_mark.hlp", AWM_ALL, makeWindowCallback(mark_organisms, MARK_UNMARK_REST, gb_main));
1442  awm->insert_menu_topic("unmark_organisms", "Unmark all organisms", "U", "organism_mark.hlp", AWM_ALL, makeWindowCallback(mark_organisms, UNMARK, gb_main));
1443  awm->insert_menu_topic("invmark_organisms", "Invert marks of all organisms", "v", "organism_mark.hlp", AWM_ALL, makeWindowCallback(mark_organisms, INVERT, gb_main));
1444  awm->sep______________();
1445  awm->insert_menu_topic("mark_organisms_with_marked_genes", "Mark organisms with marked Genes", "G", "organism_mark.hlp", AWM_ALL, makeWindowCallback(mark_organisms_with_marked_genes, gb_main));
1446  awm->sep______________();
1447  awm->insert_menu_topic(awm->local_id("organism_colors"), "Colors ...", "C", "colorize.hlp", AWM_ALL, makeCreateWindowCallback(create_colorize_organisms_window, gb_main));
1448  }
1449  if (submenu) awm->close_sub_menu();
1450 }
1451 
1452 static void GEN_create_gene_species_submenu(AW_window_menu_modes *awm, GBDATA *gb_main, bool submenu) {
1453  const char *title = "Gene-Species";
1454  const char *hotkey = "S";
1455 
1456  if (submenu) awm->insert_sub_menu(title, hotkey);
1457  else awm->create_menu(title, hotkey, AWM_ALL);
1458 
1459  {
1460  awm->insert_menu_topic("mark_gene_species", "Mark All gene-species", "A", "gene_species_mark.hlp", AWM_ALL, makeWindowCallback(mark_gene_species, MARK, gb_main));
1461  awm->insert_menu_topic("mark_gene_species_unmark_rest", "Mark all gene-species, unmark Rest", "R", "gene_species_mark.hlp", AWM_ALL, makeWindowCallback(mark_gene_species, MARK_UNMARK_REST, gb_main));
1462  awm->insert_menu_topic("unmark_gene_species", "Unmark all gene-species", "U", "gene_species_mark.hlp", AWM_ALL, makeWindowCallback(mark_gene_species, UNMARK, gb_main));
1463  awm->insert_menu_topic("invmark_gene_species", "Invert marks of all gene-species", "I", "gene_species_mark.hlp", AWM_ALL, makeWindowCallback(mark_gene_species, INVERT, gb_main));
1464  awm->sep______________();
1465  awm->insert_menu_topic("mark_gene_species_of_marked_genes", "Mark gene-species of marked genes", "M", "gene_species_mark.hlp", AWM_ALL, makeWindowCallback(mark_gene_species_of_marked_genes, gb_main));
1466  awm->insert_menu_topic("mark_gene_species_curr_ali", "Mark all gene-species using Current alignment", "C", "gene_species_mark.hlp", AWM_ALL, makeWindowCallback(mark_gene_species_using_current_alignment, gb_main));
1467  }
1468 
1469  if (submenu) awm->close_sub_menu();
1470 }
1471 
1473  AWT_canvas *canvas1; // just canvasses of different windows (needed for updates)
1475 };
1476 
1477 void GEN_create_genes_submenu(AW_window_menu_modes *awm, GBDATA *gb_main, bool for_ARB_NTREE) {
1478  awm->create_menu("Genome", "G", AWM_ALL);
1479  {
1480 #if defined(DEBUG)
1481  awm->insert_menu_topic(awm->local_id("debug_awars"), "[DEBUG] Show main AWARs", "A", NULp, AWM_ALL, GEN_create_awar_debug_window);
1482  awm->sep______________();
1483 #endif // DEBUG
1484 
1485  if (for_ARB_NTREE) {
1486  awm->insert_menu_topic("gene_map", "Gene Map", "p", "gene_map.hlp", AWM_ALL, makeCreateWindowCallback(GEN_create_first_map, gb_main)); // initial gene map
1487  awm->sep______________();
1488 
1489  GEN_create_gene_species_submenu(awm, gb_main, true); // Gene-species
1490  GEN_create_organism_submenu (awm, gb_main, true); // Organisms
1491  EXP_create_experiments_submenu (awm, gb_main, true); // Experiments
1492  awm->sep______________();
1493  }
1494 
1495  awm->insert_menu_topic("gene_info", "Gene information", "i", "gene_info.hlp", AWM_ALL, RootAsWindowCallback::simple(GEN_popup_gene_infowindow, gb_main));
1496  awm->insert_menu_topic(awm->local_id("gene_search"), "Search and Query", "Q", "gene_search.hlp", AWM_ALL, makeCreateWindowCallback (GEN_create_gene_query_window, gb_main));
1497 
1498  GEN_create_mask_submenu(awm, gb_main);
1499 
1500  awm->sep______________();
1501 
1502  GEN_insert_mark_submenu(awm, gb_main, "gene_mark_all", "Mark all genes", "M", "gene_mark.hlp", GEN_MARK);
1503  GEN_insert_mark_submenu(awm, gb_main, "gene_unmark_all", "Unmark all genes", "U", "gene_mark.hlp", GEN_UNMARK);
1504  GEN_insert_mark_submenu(awm, gb_main, "gene_invert_marked", "Invert marked genes", "v", "gene_mark.hlp", GEN_INVERT_MARKED);
1505  GEN_insert_mark_submenu(awm, gb_main, "gene_count_marked", "Count marked genes", "C", "gene_mark.hlp", GEN_COUNT_MARKED);
1506 
1507  awm->insert_menu_topic(awm->local_id("gene_colors"), "Colors ...", "l", "colorize.hlp", AWM_ALL, makeCreateWindowCallback(create_colorize_genes_window, gb_main));
1508 
1509  awm->sep______________();
1510 
1511  awm->insert_menu_topic("mark_genes_of_marked_gene_species", "Mark genes of marked gene-species", "g", "gene_mark.hlp", AWM_ALL, makeWindowCallback(mark_genes_of_marked_gene_species, gb_main));
1512 
1513  awm->sep______________();
1514 
1515  GEN_insert_extract_submenu(awm, gb_main, "gene_extract_marked", "Extract marked genes", "E", "gene_extract.hlp");
1516 
1517  if (!for_ARB_NTREE) { // only in ARB_GENE_MAP:
1518  awm->sep______________();
1519  GEN_insert_mark_submenu(awm, gb_main, "gene_mark_hidden", "Mark hidden genes", "h", "gene_hide.hlp", GEN_MARK_HIDDEN);
1520  GEN_insert_mark_submenu(awm, gb_main, "gene_mark_visible", "Mark visible genes", "s", "gene_hide.hlp", GEN_MARK_VISIBLE);
1521 
1522  awm->sep______________();
1523  GEN_insert_mark_submenu(awm, gb_main, "gene_unmark_hidden", "Unmark hidden genes", "d", "gene_hide.hlp", GEN_UNMARK_HIDDEN);
1524  GEN_insert_mark_submenu(awm, gb_main, "gene_unmark_visible", "Unmark visible genes", "r", "gene_hide.hlp", GEN_UNMARK_VISIBLE);
1525  }
1526  }
1527 }
1528 
1530  awm->create_menu("Hide", "H", AWM_ALL);
1531  {
1532  GEN_insert_hide_submenu(awm, gb_main, "gene_hide_marked", "Hide marked genes", "H", "gene_hide.hlp", GEN_HIDE_MARKED);
1533  GEN_insert_hide_submenu(awm, gb_main, "gene_unhide_marked", "Unhide marked genes", "U", "gene_hide.hlp", GEN_UNHIDE_MARKED);
1534  GEN_insert_hide_submenu(awm, gb_main, "gene_invhide_marked", "Invert-hide marked genes", "v", "gene_hide.hlp", GEN_INVERT_HIDE_MARKED);
1535 
1536  awm->sep______________();
1537  GEN_insert_hide_submenu(awm, gb_main, "gene_hide_all", "Hide all genes", "a", "gene_hide.hlp", GEN_HIDE_ALL);
1538  GEN_insert_hide_submenu(awm, gb_main, "gene_unhide_all", "Unhide all genes", "l", "gene_hide.hlp", GEN_UNHIDE_ALL);
1539  GEN_insert_hide_submenu(awm, gb_main, "gene_invhide_all", "Invert-hide all genes", "I", "gene_hide.hlp", GEN_INVERT_HIDE_ALL);
1540  }
1541 }
1542 
1545  AWT_auto_refresh allowed_on(win->get_canvas());
1546 
1547  win->get_root()->awar(AWAR_GENMAP_DISPLAY_TYPE(win->get_nr()))->write_int(style);
1548  win->get_graphic()->set_display_style(style);
1549 }
1550 
1552  // param->window_nr shall be 0 for first window (called from ARB_NTREE)
1553  // additional views are always created by the previous window created with GEN_map
1554  GEN_map_manager *manager = NULp;
1555 
1556  if (!GEN_map_manager::initialized()) { // first call
1557  gen_assert(param->window_nr == 0); // has to be 0 for first call
1558 
1559  GEN_map_manager::initialize(aw_root, param->gb_main);
1560  manager = GEN_map_manager::get_map_manager(); // creates the manager
1561 
1562  // global initialization (AWARS etc.) done here :
1563 
1566  {
1567  GB_transaction ta(param->gb_main);
1569  }
1570  }
1571  else {
1573  }
1574 
1575  GEN_map_window *gmw = manager->get_map_window(param->window_nr);
1576  return gmw;
1577 }
1578 
1580  return GEN_create_map(aw_root, new GEN_create_map_param(gb_main, 0));
1581 }
1582 
1583 // ------------------------
1584 // GEN_map_window
1585 
1586 void GEN_map_window::init(AW_root *awr, GBDATA *gb_main) {
1587  {
1588  char *windowName = (window_nr == 0) ? ARB_strdup("ARB Gene Map") : GBS_global_string_copy("ARB Gene Map %i", window_nr);
1589  char *windowID = (window_nr == 0) ? ARB_strdup("ARB_GENE_MAP") : GBS_global_string_copy("ARB_GENE_MAP_%i", window_nr);
1590 
1591  AW_window_menu_modes::init(awr, windowID, windowName, 200, 200);
1592 
1593  free(windowID);
1594  free(windowName);
1595  }
1596 
1598 
1599  gen_graphic = new GEN_graphic(awr, gb_main, GEN_gene_container_cb_installer, window_nr);
1600  gen_canvas = new AWT_canvas(gb_main, this, get_window_id(), gen_graphic);
1601 
1603 
1604  AWT_auto_refresh allowed_on(gen_canvas);
1605  {
1606  GB_transaction ta(gb_main);
1607  gen_graphic->reinit_gen_root(gen_canvas, false);
1608  }
1609  gen_canvas->request_resize();
1610  gen_canvas->set_mode(AWT_MODE_SELECT); // Default-Mode
1611 
1612  // ---------------
1613  // menus
1614 
1615  // File Menu
1616  create_menu("File", "F", AWM_ALL);
1617  insert_menu_topic("close", "Close", "C", NULp, AWM_ALL, AW_POPDOWN);
1618  insert_menu_topic(local_id("new_view"), "New view", "v", "gen_new_view.hlp", AWM_ALL, makeCreateWindowCallback(GEN_create_map, new GEN_create_map_param(gb_main, window_nr+1)));
1619 
1620  GEN_create_genes_submenu (this, gb_main, false); // Genes
1621  GEN_create_gene_species_submenu(this, gb_main, false); // Gene-species
1622  GEN_create_organism_submenu (this, gb_main, false); // Organisms
1623  EXP_create_experiments_submenu (this, gb_main, false); // Experiments
1624  GEN_create_hide_submenu(this, gb_main); // Hide Menu
1625 
1626  // Properties Menu
1627  create_menu("Properties", "r", AWM_ALL);
1628  insert_menu_topic(local_id("gene_props_menu"), "Frame settings ...", "M", "props_frame.hlp", AWM_ALL, AW_preset_window);
1629  insert_menu_topic(local_id("gene_props"), "GENEMAP: Colors and Fonts ...", "C", "color_props.hlp", AWM_ALL, makeCreateWindowCallback(GEN_create_gc_window, gen_canvas->gc_manager));
1630  insert_menu_topic(local_id("gene_options"), "Options", "O", "gen_options.hlp", AWM_ALL, GEN_create_options_window);
1631  insert_menu_topic(local_id("gene_nds"), "NDS ( Select Gene Information ) ...", "N", "props_nds.hlp", AWM_ALL, makeCreateWindowCallback(GEN_open_nds_window, gb_main));
1635  insert_menu_topic("gene_save_props", "Save Defaults (ntree.arb)", "D", "savedef.hlp", AWM_ALL, AW_save_properties);
1636 
1637  // ----------------------
1638  // mode buttons
1639 
1640  create_mode("mode_select.xpm", "gen_mode.hlp", AWM_ALL, makeWindowCallback(GEN_mode_event, this, AWT_MODE_SELECT));
1641  create_mode("mode_zoom.xpm", "gen_mode.hlp", AWM_ALL, makeWindowCallback(GEN_mode_event, this, AWT_MODE_ZOOM));
1642  create_mode("mode_info.xpm", "gen_mode.hlp", AWM_ALL, makeWindowCallback(GEN_mode_event, this, AWT_MODE_INFO));
1643 
1644  // -------------------
1645  // info area
1646 
1647  set_info_area_height(250);
1648  at(11, 2);
1649  auto_space(2, -2);
1650  shadow_width(1);
1651 
1652  // close + undo button, info area, define line y-positions:
1653 
1654  int cur_x, cur_y, start_x, first_line_y, second_line_y, third_line_y;
1655  get_at_position(&start_x, &first_line_y);
1656  button_length(6);
1657 
1658  at(start_x, first_line_y);
1659  help_text("quit.hlp");
1661  create_button("Close", "Close");
1662 
1663  get_at_position(&cur_x, &cur_y);
1664 
1665  int gene_x = cur_x;
1666  at_newline();
1667  get_at_position(&cur_x, &second_line_y);
1668 
1669  at(start_x, second_line_y);
1670  help_text("undo.hlp");
1671  callback(makeWindowCallback(GEN_undo_cb, GB_UNDO_UNDO, gb_main));
1672  create_button("Undo", "Undo");
1673 
1674  at_newline();
1675  get_at_position(&cur_x, &third_line_y);
1676 
1679 
1680  at_newline();
1681  get_at_position(&cur_x, &cur_y);
1682  set_info_area_height(cur_y+6);
1683 
1684  // gene+species buttons:
1685  button_length(20);
1686 
1687  at(gene_x, first_line_y);
1688  help_text("sp_search.hlp");
1689  callback(makeCreateWindowCallback(DBUI::create_species_query_window, gb_main)); // @@@ should use an organism search (using ITEM_organism)
1690  create_button("SEARCH_ORGANISM", AWAR_LOCAL_ORGANISM_NAME(window_nr));
1691 
1692  at(gene_x, second_line_y);
1693  help_text("gene_search.hlp");
1694  callback(makeCreateWindowCallback(GEN_create_gene_query_window, gb_main));
1695  create_button("SEARCH_GENE", AWAR_LOCAL_GENE_NAME(window_nr));
1696 
1697  get_at_position(&cur_x, &cur_y);
1698  int lock_x = cur_x;
1699 
1700  at(lock_x, first_line_y);
1702 
1703  at(lock_x, second_line_y);
1704  create_toggle(AWAR_LOCAL_GENE_LOCK(window_nr));
1705 
1706  get_at_position(&cur_x, &cur_y);
1707  int dtype_x1 = cur_x;
1708 
1709  // display type buttons:
1710 
1711  button_length(4);
1712 
1713  at(dtype_x1, first_line_y);
1714  help_text("gen_disp_style.hlp");
1716  create_button("RADIAL_DISPLAY_TYPE", "#gen_radial.xpm");
1717 
1718  help_text("gen_disp_style.hlp");
1720  create_button("BOOK_DISPLAY_TYPE", "#gen_book.xpm");
1721 
1722  get_at_position(&cur_x, &cur_y);
1723  int jump_x = cur_x;
1724 
1725  at(dtype_x1, second_line_y);
1726  help_text("gen_disp_style.hlp");
1728  create_button("VERTICAL_DISPLAY_TYPE", "#gen_vertical.xpm");
1729 
1730  // jump button:
1731 
1732  button_length(0);
1733 
1734  at(jump_x, first_line_y);
1735  help_text("gen_jump.hlp");
1736  callback(makeWindowCallback(GEN_jump_cb, true));
1737  create_button("Jump", "Jump");
1738 
1739  // help buttons:
1740 
1741  get_at_position(&cur_x, &cur_y);
1742  int help_x = cur_x;
1743 
1744  at(help_x, first_line_y);
1745  help_text("help.hlp");
1746  callback(makeHelpCallback("gene_map.hlp"));
1747  create_button("HELP", "HELP", "H");
1748 
1749  at(help_x, second_line_y);
1751  create_button(NULp, "?");
1752 }
static void mark_gene_species(AW_window *, MarkCommand mark, GBDATA *gb_main)
Definition: GEN_map.cxx:1205
~GEN_item_type_species_selector() OVERRIDE
Definition: GEN_map.cxx:1375
char * ali
Definition: GEN_map.cxx:723
GB_ERROR GB_begin_transaction(GBDATA *gbd)
Definition: arbdb.cxx:2492
ItemSelector & GEN_get_selector()
AW_window * AW_create_gc_window_named(AW_root *aw_root, AW_gc_manager *gcman, const char *wid, const char *windowname)
Definition: AW_preset.cxx:1323
static AW_window * GEN_create_gc_window(AW_root *awr, AW_gc_manager *gcman)
Definition: GEN_map.cxx:635
AW::Vector transform(const AW::Vector &vec) const
Definition: aw_device.hxx:144
void GEN_create_nds_vars(AW_root *aw_root, AW_default awdef, GBDATA *gb_main, const DatabaseCallback &NDS_changed_callback)
Definition: GEN_nds.cxx:184
UniqueNameDetector existing
Definition: GEN_map.cxx:724
bool name_known(const char *name)
Definition: AW_rename.hxx:57
AW_window * create_species_query_window(AW_root *aw_root, GBDATA *gb_main)
const char * GB_ERROR
Definition: arb_core.h:25
GEN_HIDE_MODE
Definition: GEN_map.cxx:681
void get_at_position(int *x, int *y) const
Definition: AW_at.cxx:291
static AW_window * create_colorize_genes_window(AW_root *aw_root, GBDATA *gb_main)
Definition: GEN_map.cxx:1420
GBDATA * gb_species_data
Definition: GEN_map.cxx:722
void set_display_update_callback(AW_root *awr, const char *awar_name, bool zoom_reset, int display_type_mask)
Definition: GEN_map.cxx:458
bool nameProblem
Definition: GEN_map.cxx:727
GB_ERROR GB_commit_transaction(GBDATA *gbd)
Definition: arbdb.cxx:2515
int duplicateSpecies
Definition: GEN_map.cxx:726
GEN_map_window(int window_nr_)
Definition: GEN_map.cxx:54
void popup_organism_info_window(AW_root *aw_root, GBDATA *gb_main)
const awt_input_mask_descriptor * AWT_look_input_mask(int id)
void button_length(int length)
Definition: AW_at.cxx:283
GBDATA * GEN_next_gene(GBDATA *gb_gene)
Definition: adGene.cxx:138
void EXP_create_experiments_submenu(AW_window_menu_modes *awm, GBDATA *gb_main, bool submenu)
Definition: EXP_main.cxx:100
static void GEN_create_hide_submenu(AW_window_menu_modes *awm, GBDATA *gb_main)
Definition: GEN_map.cxx:1529
mark_mode
Definition: db_query.cxx:1556
AWT_COMMAND_MODE
Definition: awt_canvas.hxx:25
bool valid() const
void request_zoom_reset()
Definition: awt_canvas.hxx:364
Definition: arbdb.h:65
const AW_screen_area & get_area_size() const
Definition: AW_device.cxx:57
static void GEN_insert_hide_submenu(AW_window_menu_modes *awm, GBDATA *gb_main, const char *macro_prefix, const char *submenu_name, const char *hot_key, const char *help_file, GEN_HIDE_MODE hide_mode)
Definition: GEN_map.cxx:1339
#define AWAR_LOCAL_GENE_NAME(window_nr)
Definition: GEN_local.hxx:29
char * AWTC_generate_random_name(UniqueNameDetector &existingNames)
Definition: AW_rename.cxx:664
static void GEN_create_mask_submenu(AW_window_menu_modes *awm, GBDATA *gb_main)
Definition: GEN_map.cxx:1416
void insert_menu_topic(const char *id, const char *name, const char *mnemonic, const char *help_text_, AW_active mask, const WindowCallback &wcb)
Definition: AW_window.cxx:592
GEN_PERFORM_MODE get_perform_mode()
Definition: GEN_map.cxx:1124
GB_ERROR GB_write_string(GBDATA *gbd, const char *s)
Definition: arbdb.cxx:1361
void GEN_add_pseudo_species_to_hash(GBDATA *gb_pseudo, GB_HASH *pseudo_hash)
Definition: adGene.cxx:599
const char * get_window_id() const
Definition: aw_window.hxx:364
#define AWAR_GENMAP_SHOW_HIDDEN
Definition: GEN_local.hxx:40
AW_CL get_unique()
Definition: GEN_map.cxx:1082
int no_of_managed_windows()
Definition: GEN_map.cxx:95
AW_window * GEN_create_first_map(AW_root *aw_root, GBDATA *gb_main)
Definition: GEN_map.cxx:1579
GBDATA * GEN_find_gene(GBDATA *gb_species, const char *name)
Definition: adGene.cxx:64
GB_ERROR GB_add_callback(GBDATA *gbd, GB_CB_TYPE type, const DatabaseCallback &dbcb)
Definition: ad_cb.cxx:356
ItemSelector & ORGANISM_get_selector()
Definition: species.cxx:140
AW_root * get_aw_root() const
Definition: GEN_graphic.hxx:85
const char * GEN_window_local_awar_name(const char *awar_name, int window_nr)
Definition: GEN_map.cxx:169
GBDATA * current(AW_root *root, GBDATA *gb_main) const OVERRIDE
Definition: GEN_map.cxx:1383
static AW_window * GEN_create_options_window(AW_root *awr)
Definition: GEN_map.cxx:580
arb_progress progress
Definition: GEN_map.cxx:721
void request_refresh()
Definition: awt_canvas.hxx:362
static void GEN_local_lock_changed_cb(AW_root *awr, GEN_map_window *win, bool gene_lock)
Definition: GEN_map.cxx:419
int get_nr() const
Definition: GEN_map.cxx:65
#define ARB_HIDDEN
Definition: adGene.h:22
GB_ERROR GBT_check_alignment_name(const char *alignment_name)
Definition: adali.cxx:342
static void GEN_organism_or_gene_changed_cb(AW_root *awr)
Definition: GEN_map.cxx:408
#define AWAR_ORGANISM_NAME
void at(int x, int y)
Definition: AW_at.cxx:93
static void gen_extract_gene_2_pseudoSpecies(GBDATA *gb_species, GBDATA *gb_gene, EG2PS_data *eg2ps)
Definition: GEN_map.cxx:764
GBDATA * GEN_get_current_organism(GBDATA *gb_main)
GBDATA * GBT_get_alignment(GBDATA *gb_main, const char *aliname)
Definition: adali.cxx:684
#define AWAR_COMBINED_EXPERIMENT_NAME
Definition: EXP_local.hxx:26
GB_ERROR AWTC_generate_one_name(GBDATA *gb_main, const char *full_name, const char *acc, const char *addid, char *&new_name)
Definition: AW_rename.cxx:317
double right() const
#define AWAR_PROTEOM_NAME
Definition: EXP.hxx:31
static AW_repeated_question * ask_about_existing_gene_species
Definition: GEN_map.cxx:717
char * ARB_strdup(const char *str)
Definition: arb_string.h:27
void create_toggle(const char *awar_name)
Definition: AW_button.cxx:842
void GB_end_transaction_show_error(GBDATA *gbd, GB_ERROR error, void(*error_handler)(GB_ERROR))
Definition: arbdb.cxx:2548
GBDATA * GEN_get_local_gene_data(GEN_graphic *gg)
Definition: GEN_map.cxx:218
long read_int() const
Definition: AW_awar.cxx:187
AW_awar * set_minmax(float min, float max)
Definition: AW_awar.cxx:532
#define AWAR_GENMAP_BOOK_BASES_PER_LINE
Definition: GEN_local.hxx:45
const char * GBS_global_string(const char *templat,...)
Definition: arb_msg.cxx:204
static void GEN_jump_cb(AW_window *aww, bool force_center_if_fits)
Definition: GEN_map.cxx:278
static void GEN_add_local_awar_callbacks(AW_root *awr, AW_default, GEN_map_window *win)
Definition: GEN_map.cxx:477
GEN_graphic * get_graphic() const
Definition: GEN_map.cxx:63
const char * title
Definition: readseq.c:22
#define AWAR_GENMAP_AUTO_JUMP
Definition: GEN_local.hxx:58
static GEN_map_manager * get_map_manager()
Definition: GEN_map.cxx:117
static void GEN_open_mask_window(AW_window *aww, int id, GBDATA *gb_main)
Definition: GEN_map.cxx:1408
static void GEN_insert_multi_submenu(AW_window_menu_modes *awm, const char *macro_prefix, const char *submenu_name, const char *hot_key, const char *help_file, void(*command)(AW_window *, GEN_PERFORM_MODE, GEN_command_mode_param *), GEN_command_mode_param *command_mode)
Definition: GEN_map.cxx:1314
void AWT_create_mask_submenu(AW_window_menu_modes *awm, awt_item_type wanted_item_type, AWT_OpenMaskWindowCallback open_mask_window_cb, GBDATA *gb_main)
#define AWAR_LOCAL_GENE_LOCK(window_nr)
Definition: GEN_local.hxx:32
void GEN_popup_gene_infowindow(AW_root *aw_root, GBDATA *gb_main)
STL namespace.
void AW_POPDOWN(AW_window *window)
Definition: AW_window.cxx:52
#define AWAR_GENMAP_VERTICAL_FACTOR_Y
Definition: GEN_local.hxx:51
void AW_insert_common_property_menu_entries(AW_window_menu_modes *awmm)
Definition: AW_preset.cxx:1445
static void GEN_set_display_style(AW_window *aww, GEN_DisplayStyle style)
Definition: GEN_map.cxx:1543
void GBS_free_hash(GB_HASH *hs)
Definition: adhash.cxx:541
static void mark_organisms(AW_window *, MarkCommand mark, GBDATA *gb_main)
Definition: GEN_map.cxx:1183
GBDATA * GEN_expect_gene_data(GBDATA *gb_species)
Definition: adGene.cxx:54
#define AWAR_GENMAP_ARROW_SIZE
Definition: GEN_local.hxx:39
double top() const
void GEN_refresh_all_windows()
Definition: GEN_map.cxx:381
#define AWAR_GENMAP_RADIAL_INSIDE
Definition: GEN_local.hxx:54
static void GEN_insert_extract_submenu(AW_window_menu_modes *awm, GBDATA *gb_main, const char *macro_prefix, const char *submenu_name, const char *hot_key, const char *help_file)
Definition: GEN_map.cxx:1297
bool nameIsUnique(const char *short_name, GBDATA *gb_species_data)
Definition: GEN_map.cxx:693
DECLARE_CBTYPE_FVV_AND_BUILDERS(GenmapWindowCallback, void, GEN_map_window *)
#define AWAR_FOOTER_MAX_LEN
static void GEN_jump_cb_auto(AW_root *root, GEN_map_window *win, bool force_refresh, bool force_zoom_reset)
Definition: GEN_map.cxx:351
static void GEN_undo_cb(AW_window *, GB_UNDO_TYPE undo_type, GBDATA *gb_main)
Definition: GEN_map.cxx:569
string performmode_relative_id(const char *id, GEN_PERFORM_MODE pmode)
Definition: GEN_map.cxx:658
static void GEN_local_organism_or_gene_name_changed_cb(AW_root *awr, GEN_map_window *win)
Definition: GEN_map.cxx:366
GBDATA * get_gb_main() const
Definition: GEN_graphic.hxx:86
static void GEN_mark_command(AW_window *, GEN_PERFORM_MODE perform_mode, GEN_command_mode_param *param)
Definition: GEN_map.cxx:1104
static void with_all_mapped_windows(void(*cb)(GEN_map_window *))
Definition: GEN_map.cxx:98
static void do_mark_command_for_one_species(int imode, GBDATA *gb_species, AW_CL cl_user)
Definition: GEN_map.cxx:940
EG2PS_data(const char *ali_, GBDATA *gb_species_data_, long marked_genes_)
Definition: GEN_map.cxx:729
GEN_PERFORM_MODE
Definition: GEN_map.cxx:642
static GEN_extract_mode_param * get(GBDATA *gb_main_, GEN_PERFORM_MODE perform_mode)
Definition: GEN_map.cxx:1123
#define AWAR_PROTEIN_NAME
Definition: EXP.hxx:32
#define cb(action)
static void GEN_create_gene_species_submenu(AW_window_menu_modes *awm, GBDATA *gb_main, bool submenu)
Definition: GEN_map.cxx:1452
#define DOWNCAST(totype, expr)
Definition: downcast.h:141
#define gen_assert(bed)
Definition: GEN_local.hxx:19
AW_awar * add_callback(const RootCallback &cb)
Definition: AW_awar.cxx:234
static void GEN_hide_command(AW_window *, GEN_PERFORM_MODE perform_mode, GEN_command_mode_param *param)
Definition: GEN_map.cxx:1100
const GEN_root * get_gen_root() const
Definition: GEN_graphic.hxx:87
GB_UNDO_TYPE
Definition: arbdb.h:107
void init(AW_root *root, GBDATA *gb_main)
Definition: GEN_map.cxx:1586
#define AWAR_GENMAP_DISPLAY_TYPE(window_nr)
Definition: GEN_local.hxx:36
static long gen_count_marked_genes
Definition: GEN_map.cxx:938
const char * read_char_pntr() const
Definition: AW_awar.cxx:171
#define AWAR_GENMAP_RADIAL_OUTSIDE
Definition: GEN_local.hxx:55
NOT4PERL GBDATA * GBT_add_data(GBDATA *species, const char *ali_name, const char *key, GB_TYPES type) __ATTR__DEPRECATED_TODO("better use GBT_create_sequence_data()")
Definition: adali.cxx:559
void reinit_gen_root(AWT_canvas *scr, bool force_reinit)
const char * getKeyPath() const OVERRIDE
Definition: GEN_map.cxx:1401
int create_mode(const char *pixmap, const char *help_text_, AW_active mask, const WindowCallback &cb)
Definition: AW_window.cxx:2958
GB_ERROR GB_await_error()
Definition: arb_msg.cxx:353
static GB_ERROR GEN_species_add_entry(GBDATA *gb_pseudo, const char *key, const char *value)
Definition: GEN_map.cxx:697
GB_HASH * GEN_create_pseudo_species_hash(GBDATA *gb_main, long additionalSize)
Definition: adGene.cxx:609
static AW_root * SINGLETON
Definition: aw_root.hxx:102
GBDATA * GEN_first_pseudo_species(GBDATA *gb_main)
Definition: adGene.cxx:694
WindowCallback makeHelpCallback(const char *helpfile)
Definition: aw_window.hxx:106
GBDATA * GBT_create_alignment(GBDATA *gbd, const char *name, long len, long aligned, long security, const char *type)
Definition: adali.cxx:387
#define MODE_TEXT_STANDARD_ZOOMMODE()
Definition: mode_text.h:35
void set_display_style(GEN_DisplayStyle type)
GB_TYPES GB_read_type(GBDATA *gbd)
Definition: arbdb.cxx:1617
#define AWAR_FOOTER
GEN_DisplayStyle
Definition: GEN_graphic.hxx:38
static AW_window * create_colorize_organisms_window(AW_root *aw_root, GBDATA *gb_main)
Definition: GEN_map.cxx:1424
static void GEN_gene_container_cb_installer(CbInstallMode install, AWT_canvas *gmw, GEN_graphic *gg)
Definition: GEN_map.cxx:236
static void mark_gene_species_of_marked_genes(AW_window *, GBDATA *gb_main)
Definition: GEN_map.cxx:1226
static GEN_unique_param * get(GBDATA *gb_main_, AW_CL unique_)
Definition: GEN_map.cxx:1084
GBDATA * GB_create(GBDATA *father, const char *key, GB_TYPES type)
Definition: arbdb.cxx:1755
AW_awar * awar_float(const char *var_name, float default_value=0.0, AW_default default_file=AW_ROOT_DEFAULT)
Definition: AW_root.cxx:560
GBDATA * gb_species_data
Definition: adname.cxx:34
#define AWAR_LOCAL_ORGANISM_LOCK(window_nr)
Definition: GEN_local.hxx:31
#define MODE_TEXT_1BUTTON(modeName, leftInfo)
Definition: mode_text.h:27
void AW_save_properties(AW_window *aw)
Definition: AW_preset.cxx:1452
void GB_clear_error()
Definition: arb_msg.cxx:365
#define false
Definition: ureadseq.h:13
void create_menu(const char *name, const char *mnemonic, AW_active mask=AWM_ALL)
Definition: AW_window.cxx:469
gene_container_changed_cb_data(AWT_canvas *canvas_, GEN_graphic *graphic_, GBDATA *gb_gene_data_)
Definition: GEN_map.cxx:191
void help_text(const char *id)
Definition: AW_window.cxx:113
void touch()
Definition: AW_awar.cxx:210
GBDATA * GEN_next_marked_organism(GBDATA *gb_organism)
Definition: adGene.cxx:783
static void GEN_create_genemap_local_awars(AW_root *aw_root, AW_default, int window_nr)
Definition: GEN_map.cxx:465
static void error(const char *msg)
Definition: mkptypes.cxx:96
static void GEN_display_param_changed_cb(AW_root *, bool zoom_reset, int display_type_mask)
Definition: GEN_map.cxx:455
GBDATA * GB_get_root(GBDATA *gbd)
Definition: arbdb.cxx:1714
void init(AW_root *root, const char *wid, const char *windowname, int width, int height)
Definition: AW_window.cxx:2374
static GB_ERROR gene_extract_handler(const char *ali, GEN_extract_mode_param *param)
Definition: GEN_map.cxx:1127
size_t get_self_awar_content_length() const OVERRIDE
Definition: GEN_map.cxx:1380
AW_window * AW_preset_window(AW_root *root)
Definition: AW_preset.cxx:1920
GBDATA * get_gb_main() const
Definition: GEN_map.cxx:67
#define AWAR_EXPERIMENT_NAME
Definition: EXP.hxx:30
static const char * GEN_PERFORM_MODE_id[GEN_PERFORM_MODES]
Definition: GEN_map.cxx:651
#define AWAR_SPECIES_NAME
GBDATA * GEN_next_organism(GBDATA *gb_organism)
Definition: adGene.cxx:755
#define SRT_AUTOCORRECT_ALINAME
Definition: arbdbt.h:80
#define AWAR_LOCAL_ORGANISM_NAME(window_nr)
Definition: GEN_local.hxx:28
int GB_read_flag(GBDATA *gbd)
Definition: arbdb.cxx:2760
#define AWAR_GENMAP_SHOW_ALL_NDS
Definition: GEN_local.hxx:41
GBDATA * GBT_find_species_rel_species_data(GBDATA *gb_species_data, const char *name)
Definition: aditem.cxx:133
char * read_string() const
Definition: AW_awar.cxx:201
static WindowCallback simple(void(*root_cb)(AW_root *, T), T t)
Definition: rootAsWin.h:47
AW_awar * awar(const char *awar)
Definition: AW_root.cxx:554
void insert_sub_menu(const char *name, const char *mnemonic, AW_active mask=AWM_ALL)
Definition: AW_window.cxx:642
void reinit_NDS() const
Definition: GEN_gene.cxx:236
const char * no_mode_text_defined()
Definition: mode_text.h:38
AW_awar * unmap()
Definition: AW_awar.cxx:598
static void GEN_perform_command(GBDATA *gb_main, GEN_PERFORM_MODE pmode, void(*do_command)(int cmode, GBDATA *gb_species, AW_CL cl_user), int mode, AW_CL cl_user)
Definition: GEN_map.cxx:1015
AW_window * GEN_create_gene_query_window(AW_root *aw_root, GBDATA *gb_main)
char * GBT_read_gene_sequence(GBDATA *gb_gene, bool use_revComplement, char partSeparator)
Definition: adali.cxx:919
#define CHANGE_KEY_PATH_GENES
Definition: arbdbt.h:87
static void GEN_create_genemap_global_awars(AW_root *aw_root, AW_default def, GBDATA *gb_main)
Definition: GEN_map.cxx:497
static void GEN_gene_container_changed_cb(GBDATA *, gene_container_changed_cb_data *cb_data)
Definition: GEN_map.cxx:198
static AW_window_menu_modes_opengl * awm
GBDATA * GEN_next_pseudo_species(GBDATA *gb_species)
Definition: adGene.cxx:701
#define AWAR_COMBINED_GENE_NAME
Definition: GEN_local.hxx:23
double bottom() const
static void GEN_map_window_refresh_if_display_type(GEN_map_window *win, bool zoom_reset, int display_type_mask)
Definition: GEN_map.cxx:385
const char * get_self_awar() const OVERRIDE
Definition: GEN_map.cxx:1377
GB_ERROR GB_undo(GBDATA *gb_main, GB_UNDO_TYPE type) __ATTR__USERESULT
Definition: adindex.cxx:752
static GEN_item_type_species_selector item_type_gene
Definition: GEN_map.cxx:1406
double left() const
void set_info_area_height(int height)
Definition: AW_window.cxx:793
GB_ERROR GB_export_errorf(const char *templat,...)
Definition: arb_msg.cxx:264
#define AWAR_GENMAP_BOOK_LINE_HEIGHT
Definition: GEN_local.hxx:46
AW_window * create_colorize_items_window(AW_root *aw_root, GBDATA *gb_main, ItemSelector &sel)
Definition: db_query.cxx:1959
AW_device * get_device() const
Definition: GEN_graphic.hxx:88
static void mark_organisms_with_marked_genes(AW_window *, GBDATA *gb_main)
Definition: GEN_map.cxx:1245
void set_mode(AWT_COMMAND_MODE mo)
Definition: awt_canvas.hxx:382
static GEN_command_mode_param * get(GBDATA *gb_main_, AW_CL command_mode_)
Definition: GEN_map.cxx:1095
AW_awar * awar_int(const char *var_name, long default_value=0, AW_default default_file=AW_ROOT_DEFAULT)
Definition: AW_root.cxx:580
void auto_space(int xspace, int yspace)
Definition: AW_at.cxx:259
GBDATA * GLOBAL_gb_main
Definition: DI_main.cxx:27
void AW_help_entry_pressed(AW_window *aww)
Definition: AW_root.cxx:37
void GB_write_flag(GBDATA *gbd, long flag)
Definition: arbdb.cxx:2737
long AW_CL
Definition: cb.h:21
static void gene_extract_cb(AW_window *, GEN_extract_mode_param *param)
Definition: GEN_map.cxx:1172
#define ALL_DISPLAY_TYPES
Definition: GEN_map.cxx:375
static AW_repeated_question * ask_to_overwrite_alignment
Definition: GEN_map.cxx:718
#define OVERRIDE
Definition: cxxforward.h:93
AW_gc_manager * gc_manager
Definition: awt_canvas.hxx:341
AW_window * GEN_open_nds_window(AW_root *aw_root, GBDATA *gb_main)
Definition: GEN_nds.cxx:272
const AW::Rectangle & get_selected_range() const
Definition: GEN_gene.hxx:126
static void initialize(AW_root *aw_root_, GBDATA *gb_main_)
Definition: GEN_map.cxx:89
int GB_read_byte(GBDATA *gbd)
Definition: arbdb.cxx:704
GEN_MARK_MODE
Definition: GEN_map.cxx:662
AW_awar * map(const char *awarn)
Definition: AW_awar.cxx:523
#define AWAR_GENMAP_BOOK_WIDTH_FACTOR
Definition: GEN_local.hxx:44
GB_ERROR GB_write_byte(GBDATA *gbd, int i)
Definition: arbdb.cxx:1208
void GB_remove_callback(GBDATA *gbd, GB_CB_TYPE type, const DatabaseCallback &dbcb)
Definition: ad_cb.cxx:360
static void GEN_NDS_changed(GBDATA *gb_viewkey)
Definition: GEN_map.cxx:179
#define assert_no_auto_refresh_for(CANVAS)
Definition: awt_canvas.hxx:359
void close_sub_menu()
Definition: AW_window.cxx:483
static void GEN_mode_event(AW_window *aws, GEN_map_window *win, AWT_COMMAND_MODE mode)
Definition: GEN_map.cxx:547
static bool initialized()
Definition: GEN_map.cxx:88
#define AWAR_GENMAP_BOOK_LINE_SPACE
Definition: GEN_local.hxx:47
static ARB_init_perl_interface init
Definition: ARB_ext.c:101
void add_name(const char *name)
Definition: AW_rename.hxx:58
uint32_t GBS_checksum(const char *seq, int ignore_case, const char *exclude)
Definition: adstring.cxx:353
GEN_DisplayStyle get_display_style() const
Definition: GEN_graphic.hxx:76
#define AWAR_GENE_NAME
Definition: GEN.hxx:33
void aw_message(const char *msg)
Definition: AW_status.cxx:932
static AW_window * GEN_create_map(AW_root *aw_root, GEN_create_map_param *param)
Definition: GEN_map.cxx:1551
void GEN_make_node_text_init(GBDATA *gb_main)
Definition: GEN_nds.cxx:47
CbInstallMode
Definition: GEN_graphic.hxx:50
AW_root * get_root()
Definition: aw_window.hxx:348
static void GEN_add_global_awar_callbacks(AW_root *awr)
Definition: GEN_map.cxx:522
GBDATA * GEN_first_gene(GBDATA *gb_species)
Definition: adGene.cxx:130
AWT_canvas * canvas1
Definition: GEN_map.cxx:1473
AW_window_simple * win
GBDATA * GBT_find_or_create_species(GBDATA *gb_main, const char *name, bool markCreated)
Definition: aditem.cxx:61
static void with_all_mapped_windows(const GenmapWindowCallback &gwcb)
Definition: GEN_map.cxx:126
#define NULp
Definition: cxxforward.h:97
static const char * readACC(GBDATA *gb_species_data, const char *name)
Definition: GEN_map.cxx:754
GBDATA * GBT_find_species(GBDATA *gb_main, const char *name)
Definition: aditem.cxx:136
GB_HASH * GBT_create_organism_hash(GBDATA *gb_main)
Definition: adhashtools.cxx:48
#define DISPLAY_TYPE_BIT(disp_type)
Definition: GEN_map.cxx:374
AWT_canvas * get_canvas() const
Definition: GEN_map.cxx:64
GB_ERROR write_string(const char *aw_string)
static char * command
Definition: arb_a2ps.c:319
char * GBT_get_default_alignment(GBDATA *gb_main)
Definition: adali.cxx:675
void sep______________()
Definition: AW_window.cxx:750
const char * local_id(const char *id) const
Definition: AW_window.cxx:744
void GBT_mark_all(GBDATA *gb_main, int flag)
Definition: aditem.cxx:291
static void GEN_map_window_refresh(GEN_map_window *win)
Definition: GEN_map.cxx:377
GB_transaction ta(gb_var)
void callback(const WindowCallback &cb)
Definition: AW_window.cxx:130
GB_HASH * pseudo_hash
Definition: GEN_map.cxx:725
GB_CSTR GB_read_char_pntr(GBDATA *gbd)
Definition: arbdb.cxx:874
GBDATA * gb_main
Definition: adname.cxx:33
AW_awar * awar_string(const char *var_name, const char *default_value="", AW_default default_file=AW_ROOT_DEFAULT)
Definition: AW_root.cxx:570
static void GEN_insert_mark_submenu(AW_window_menu_modes *awm, GBDATA *gb_main, const char *macro_prefix, const char *submenu_name, const char *hot_key, const char *help_file, GEN_MARK_MODE mark_mode)
Definition: GEN_map.cxx:1336
GBDATA * GEN_first_marked_organism(GBDATA *gb_main)
Definition: adGene.cxx:777
GBDATA * GEN_first_organism(GBDATA *gb_main)
Definition: adGene.cxx:749
GB_CSTR GBT_get_name_or_description(GBDATA *gb_item)
Definition: aditem.cxx:437
static void mark_gene_species_using_current_alignment(AW_window *, GBDATA *gb_main)
Definition: GEN_map.cxx:1263
void shadow_width(int shadow_thickness)
Definition: AW_window.cxx:1075
AWT_canvas * canvas2
Definition: GEN_map.cxx:1474
static void reinit_NDS_4_window(GEN_map_window *win)
Definition: GEN_map.cxx:173
void GEN_create_genes_submenu(AW_window_menu_modes *awm, GBDATA *gb_main, bool for_ARB_NTREE)
Definition: GEN_map.cxx:1477
static void GEN_update_unlocked_organism_and_gene_awars(GEN_map_window *win, const char *organismName, const char *geneName)
Definition: GEN_map.cxx:397
GBDATA * gb_main
Definition: GEN_map.cxx:1080
static void mark_genes_of_marked_gene_species(AW_window *, GBDATA *gb_main)
Definition: GEN_map.cxx:1280
void at_newline()
Definition: AW_at.cxx:119
const char * GBT_read_char_pntr(GBDATA *gb_container, const char *fieldpath)
Definition: adtools.cxx:307
static void do_hide_command_for_one_species(int imode, GBDATA *gb_species, AW_CL)
Definition: GEN_map.cxx:985
#define AW_ROOT_DEFAULT
Definition: aw_base.hxx:106
int GEN_find_windowNr_for(GEN_graphic *wanted_graphic)
Definition: GEN_map.cxx:204
GB_ERROR write_int(long aw_int)
GB_ERROR AWT_initialize_input_mask(AW_root *root, GBDATA *gb_main, const awt_item_type_selector *sel, const char *mask_name, bool localMask)
GBDATA * GB_entry(GBDATA *father, const char *key)
Definition: adquery.cxx:334
static void GEN_create_organism_submenu(AW_window_menu_modes *awm, GBDATA *gb_main, bool submenu)
Definition: GEN_map.cxx:1428
char * GBS_global_string_copy(const char *templat,...)
Definition: arb_msg.cxx:195
GBDATA * GEN_find_pseudo_species(GBDATA *gb_main, const char *organism_name, const char *gene_name, const GB_HASH *pseudo_hash)
Definition: adGene.cxx:623
GBDATA * GEN_find_origin_gene(GBDATA *gb_pseudo, const GB_HASH *organism_hash)
Definition: adGene.cxx:676
void request_resize()
Definition: awt_canvas.hxx:363
void create_button(const char *macro_name, AW_label label, const char *mnemonic=NULp, const char *color=NULp)
Definition: AW_button.cxx:446
#define AWAR_GENMAP_VERTICAL_FACTOR_X
Definition: GEN_local.hxx:50
void AWT_activate_prompt(const char *title, const char *prompt, const char *defaultResult, const char *button, const ResultHandler &handle_result, const char *helpfile, const char *srt)
Definition: AWT_prompt.cxx:62
GEN_map_window * get_map_window(int nr)
Definition: GEN_map.cxx:136
MarkCommand
Definition: GEN_map.cxx:1176
GBDATA * GBT_get_species_data(GBDATA *gb_main)
Definition: aditem.cxx:105