ARB
MP_noclass.cxx
Go to the documentation of this file.
1 // =============================================================== //
2 // //
3 // File : MP_noclass.cxx //
4 // Purpose : //
5 // //
6 // Institute of Microbiology (Technical University Munich) //
7 // http://www.arb-home.de/ //
8 // //
9 // =============================================================== //
10 
11 #include "MultiProbe.hxx"
12 #include "mp_proto.hxx"
13 #include "MP_externs.hxx"
14 #include "MP_probe.hxx"
15 
16 #include <aw_select.hxx>
17 #include <aw_msg.hxx>
18 #include <arb_progress.h>
19 #include <aw_root.hxx>
20 #include <TreeCallbacks.hxx>
21 #include <client.h>
22 #include <AP_TreeColors.hxx>
23 
24 #include <ctime>
25 
26 int get_random(int min, int max); // gibt eine Zufallszahl x mit der Eigenschaft : min <= x <= max
27 
28 int **system3_tab = NULp;
29 static int system3_tab_size = 0;
30 
31 unsigned char **hamming_tab = NULp;
32 bool new_pt_server = true;
33 
34 long k_chosenFrom_n(int k, int n) { // binomial coefficient. former german name was "k_aus_n".
35  int a = n, b = 1, i;
36 
37  if (k > (n / 2)) k = n - k;
38  if (k <= 0) return k == 0;
39  for (i = 2; i <= k; n--, a *= n, b *= i, i++) ; // IRRELEVANT_LOOP (gcc 9.x refuses to optimize)
40  return a / b;
41 }
42 
43 int get_random(int min, int max) {
44  mp_assert(min <= max);
45  return GB_random(max-min+1)+min;
46 }
47 
49  LocallyModify<int> allow_flag_modify(scr->gfx->exports.get_modifying_flag_ref(), -1); // allow flag updates
50  if (scr->gb_main) scr->gfx->notify_synchronized(scr->gb_main);
51  scr->instant_refresh();
52 }
53 
55  TREE_canvas *scr = mp_main->get_canvas();
56 
59 
61 
62  AP_tree *ap_tree = AWT_TREE(scr)->get_root_node();
63  if (ap_tree) ap_tree->uncolorize();
65 
66  AW_POPDOWN(aww);
67  delete mp_main->get_p_eval();
69  delete mp_main->get_stc();
71 
72  new_pt_server = true;
73 }
74 
75 static char *MP_get_probes(const char *str) {
76  const char *result = strrchr(str, '#');
77 
78  if (!result) {
79  result = str;
80  }
81  else {
82  ++result;
83  result += strspn(result, " \t"); // skip over whitespace
84  }
85  return ARB_strdup(result);
86 }
87 
88 void MP_gen_quality(AW_root *awr) {
89  bool firsttime = true; // @@@ was this static in the past?
90 
91  if (firsttime) {
92  firsttime = false; // @@@ unused
93  return;
94  }
95 
96  char *probe, *new_qual, *ecol_pos;
97  char *selected = awr->awar(MP_AWAR_SELECTEDPROBES)->read_string();
98 
99  if (!selected || !selected[0])
100  return;
101 
102  probe = MP_get_probes(selected);
103  if (!probe || !probe[0])
104  return;
105 
106  ecol_pos = MP_get_comment(3, selected);
107 
109 
110  new_qual = new char[5 + 7 + strlen(probe)]; // 5 = Zahl und Separator und Zahl und Separator und Nullzeichen
111  sprintf(new_qual, "%1ld#%1ld#%6d#%s", mp_gl_awars.probe_quality, mp_gl_awars.singlemismatches, atoi(ecol_pos), probe);
112  delete probe;
113 
114  selected_list->insert(new_qual, new_qual);
115  selected_list->insert_default("", "");
116  selected_list->sort(false, true);
118  awr->awar(MP_AWAR_SELECTEDPROBES)->write_string(new_qual);
119  delete new_qual;
120  delete ecol_pos;
121 }
122 
124  // setzt den 2.Parameter in selected_list
125  char *com1, *com2, *com3, *probes, temp[120];
126  List<char> *l = new List<char>;
127 
129 
130  while (selentry) {
131  const char *ptr2 = selentry.get_value()->get_string();
132  ++selentry;
133 
134  com1 = MP_get_comment(1, ptr2);
135  com2 = MP_get_comment(2, ptr2);
136  com3 = MP_get_comment(3, ptr2);
137  probes = MP_get_probes(ptr2);
138 
139  if (!probes || !probes[0])
140  break;
141 
142  sprintf(temp, "%1d#%1ld#%6d#%s", atoi(com1), mp_gl_awars.no_of_mismatches, atoi(com3), probes);
143 
144  l->insert_as_last(ARB_strdup(temp));
145 
146  delete probes;
147  delete com1;
148  delete com2;
149  delete com3;
150  }
151 
152  selected_list->clear();
153 
154  {
155  const char *ptr2 = l->get_first();
156  while (ptr2) {
157  l->remove_first();
158  selected_list->insert(ptr2, ptr2);
159  delete ptr2;
160  ptr2 = l->get_first();
161  }
162  }
163 
164  selected_list->insert_default("", "");
165  selected_list->sort(false, true);
168 
170  delete l;
171 }
172 
174  char *probe, *new_sing;
175  char *selected = awr->awar(MP_AWAR_SELECTEDPROBES)->read_string();
176 
177  if (!selected || !selected[0])
178  return;
179 
180  probe = MP_get_probes(selected);
182 
183  new_sing = new char[5 + 7 + strlen(probe)]; // 5 = Zahl und Separator und Zahl und Separator und Nullzeichen
184  sprintf(new_sing, "%1ld#%1ld#%6ld#%s", mp_gl_awars.probe_quality, mp_gl_awars.singlemismatches, mp_gl_awars.ecolipos, probe);
185  delete probe;
186 
187  selected_list->insert(new_sing, new_sing);
188  selected_list->insert_default("", "");
189  selected_list->sort(false, true);
191  awr->awar(MP_AWAR_SELECTEDPROBES)->write_string(new_sing);
192  delete new_sing;
193 }
194 
195 static void init_system3_tab() {
196  int i, j, k,
197  size_hamming_tab,
198  hamm_dist;
199  int **dummy_int;
200  int counter, wert;
201 
202  if (system3_tab) {
203  for (j=0; j< system3_tab_size; j++)
204  delete [] system3_tab[j];
205 
206  delete [] system3_tab;
207  }
208  system3_tab = new int*[mp_gl_awars.no_of_probes];
209  system3_tab_size = mp_gl_awars.no_of_probes;
210  for (j=0; j<mp_gl_awars.no_of_probes; j++) {
211  system3_tab[j] = new int[3];
212  memset(system3_tab[j], 0, sizeof(int) * 3);
213  }
214 
215  for (j=0; j< mp_gl_awars.no_of_probes; j++) {
216  for (k=0; k<3; k++) {
217  if (!j) system3_tab[j][k] = k;
218  else system3_tab[j][k] = system3_tab[j-1][k] * 3;
219  }
220  }
221 
222 
223  // ** hamming_tab
224  if (hamming_tab)
225  delete [] hamming_tab;
226 
227  size_hamming_tab = (int)pow(3.0, (double) mp_gl_awars.no_of_probes);
228  hamming_tab = new unsigned char*[size_hamming_tab];
229  dummy_int = new int*[size_hamming_tab];
230 
231  for (i=0; i<size_hamming_tab; i++) {
232  hamming_tab[i] = new unsigned char[size_hamming_tab];
233  memset(hamming_tab[i], 0, sizeof(unsigned char) * size_hamming_tab);
234 
235  dummy_int[i] = new int[mp_gl_awars.no_of_probes];
236  memset(dummy_int[i], 0, sizeof(int) * mp_gl_awars.no_of_probes);
237  }
238 
239  counter = 1;
240  for (i=0; i< mp_gl_awars.no_of_probes; i++) {
241  for (j=0; j<size_hamming_tab; j++) {
242  for (wert = 0; wert < 3; wert++) {
243  for (k=0; k<counter; k++) {
244  dummy_int[j++][i] = wert;
245  }
246  }
247  j--;
248  }
249  counter *= 3;
250  }
251 
252  for (i=0; i<size_hamming_tab; i++) {
253  for (j=0; j<size_hamming_tab; j++) {
254  hamm_dist = 0;
255  for (k=0; k<mp_gl_awars.no_of_probes; k++) {
256  if ((dummy_int[i][k] == 2 && dummy_int[j][k] == 0) ||
257  (dummy_int[i][k] == 0 && dummy_int[j][k] == 2))
258  hamm_dist++;
259  }
260  hamming_tab[i][j] = hamm_dist;
261  }
262  }
263 
264  for (i=0; i<size_hamming_tab; i++) {
265  delete [] dummy_int[i];
266  }
267  delete [] dummy_int;
268 
269 
270 
271 }
272 
276 }
277 
278 bool MP_aborted(int gen_cnt, double avg_fit, double min_fit, double max_fit, arb_progress& progress) {
279  char view_text[150];
280 
281  if (gen_cnt == 0)
282  sprintf(view_text, "Evaluating first generation");
283  else
284  sprintf(view_text, "Gen:%d Avg:%5i Min:%5i Max:%5i", gen_cnt, int(avg_fit), int(min_fit), int(max_fit));
285 
286  progress.subtitle(view_text);
287  return progress.aborted();
288 }
289 
290 
292  AW_root *aw_root = mp_main->get_aw_root();
293  AW_window *aww2;
294  int i = 0;
295  int *bew_array;
296  char *ptr, *qual;
297  char **probe_field;
298  int *single_mismatch;
299  ProbeValuation *p_eval = NULp;
300 
301  MO_Liste::set_gb_main(gb_main);
302 
303  size_t selected_probes_count = selected_list->size();
304  if ((int)selected_probes_count < mp_gl_awars.no_of_probes) {
305  aw_message("Not enough probes selected for computation !!!");
306  return;
307  }
308 
309  if (mp_main->get_stc()) {
310  delete mp_main->get_stc();
311  mp_main->set_stc(NULp);
312  new_pt_server = true;
313  }
314 
316 
317  aww2 = mp_main->get_mp_window()->create_result_window(aw_root);
318 
322 
324  probe_field = new char*[selected_probes_count];
325  bew_array = new int[selected_probes_count];
326  single_mismatch = new int[selected_probes_count];
327 
328  arb_progress progress("Computing multiprobes");
329 
330  while (selentry) {
331  const char *ptr2 = selentry.get_value()->get_string();
332  ++selentry;
333  ptr = MP_get_probes(ptr2); // hier sind es einfachsonden
334  if (ptr && ptr[0] != ' ' && ptr[0] != '\t' && ptr[0] != '\0') {
335  qual = MP_get_comment(1, ptr2);
336  bew_array[i] = atoi(qual);
337  free(qual);
338 
339  qual = MP_get_comment(2, ptr2);
340  single_mismatch[i] = atoi(qual); // single mismatch kann zwar eingestellt werden, aber wird noch nicht uebergeben
341  free(qual);
342 
343  probe_field[i++] = ptr;
344  }
345  }
346 
347  p_eval = mp_main->new_probe_eval(probe_field, i, bew_array, single_mismatch);
348  p_eval->init_valuation();
349 
350  if (pt_server_different) {
351  pt_server_different = false;
352  aw_message("There are species in the tree which are\nnot included in the PT-Server");
353  }
354 
356 
357  aww2->activate();
358 }
359 
360 static bool MP_is_probe(char *seq) {
361  bool result=true;
362  char *s,
363  *seq2;
364 
365  if (! seq)
366  return false;
367 
368  seq2 = MP_get_probes(seq);
369  if (!seq2 || ! seq2[0])
370  return false;
371 
372  s = seq2;
373  while (*s && result) {
374  result = result && MP_probe_tab[(unsigned char)*s];
375  s++;
376  }
377  free(seq2);
378  return result;
379 }
380 
382  AW_root *aw_root = aww->get_root();
383  char *seq = aw_root->awar(MP_AWAR_SEQIN)->read_string();
384 
385  if (MP_is_probe(seq)) {
386  char *new_seq = GBS_global_string_copy("%1ld#%1ld#%6d#%s", mp_gl_awars.probe_quality, mp_gl_awars.singlemismatches, 0, seq);
387 
388  selected_list->insert(new_seq, new_seq);
389  selected_list->sort(false, true);
391 
392  aw_root->awar(MP_AWAR_SELECTEDPROBES)->write_string(new_seq);
393  free(new_seq);
394  }
395  else {
396  aw_message(GBS_global_string("'%s' is no valid probe", seq));
397  }
398  free(seq);
399 }
400 
403 
404 void MP_show_probes_in_tree_move(AW_window *aww, bool backward, AW_selection_list *resultProbesList) {
405  resultProbesList->move_selection(backward ? -1 : 1);
407 }
408 
410  TREE_canvas *scr = mp_main->get_canvas();
411 
412  char *mism, *mism_temp;
413  char *a_probe, *another_probe, *the_probe, *mism_temp2;
414  int i, how_many_probes = 0;
415 
416  {
418  a_probe = MP_get_probes(sel); // haelt jetzt Sondenstring
419  if (! a_probe || ! a_probe[0]) {
420  free(a_probe);
421  free(sel);
422  return;
423  }
424 
425  mism_temp2 = MP_get_comment(2, sel);
426  mism_temp = mism_temp2;
427  free(sel);
428  }
429 
430  char **probe_field = new char*[MAXMISMATCHES];
431  int *mismatches = new int[MAXMISMATCHES];
432 
433  for (i=0; i<MAXMISMATCHES; i++) {
434  probe_field[i] = NULp;
435  mismatches[i] = 0;
436  }
437 
438  another_probe = a_probe;
439  for (i=0; i< MAXPROBECOMBIS; i++) { // generiert probe_field und mismatches array
440  mism = strchr(mism_temp, ' ');
441  if (mism)
442  *(mism++) = 0;
443 
444  mismatches[i] = atoi(mism_temp);
445  mism_temp = mism;
446 
447 
448  probe_field[i] = NULp;
449  the_probe = another_probe;
450  another_probe = strchr(another_probe, ' ');
451  if (another_probe) {
452  *(another_probe++) = 0;
453  while (*another_probe == ' ' || *another_probe == '\t') another_probe++;
454  }
455  else {
456  probe_field[i] = ARB_strdup(the_probe);
457  how_many_probes ++;
458  break;
459  }
460 
461  if (the_probe && the_probe[0]) {
462  probe_field[i] = ARB_strdup(the_probe);
463  how_many_probes ++;
464  }
465  }
466 
467  free(a_probe);
468  free(mism_temp2);
469 
470  if (new_pt_server) {
471  new_pt_server = false;
472 
473  if (mp_main->get_stc()) delete mp_main->get_stc();
474 
476  if (pt_server_different) {
477  mp_main->set_stc(NULp);
478  new_pt_server = true;
479  aw_message("There are species in the tree which are\nnot included in the PT-Server");
480  pt_server_different = false;
481  return;
482  }
483  }
484 
485  delete mp_main->get_stc()->sondentopf;
487 
488  for (i=0; i<MAXMISMATCHES; i++) {
489  if (probe_field[i]) {
490  mp_main->get_stc()->sondentopf->put_Sonde(probe_field[i], mismatches[i], mismatches[i] + mp_gl_awars.outside_mismatches_difference);
491  }
492  }
493 
495 
496  GB_transaction ta(scr->gb_main);
497  AWT_TREE(scr)->get_root_node()->colorize(mp_main->get_stc()->sondentopf->get_color_hash());
499 
500  for (i=0; i<MAXMISMATCHES; i++)
501  free(probe_field[i]);
502 
503  delete [] probe_field;
504  delete [] mismatches;
505 }
506 
508  AWT_canvas *scr = mp_main->get_canvas();
509  char *mism, *mism_temp;
510  char *a_probe, *another_probe, *the_probe, *mism_temp2;
511  int i, how_many_probes = 0;
512  GBDATA *gb_species;
513 
514  {
516  a_probe = MP_get_probes(sel); // haelt jetzt Sondenstring
517 
518  if (! a_probe || ! a_probe[0]) {
519  free(a_probe);
520  free(sel);
521  return;
522  }
523 
524  mism_temp2 = MP_get_comment(2, sel);
525  mism_temp = mism_temp2;
526  free(sel);
527  }
528 
529  char **probe_field = new char*[MAXMISMATCHES];
530  int *mismatches = new int[MAXMISMATCHES];
531 
532  for (i=0; i<MAXMISMATCHES; i++) {
533  probe_field[i] = NULp;
534  mismatches[i] = 0;
535  }
536 
537  another_probe = a_probe;
538  for (i=0; i< MAXPROBECOMBIS; i++) { // generiert probe_field und mismatches array
539  mism = strchr(mism_temp, ' ');
540  if (mism) *(mism++) = 0;
541 
542  mismatches[i] = atoi(mism_temp);
543  mism_temp = mism;
544 
545  probe_field[i] = NULp;
546  the_probe = another_probe;
547  another_probe = strchr(another_probe, ' ');
548  if (another_probe) {
549  *(another_probe++) = 0;
550  while (*another_probe == ' ' || *another_probe == '\t')
551  another_probe++;
552  }
553  else {
554  probe_field[i] = ARB_strdup(the_probe);
555  how_many_probes ++;
556  break;
557  }
558 
559  if (the_probe && the_probe[0]) {
560  probe_field[i] = ARB_strdup(the_probe);
561  how_many_probes ++;
562  }
563  }
564 
565  free(a_probe);
566  free(mism_temp2);
567 
568  if (new_pt_server) {
569  new_pt_server = false;
570 
571  if (mp_main->get_stc())
572  delete mp_main->get_stc();
573 
575  if (pt_server_different) {
576  mp_main->set_stc(NULp);
577  new_pt_server = true;
578  aw_message("There are species in the tree which are not included in the PT-Server");
579  pt_server_different = false;
580  return;
581  }
582  }
583 
584  delete mp_main->get_stc()->sondentopf;
586 
587  for (i=0; i<MAXMISMATCHES; i++) {
588  if (probe_field[i]) {
589  mp_main->get_stc()->sondentopf->put_Sonde(probe_field[i], mismatches[i], mismatches[i] + mp_gl_awars.outside_mismatches_difference);
590  }
591  }
593 
594  {
596  GB_HASH *col_hash = mp_main->get_stc()->sondentopf->get_color_hash();
597  for (gb_species = GBT_first_species(scr->gb_main); gb_species; gb_species = GBT_next_species(gb_species)) {
598  GB_write_flag(gb_species, GBS_read_hash(col_hash, GBT_get_name_or_description(gb_species)) > AWT_GC_BLACK);
599  }
600  }
602 
603  GB_transaction ta(scr->gb_main);
605 
606  for (i=0; i<MAXMISMATCHES; i++)
607  free(probe_field[i]);
608 
609  delete [] probe_field;
610  delete [] mismatches;
611 
613 }
614 
615 void MP_Comment(AW_window *, const char *new_comment) {
616  // Comment fuer Auswahl eintragen
617 
618  AW_root *awr = mp_main->get_aw_root();
619  char *selprobes = awr->awar(MP_AWAR_RESULTPROBES)->read_string();
620  char *new_val = MP_get_probes(selprobes);
621 
622  if (new_val && new_val[0]) {
623  char *new_list_string;
624  {
625  char *edited_comment = NULp;
626  const char *comment = new_comment;
627 
628  if (!comment) {
629  edited_comment = awr->awar(MP_AWAR_RESULTPROBESCOMMENT)->read_string();
630  for (int i = 0; edited_comment[i]; ++i) { // remove all '#' from new comment
631  if (edited_comment[i] == SEPARATOR[0]) {
632  edited_comment[i] = '|';
633  }
634  }
635  }
636 
637  char *misms = MP_get_comment(2, selprobes);
638  char *ecol = MP_get_comment(3, selprobes);
639 
640  new_list_string = GBS_global_string_copy("%-20s" SEPARATOR "%s" SEPARATOR "%s" SEPARATOR "%s",
641  comment, misms, ecol, new_val);
642  free(ecol);
643  free(misms);
644  free(edited_comment);
645  }
646 
647  {
648  bool autoadvance = awr->awar(MP_AWAR_AUTOADVANCE)->read_int();
649 
650  if (autoadvance) result_probes_list->move_selection(1);
651 
653  result_probes_list->insert(new_list_string, new_list_string);
655 
656  if (!autoadvance) awr->awar(MP_AWAR_RESULTPROBES)->write_string(new_list_string);
657  }
658  free(new_list_string);
659  }
660 
661  free(new_val);
662  free(selprobes);
663 }
664 
665 void MP_selected_chosen(AW_root *aw_root) { // @@@ move to MP_Window.cxx
666  const char *selected = aw_root->awar(MP_AWAR_SELECTEDPROBES)->read_char_pntr();
667  if (selected && selected[0]) {
668  char *probe = MP_get_comment(3, selected);
669  if (probe) {
670  aw_root->awar(MP_AWAR_ECOLIPOS)->write_int(atoi(probe));
671  free(probe); // @@@ check/fix ressource handling of probe!
672 
673  if (probe) {
674  probe = MP_get_comment(1, selected);
675  aw_root->awar(MP_AWAR_QUALITY)->write_int(atoi(probe));
676  free(probe);
677 
678  if (probe) {
679  probe = MP_get_comment(2, selected);
680  aw_root->awar(MP_AWAR_SINGLEMISMATCHES)->write_int(atoi(probe));
681  free(probe);
682 
683  if (probe) {
684  probe = MP_get_probes(selected);
686  free(probe);
687  return;
688  }
689  }
690  }
691  }
692  aw_message("can't parse entry");
693  }
694 }
695 
697  TREE_canvas *scr = mp_main->get_canvas();
699 }
700 
702  TREE_canvas *scr = mp_main->get_canvas();
703  GB_transaction ta(scr->gb_main);
704 
706  if (tree) {
707  AP_tree *root = tree->get_root_node();
708  if (root) {
709  root->uncolorize();
711  }
712  }
713 }
714 
716  if (!sellist->default_is_selected()) {
717  int idx = sellist->get_index_of_selected();
718  sellist->delete_element_at(idx);
719  sellist->select_element_at(idx);
720  sellist->update();
721  }
722 }
723 
724 
725 char *MP_get_comment(int which, const char *str) {
726  // Parses information from strings like "val1#val2#val3#probes".
727  // 'which' == 1 -> 'val1'
728  // 'which' == 2 -> 'val2'
729  // ...
730  // Values may be present or not (i.e. 'probes', 'val1#probes', ... are also valid as 'str')
731 
732  char *result = NULp;
733  const char *numsign = strchr(str, '#');
734 
735  mp_assert(which >= 1);
736 
737  if (numsign) {
738  if (which == 1) {
739  result = ARB_strpartdup(str, numsign-1);
740  }
741  else {
742  result = MP_get_comment(which-1, numsign+1);
743  }
744  }
745 
746  return result;
747 }
748 
749 void MP_result_combination_chosen(AW_root *aw_root) { // @@@ move to MP_Window.cxx
750  const char *str = aw_root->awar(MP_AWAR_RESULTPROBES)->read_char_pntr();
751  char *new_str = MP_get_comment(1, str);
752 
753  aw_root->awar(MP_AWAR_RESULTPROBESCOMMENT)->write_string(new_str);
754 
755  free(new_str);
756 }
757 
758 
759 
760 //
761 // functions concerning the server
762 //
763 
765  const char *user = GB_getenvUSER();
766 
767  if (aisc_create(mp_pd_gl.link, PT_MAIN, mp_pd_gl.com,
768  MAIN_LOCS, PT_LOCS, mp_pd_gl.locs,
769  LOCS_USER, user,
770  NULp)) {
771  return 1;
772  }
773  return 0;
774 }
775 
776 // --------------------------------------------------------------------------------
777 
778 #ifdef UNIT_TESTS
779 
780 #include <test_unit.h>
781 
782 #define MP_GET_COMMENT_EQUAL(which, str, expect) \
783  do { \
784  char *got = MP_get_comment(which, str); \
785  TEST_EXPECT_EQUAL(got, expect); \
786  free(got); \
787  } while(0) \
788 
789 #define MP_GET_PROBES_EQUAL(str, expect) \
790  do { \
791  char *got = MP_get_probes(str); \
792  TEST_EXPECT_EQUAL(got, expect); \
793  free(got); \
794  } while(0) \
795 
796 void TEST_MP_get_comment_and_probes() {
797  char *probes_only = ARB_strdup("ACGT TGCA ATCG");
798  char *probes_comment = ARB_strdup("val1#val2#val3#ACGT TGCA ATCG");
799  char *probes_1 = ARB_strdup("one# \t ACGT TGCA ATCG");
800  char *probes_2 = ARB_strdup("one#two#\tACGT TGCA ATCG");
801 
802  MP_GET_PROBES_EQUAL(probes_only, "ACGT TGCA ATCG");
803  MP_GET_PROBES_EQUAL(probes_comment, "ACGT TGCA ATCG");
804  MP_GET_PROBES_EQUAL(probes_1, "ACGT TGCA ATCG");
805  MP_GET_PROBES_EQUAL(probes_2, "ACGT TGCA ATCG");
806 
807  MP_GET_COMMENT_EQUAL(1, probes_comment, "val1");
808  MP_GET_COMMENT_EQUAL(2, probes_comment, "val2");
809  MP_GET_COMMENT_EQUAL(3, probes_comment, "val3");
810 
811  MP_GET_COMMENT_EQUAL(1, probes_only, (const char *)NULp);
812  MP_GET_COMMENT_EQUAL(2, probes_only, (const char *)NULp);
813  MP_GET_COMMENT_EQUAL(3, probes_only, (const char *)NULp);
814 
815  MP_GET_COMMENT_EQUAL(1, probes_1, "one");
816  MP_GET_COMMENT_EQUAL(2, probes_1, (const char *)NULp);
817  MP_GET_COMMENT_EQUAL(3, probes_1, (const char *)NULp);
818 
819  MP_GET_COMMENT_EQUAL(1, probes_2, "one");
820  MP_GET_COMMENT_EQUAL(2, probes_2, "two");
821  MP_GET_COMMENT_EQUAL(3, probes_2, (const char *)NULp);
822 
823  free(probes_2);
824  free(probes_1);
825  free(probes_comment);
826  free(probes_only);
827 }
828 
829 #endif // UNIT_TESTS
long singlemismatches
Definition: MultiProbe.hxx:97
bool pt_server_different
Definition: MP_main.cxx:29
#define AWT_TREE(ntw)
Definition: TreeDisplay.hxx:85
void MP_gen_quality(AW_root *awr)
Definition: MP_noclass.cxx:88
string result
void sort(bool backward, bool case_sensitive)
Definition: AW_select.cxx:502
AW_window_simple * get_result_window()
Definition: MultiProbe.hxx:165
positiontype insert_as_last(Type *object)
Definition: SoTl.hxx:433
T_PT_LOCS locs
Definition: mpdefs.h:51
long k_chosenFrom_n(int k, int n)
Definition: MP_noclass.cxx:34
#define MP_AWAR_RESULTPROBES
Definition: MultiProbe.hxx:52
long no_of_mismatches
Definition: MultiProbe.hxx:95
char * MP_get_comment(int which, const char *str)
Definition: MP_noclass.cxx:725
void set_p_eval(ProbeValuation *y)
Definition: MultiProbe.hxx:149
void select_element_at(int wanted_index)
Definition: AW_select.cxx:433
void insert_default(const char *displayed, const AW_scalar &value)
Definition: AW_select.cxx:385
void MP_new_sequence(AW_window *aww)
Definition: MP_noclass.cxx:381
void MP_compute(AW_window *, GBDATA *gb_main)
Definition: MP_noclass.cxx:291
#define MP_AWAR_QUALITY
Definition: MultiProbe.hxx:55
void MP_show_probes_in_tree_move(AW_window *aww, bool backward, AW_selection_list *resultProbesList)
Definition: MP_noclass.cxx:404
unsigned char ** hamming_tab
Definition: MP_noclass.cxx:31
GB_HASH * get_color_hash()
Definition: MultiProbe.hxx:224
static void set_gb_main(GBDATA *gb_main_)
Definition: MultiProbe.hxx:324
AW_root * get_aw_root()
Definition: MultiProbe.hxx:144
#define SEPARATOR
Definition: mpdefs.h:16
#define MP_AWAR_RESULTPROBESCOMMENT
Definition: MultiProbe.hxx:53
char * ARB_strdup(const char *str)
Definition: arb_string.h:27
long read_int() const
Definition: AW_awar.cxx:184
void delete_element_at(int index)
Definition: AW_select.cxx:248
int MP_init_local_com_struct(mp_gl_struct &mp_pd_gl)
Definition: MP_noclass.cxx:764
const char * GBS_global_string(const char *templat,...)
Definition: arb_msg.cxx:203
static int system3_tab_size
Definition: MP_noclass.cxx:29
void MP_normal_colors_in_tree(AW_window *)
Definition: MP_noclass.cxx:701
void AW_POPDOWN(AW_window *window)
Definition: AW_window.cxx:52
bool default_is_selected() const
Definition: AW_select.cxx:203
int get_index_of_selected()
Definition: AW_select.cxx:316
char * ARB_strpartdup(const char *start, const char *end)
Definition: arb_string.h:51
void MP_show_probes_in_tree(AW_window *)
Definition: MP_noclass.cxx:409
ProbeValuation * get_p_eval()
Definition: MultiProbe.hxx:146
void remove_first()
Definition: SoTl.hxx:584
#define MP_AWAR_ECOLIPOS
Definition: MultiProbe.hxx:61
MP_Main * mp_main
Definition: MP_main.cxx:24
GB_ERROR GB_push_transaction(GBDATA *gbd)
Definition: arbdb.cxx:2494
long ecolipos
Definition: MultiProbe.hxx:102
void activate()
Definition: aw_window.hxx:365
FILE * seq
Definition: rns.c:46
void MP_gen_singleprobe(AW_root *awr)
Definition: MP_noclass.cxx:173
struct Unfixed_cb_parameter * UNFIXED
Definition: cb_base.h:15
void insert(const char *displayed, const AW_scalar &value)
Definition: AW_select.cxx:380
const char * get_string() const
Definition: aw_scalar.hxx:72
const char * read_char_pntr() const
Definition: AW_awar.cxx:168
void MP_selected_chosen(AW_root *aw_root)
Definition: MP_noclass.cxx:665
Sondentopf * sondentopf
Definition: MultiProbe.hxx:282
int remembered_mismatches
Definition: MP_main.cxx:26
#define MP_AWAR_SELECTEDPROBES
Definition: MultiProbe.hxx:45
AW_selection_list * result_probes_list
Definition: MP_Window.cxx:33
static bool MP_is_probe(char *seq)
Definition: MP_noclass.cxx:360
MO_Liste * Auswahlliste
Definition: MultiProbe.hxx:281
bool aborted()
Definition: arb_progress.h:335
ProbeValuation * new_probe_eval(char **field, int size, int *array, int *mismatches)
Definition: MP_main.cxx:57
static char * MP_get_probes(const char *str)
Definition: MP_noclass.cxx:75
static void refresh_without_dbsync(AWT_canvas *scr)
Definition: MP_noclass.cxx:48
void MP_Comment(AW_window *, const char *new_comment)
Definition: MP_noclass.cxx:615
void destroy_probe_eval()
Definition: MP_main.cxx:52
char MP_probe_tab[256]
Definition: MP_main.cxx:25
void NT_expand_marked_cb(UNFIXED, TREE_canvas *ntw)
char * str
Definition: defines.h:20
void put_Sonde(const char *name, int allowed_mis, double outside_mis)
#define MAXMISMATCHES
Definition: MultiProbe.hxx:66
TREE_canvas * get_canvas()
Definition: MultiProbe.hxx:145
int GB_random(int range)
Definition: admath.cxx:88
AW_selection_list * selected_list
Definition: MP_Window.cxx:32
void MP_mark_probes_in_tree(AW_window *aww)
Definition: MP_noclass.cxx:507
virtual void notify_synchronized(GBDATA *gb_main)=0
char * read_string() const
Definition: AW_awar.cxx:198
void set_stc(ST_Container *stopfC)
Definition: MultiProbe.hxx:148
void MP_popup_result_window(AW_window *)
Definition: MP_noclass.cxx:273
AW_awar * awar(const char *awar)
Definition: AW_root.cxx:554
GB_ERROR GB_pop_transaction(GBDATA *gbd)
Definition: arbdb.cxx:2524
void MP_group_all_except_marked(AW_window *)
Definition: MP_noclass.cxx:696
bool new_pt_server
Definition: MP_noclass.cxx:32
float outside_mismatches_difference
Definition: MultiProbe.hxx:92
void instant_refresh()
Definition: AWT_canvas.cxx:373
AWT_graphic * gfx
Definition: awt_canvas.hxx:339
#define MP_AWAR_AUTOADVANCE
Definition: MultiProbe.hxx:62
void GB_write_flag(GBDATA *gbd, long flag)
Definition: arbdb.cxx:2773
static void init_system3_tab()
Definition: MP_noclass.cxx:195
const AW_scalar * get_value() const
Definition: aw_select.hxx:160
Type * get_first()
Definition: SoTl.hxx:335
GB_CSTR GB_getenvUSER(void)
Definition: adsocket.cxx:545
void move_selection(int offset)
Definition: AW_select.cxx:415
#define MP_AWAR_SEQIN
Definition: MultiProbe.hxx:44
AP_tree * get_root_node()
#define MAXSONDENHASHSIZE
Definition: MultiProbe.hxx:84
void subtitle(const char *stitle)
Definition: arb_progress.h:321
AWT_graphic_exports exports
Definition: awt_canvas.hxx:249
void MP_result_combination_chosen(AW_root *aw_root)
Definition: MP_noclass.cxx:749
GBDATA * GBT_first_species(GBDATA *gb_main)
Definition: aditem.cxx:124
void init_valuation()
Definition: MP_probe.cxx:164
int ** system3_tab
Definition: MP_noclass.cxx:28
void MP_delete_selected(UNFIXED, AW_selection_list *sellist)
Definition: MP_noclass.cxx:715
void aw_message(const char *msg)
Definition: AW_status.cxx:1142
MO_Liste * Bakterienliste
Definition: MultiProbe.hxx:280
void gen_color_hash(positiontype anz_sonden)
AW_root * get_root()
Definition: aw_window.hxx:359
GBDATA * GBT_next_species(GBDATA *gb_species)
Definition: aditem.cxx:128
#define NULp
Definition: cxxforward.h:116
#define MAXPROBECOMBIS
Definition: MultiProbe.hxx:65
long no_of_probes
Definition: MultiProbe.hxx:96
aisc_com * link
Definition: mpdefs.h:50
int & get_modifying_flag_ref()
Definition: awt_canvas.hxx:143
void MP_close_main(AW_window *aww)
Definition: MP_noclass.cxx:54
void MP_cache_sonden(AW_window *)
Definition: MP_noclass.cxx:401
int get_random(int min, int max)
Definition: MP_noclass.cxx:43
GB_ERROR write_string(const char *aw_string)
#define mp_assert(cond)
Definition: mkptypes.cxx:32
MP_Window * get_mp_window()
Definition: MultiProbe.hxx:143
awar_vars mp_gl_awars
Definition: MP_main.cxx:23
void MP_modify_selected(AW_root *awr)
Definition: MP_noclass.cxx:123
GB_transaction ta(gb_var)
GBDATA * gb_main
Definition: adname.cxx:32
AW_awar * awar_string(const char *var_name, const char *default_value="", AW_default default_file=AW_ROOT_DEFAULT)
Definition: AW_root.cxx:570
void MP_cache_sonden2(AW_root *)
Definition: MP_noclass.cxx:402
GB_CSTR GBT_get_name_or_description(GBDATA *gb_item)
Definition: aditem.cxx:459
bool MP_aborted(int gen_cnt, double avg_fit, double min_fit, double max_fit, arb_progress &progress)
Definition: MP_noclass.cxx:278
T_PT_MAIN com
Definition: mpdefs.h:52
#define min(a, b)
Definition: f2c.h:153
ST_Container * get_stc()
Definition: MultiProbe.hxx:147
#define MP_AWAR_SINGLEMISMATCHES
Definition: MultiProbe.hxx:56
long probe_quality
Definition: MultiProbe.hxx:99
GB_ERROR write_int(long aw_int)
long GBS_read_hash(const GB_HASH *hs, const char *key)
Definition: adhash.cxx:392
AW_window_simple * create_result_window(AW_root *aw_root)
Definition: MP_Window.cxx:38
int aisc_create(aisc_com *link, int father_type, const AISC_Object &father, int attribute, int object_type, AISC_Object &object,...)
Definition: client.c:593
void delete_value(const AW_scalar &value)
Definition: AW_select.cxx:269
char * GBS_global_string_copy(const char *templat,...)
Definition: arb_msg.cxx:194
GBDATA * gb_main
Definition: awt_canvas.hxx:336
void uncolorize()
Definition: AP_Tree.hxx:306
GB_write_int const char s
Definition: AW_awar.cxx:154
#define max(a, b)
Definition: f2c.h:154