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