ARB
arb_probe.cxx
Go to the documentation of this file.
1 // =============================================================== //
2 // //
3 // File : arb_probe.cxx //
4 // Purpose : //
5 // //
6 // Institute of Microbiology (Technical University Munich) //
7 // http://www.arb-home.de/ //
8 // //
9 // =============================================================== //
10 
11 #include <PT_com.h>
12 #include <arbdb.h>
13 
14 #include <client.h>
15 #include <servercntrl.h>
16 
17 #include <arb_defs.h>
18 #include <arb_strbuf.h>
19 #include <arb_diff.h>
20 #include <RegExpr.hxx>
21 
22 #include <algorithm>
23 #include <string> // need to include before test_unit.h
24 #include <unistd.h>
25 
26 struct apd_sequence {
28  const char *sequence;
29 };
30 
31 struct Params {
33  int SERVERID;
34  const char *DESIGNNAMES;
37  const char *DESIGNSEQUENCE;
38 
39  int MINTEMP;
40  int MAXTEMP;
41  int MINGC;
42  int MAXGC;
43  int MAXBOND;
44  int MINPOS;
45  int MAXPOS;
46  int MISHIT;
48  const char *SEQUENCE;
50  int ACCEPTN;
51  int LIMITN;
52  int MAXRESULT;
54  int WEIGHTED;
55 
57 
58  int ITERATE;
61  const char *ITERATE_SEPARATOR;
62  const char *ITERATE_TU;
63 
64  const char *DUMP;
65 };
66 
67 
68 struct gl_struct {
69  aisc_com *link;
70  T_PT_MAIN com;
71  T_PT_LOCS locs;
73 
75  : link(NULp),
76  pd_design_id(0)
77  {}
78 
79 };
80 
81 static Params P;
83 
84 static int init_local_com_struct() {
85  const char *user = GB_getenvUSER();
86 
87  if (aisc_create(pd_gl.link, PT_MAIN, pd_gl.com,
88  MAIN_LOCS, PT_LOCS, pd_gl.locs,
89  LOCS_USER, user,
90  NULp)) {
91  return 1;
92  }
93 
94  return 0;
95 }
96 
98  // DRY vs ../MULTI_PROBE/MP_noclass.cxx@MP_probe_pt_look_for_server
99  // DRY vs ../PROBE_DESIGN/probe_design.cxx@PD_probe_pt_look_for_server
100  const char *server_tag = GBS_ptserver_tag(P.SERVERID);
101  error = arb_look_and_start_server(AISC_MAGIC_NUMBER, server_tag);
102 
103  const char *result = NULp;
104  if (!error) {
105  result = GBS_read_arb_tcp(server_tag);
106  if (!result) error = GB_await_error();
107  }
108  return result;
109 }
110 
112  static int count;
113  bool need_close;
114 public:
116  : need_close(false)
117  {
118  if (count) {
119  error = "Only 1 PTserverConnection allowed";
120  }
121  else {
122  ++count;
123  const char *servername = AP_probe_pt_look_for_server(error);
124  if (servername) {
125  GB_ERROR openerr = NULp;
126  pd_gl.link = aisc_open(servername, pd_gl.com, AISC_MAGIC_NUMBER, &openerr);
127  if (openerr) {
128  error = openerr;
129  }
130  else {
131  if (!pd_gl.link) {
132  error = "Cannot contact PT_SERVER [1]";
133  }
134  else if (init_local_com_struct()) {
135  error = "Cannot contact PT_SERVER [2]";
136  }
137  else {
138  need_close = true;
139  }
140  }
141  }
142  }
143  }
145  if (need_close) {
146  aisc_close(pd_gl.link, pd_gl.com);
147  pd_gl.link = NULp;
148  }
149  --count;
150  }
151 };
152 int PTserverConnection::count = 0;
153 
155  PTserverConnection contact(error);
156 
157  char *result = NULp;
158  if (!error) {
159  aisc_put(pd_gl.link, PT_MAIN, pd_gl.com,
160  MAIN_DUMP_NAME, P.DUMP,
161  NULp);
162 
163  if (aisc_get(pd_gl.link, PT_MAIN, pd_gl.com,
164  MAIN_DUMP_INDEX, &result,
165  NULp)) {
166  error = "Connection to PT_SERVER lost (1)";
167  }
168  else {
169  result = ARB_strdup("ok");
170  }
171  }
172  return result;
173 }
174 
176  PTserverConnection contact(error);
177 
178  char *result = NULp;
179  if (!error) {
180  T_PT_PEP pep;
181  int length = P.ITERATE;
182 
183  if (aisc_create(pd_gl.link, PT_LOCS, pd_gl.locs,
184  LOCS_PROBE_FIND_CONFIG, PT_PEP, pep,
185  PEP_PLENGTH, (long)length,
186  PEP_RESTART, (long)1,
187  PEP_READABLE, (long)P.ITERATE_READABLE,
188  PEP_TU, (long)P.ITERATE_TU[0],
189  PEP_SEPARATOR, (long)P.ITERATE_SEPARATOR[0],
190  NULp))
191  {
192  error = "Connection to PT_SERVER lost (1)";
193  }
194 
195  if (!error) {
196  int amount = P.ITERATE_AMOUNT;
197  int amount_per_call = AISC_MAX_STRING_LEN/(length+2);
198 
199  GBS_strstruct out(50000);
200  bool first = true;
201 
202  while (amount && !error) {
203  int this_amount = std::min(amount, amount_per_call);
204 
205  aisc_put(pd_gl.link, PT_PEP, pep,
206  PEP_NUMGET, (long)this_amount,
207  PEP_FIND_PROBES, (long)0,
208  NULp);
209 
210  char *pep_result = NULp;
211  if (aisc_get(pd_gl.link, PT_PEP, pep,
212  PEP_RESULT, &pep_result,
213  NULp)) {
214  error = "Connection to PT_SERVER lost (2)";
215  }
216 
217  if (!error) {
218  if (pep_result[0]) {
219  if (first) first = false;
220  else out.put(P.ITERATE_SEPARATOR[0]);
221 
222  out.cat(pep_result);
223  amount -= this_amount;
224  }
225  else {
226  amount = 0; // terminate loop
227  }
228  }
229  free(pep_result);
230  }
231 
232  if (!error) {
233  result = out.release();
234  }
235  }
236  }
237 
238  if (error) freenull(result);
239  return result;
240 }
241 
243  PTserverConnection contact(error);
244 
245  if (!error) {
246  bytestring bs;
247  bs.data = (char*)(P.DESIGNNAMES);
248  bs.size = strlen(bs.data)+1;
249 
250  T_PT_PDC pdc;
251  if (aisc_create(pd_gl.link, PT_LOCS, pd_gl.locs,
252  LOCS_PROBE_DESIGN_CONFIG, PT_PDC, pdc,
253  PDC_MIN_PROBELEN, (long)P.DESIGNPROBELEN,
254  PDC_MAX_PROBELEN, (long)P.DESIGNMAXPROBELEN,
255  PDC_MINTEMP, (double)P.MINTEMP,
256  PDC_MAXTEMP, (double)P.MAXTEMP,
257  PDC_MINGC, (double)P.MINGC/100.0,
258  PDC_MAXGC, (double)P.MAXGC/100.0,
259  PDC_MAXBOND, (double)P.MAXBOND,
260  PDC_MIN_ECOLIPOS, (long)P.MINPOS,
261  PDC_MAX_ECOLIPOS, (long)P.MAXPOS,
262  PDC_MISHIT, (long)P.MISHIT,
263  PDC_MINTARGETS, (double)P.MINTARGETS/100.0,
264  PDC_CLIPRESULT, (long)P.DESIGNCLIPOUTPUT,
265  NULp))
266  {
267  error = "Connection to PT_SERVER lost (1)";
268  }
269 
270  if (!error) {
271  for (apd_sequence *s = P.sequence; s; ) {
272  apd_sequence *next = s->next;
273 
274  bytestring bs_seq;
275  T_PT_SEQUENCE pts;
276 
277  bs_seq.data = (char*)s->sequence;
278  bs_seq.size = strlen(bs_seq.data)+1;
279  aisc_create(pd_gl.link, PT_PDC, pdc,
280  PDC_SEQUENCE, PT_SEQUENCE, pts,
281  SEQUENCE_SEQUENCE, &bs_seq,
282  NULp);
283 
284  delete s;
285  s = next;
286  }
287 
288  aisc_put(pd_gl.link, PT_PDC, pdc,
289  PDC_NAMES, &bs,
290  PDC_GO, (long)0,
291  NULp);
292 
293  {
294  char *locs_error = NULp;
295  if (aisc_get(pd_gl.link, PT_LOCS, pd_gl.locs,
296  LOCS_ERROR, &locs_error,
297  NULp)) {
298  error = "Connection to PT_SERVER lost (2)";
299  }
300  else {
301  if (*locs_error) error = GBS_static_string(locs_error);
302  free(locs_error);
303  }
304  }
305 
306  if (!error) {
307  T_PT_TPROBE tprobe;
308  aisc_get(pd_gl.link, PT_PDC, pdc,
309  PDC_TPROBE, tprobe.as_result_param(),
310  NULp);
311 
312 
313  GBS_strstruct *outstr = GBS_stropen(1000);
314 
315  if (tprobe.exists()) {
316  char *match_info = NULp;
317  aisc_get(pd_gl.link, PT_PDC, pdc,
318  PDC_INFO_HEADER, &match_info,
319  NULp);
320  GBS_strcat(outstr, match_info);
321  GBS_chrcat(outstr, '\n');
322  free(match_info);
323  }
324 
325 
326  while (tprobe.exists()) {
327  char *match_info = NULp;
328  if (aisc_get(pd_gl.link, PT_TPROBE, tprobe,
329  TPROBE_NEXT, tprobe.as_result_param(),
330  TPROBE_INFO, &match_info,
331  NULp)) break;
332  GBS_strcat(outstr, match_info);
333  GBS_chrcat(outstr, '\n');
334  free(match_info);
335  }
336 
337  return GBS_strclose(outstr);
338  }
339  }
340  }
341  return NULp;
342 }
343 
345  PTserverConnection contact(error);
346 
347  if (!error &&
348  aisc_nput(pd_gl.link, PT_LOCS, pd_gl.locs,
349  LOCS_MATCH_ALSO_REVCOMP, (long)P.ALSO_REVCOMPL,
350  LOCS_COMPLEMENT_FIRST, (long)0, // (use sequence passed below as is. do not complement it.)
351  LOCS_MATCH_SORT_BY, (long)P.WEIGHTED,
352  LOCS_MATCH_MAX_MISMATCHES, (long)P.MISMATCHES,
353  LOCS_MATCH_N_ACCEPT, (long)P.ACCEPTN,
354  LOCS_MATCH_N_LIMIT, (long)P.LIMITN,
355  LOCS_MATCH_MAX_HITS, (long)P.MAXRESULT,
356  LOCS_SEARCHMATCH, P.SEQUENCE,
357  NULp)) {
358  error = "Connection to PT_SERVER lost (1)";
359  }
360 
361  if (!error) {
362  bytestring bs;
363  bs.data = NULp;
364  {
365  char *locs_error = NULp;
366  T_PT_MATCHLIST match_list;
367  long match_list_cnt;
368 
369  aisc_get(pd_gl.link, PT_LOCS, pd_gl.locs,
370  LOCS_MATCH_LIST, match_list.as_result_param(),
371  LOCS_MATCH_LIST_CNT, &match_list_cnt,
372  LOCS_MATCH_STRING, &bs,
373  LOCS_ERROR, &locs_error,
374  NULp);
375  if (*locs_error) error = GBS_static_string(locs_error);
376  free(locs_error);
377  }
378 
379  if (!error) return bs.data; // freed by caller
380  free(bs.data);
381  }
382  return NULp;
383 }
384 
385 static int pargc;
386 static const char **pargv = NULp;
387 static bool showhelp;
388 static bool outOfRange;
389 
390 static int getInt(const char *param, int val, int min, int max, const char *description) {
391  if (showhelp) {
392  printf(" %s=%i [%i .. ", param, val, min);
393  if (max != INT_MAX) printf("%i", max);
394  printf("] %s\n", description);
395  return 0;
396  }
397  int i;
398  const char *s = NULp;
399 
400  arb_assert(min<=val && val<=max); // wrong default value
401 
402  arb_assert(pargc >= 1); // otherwise s stays 0
403 
404  for (i=1; i<pargc; i++) {
405  s = pargv[i];
406  if (*s == '-') s++;
407  if (!strncasecmp(s, param, strlen(param))) break;
408  }
409  if (i==pargc) return val;
410  s += strlen(param);
411  if (*s == '=') {
412  s++;
413  val = atoi(s);
414 
415  if (val<min || val>max) {
416  outOfRange = true;
417  printf("Parameter '%s=%s' is outside allowed range:\n", param, s);
418  showhelp = true;
419  getInt(param, val, min, max, description);
420  showhelp = false;
421  val = 0;
422  }
423  }
424 
425  pargc--; // remove parameter
426  for (; i<pargc; i++) {
427  pargv[i] = pargv[i+1];
428  }
429 
430  return val;
431 }
432 
433 static const char *getString(const char *param, const char *val, const char *description) {
434  if (showhelp) {
435  if (!val) val = "";
436  printf(" %s=%s %s\n", param, val, description);
437  return NULp;
438  }
439  int i;
440  const char *s = NULp;
441 
442  arb_assert(pargc >= 1); // otherwise s stays 0
443 
444  for (i=1; i<pargc; i++) {
445  s = pargv[i];
446  if (*s == '-') s++;
447  if (!strncasecmp(s, param, strlen(param))) break;
448  }
449  if (i==pargc) return val;
450  s += strlen(param);
451  if (*s != '=') return val;
452  s++;
453  pargc--; // remove parameter
454  for (; i<pargc; i++) {
455  pargv[i] = pargv[i+1];
456  }
457  return s;
458 }
459 
460 static bool parseCommandLine(int argc, const char * const * const argv) {
461  pargc = argc;
462 
463  // copy argv (since parser will remove matched arguments)
464  free(pargv);
465  ARB_alloc(pargv, pargc);
466  for (int i=0; i<pargc; i++) pargv[i] = argv[i];
467 
468  showhelp = (pargc <= 1);
469  outOfRange = false;
470 
471 #ifdef UNIT_TESTS // UT_DIFF
472  const int minServerID = TEST_GENESERVER_ID;
473 #else // !UNIT_TESTS
474  const int minServerID = 0;
475 #endif
476 
477  P.SERVERID = getInt("serverid", 0, minServerID, 100, "Server Id, look into $ARBHOME/lib/arb_tcp.dat");
478 #ifdef UNIT_TESTS // UT_DIFF
479  if (P.SERVERID<0) { arb_assert(P.SERVERID == TEST_SERVER_ID || P.SERVERID == TEST_GENESERVER_ID); }
480 #endif
481 
482  P.DESIGNCLIPOUTPUT = getInt("designmaxhits", 100, 10, 10000, "Maximum Number of Probe Design Suggestions");
483  P.DESIGNNAMES = getString("designnames", "", "List of short names separated by '#'");
484 
485  P.sequence = NULp;
486  while ((P.DESIGNSEQUENCE = getString("designsequence", NULp, "Additional Sequences, will be added to the target group"))) {
487  apd_sequence *s = new apd_sequence;
488  s->next = P.sequence;
489  P.sequence = s;
490  s->sequence = P.DESIGNSEQUENCE;
491  P.DESIGNSEQUENCE = NULp;
492  }
493  P.DESIGNPROBELEN = getInt("designprobelength", 18, 2, 100, "(min.) length of probe");
494  P.DESIGNMAXPROBELEN = getInt("designmaxprobelength", -1, -1, 100, "max. length of probe (if specified)");
495  P.MINTEMP = getInt("designmintemp", 0, 0, 400, "Minimum melting temperature of probe");
496  P.MAXTEMP = getInt("designmaxtemp", 400, 0, 400, "Maximum melting temperature of probe");
497  P.MINGC = getInt("designmingc", 30, 0, 100, "Minimum gc content");
498  P.MAXGC = getInt("designmaxgc", 80, 0, 100, "Maximum gc content");
499  P.MAXBOND = getInt("designmaxbond", 0, 0, 10, "Not implemented");
500  P.MINPOS = getInt("designminpos", -1, -1, INT_MAX, "Minimum ecoli position (-1=none)");
501  P.MAXPOS = getInt("designmaxpos", -1, -1, INT_MAX, "Maximum ecoli position (-1=none)");
502  P.MISHIT = getInt("designmishit", 0, 0, 10000, "Number of allowed hits outside the selected group");
503  P.MINTARGETS = getInt("designmintargets", 50, 0, 100, "Minimum percentage of hits within the selected species");
504 
505  P.SEQUENCE = getString("matchsequence", "agtagtagt", "The sequence to search for");
506 
507  P.MISMATCHES = getInt("matchmismatches", 0, 0, INT_MAX, "Maximum Number of allowed mismatches");
508  P.ALSO_REVCOMPL = getInt("matchAlsoRevcomp", 0, 0, 1, "Also match reverse-complemented probe");
509  P.WEIGHTED = getInt("matchweighted", 0, 0, 1, "Use weighted mismatches");
510  P.ACCEPTN = getInt("matchacceptN", 1, 0, INT_MAX, "Amount of N-matches not counted as mismatch");
511  P.LIMITN = getInt("matchlimitN", 4, 0, INT_MAX, "Limit for N-matches. If reached N-matches are mismatches");
512  P.MAXRESULT = getInt("matchmaxresults", 1000000, 0, INT_MAX, "Max. number of matches reported (0=unlimited)");
513 
514  P.ITERATE = getInt("iterate", 0, 0, 20, "Iterate over probes of given length");
515  P.ITERATE_AMOUNT = getInt("iterate_amount", 100, 1, INT_MAX, "Number of results per answer");
516  P.ITERATE_READABLE = getInt("iterate_readable", 1, 0, 1, "readable results");
517 
518  P.ITERATE_TU = getString("iterate_tu", "T", "use T or U in readable result");
519  P.ITERATE_SEPARATOR = getString("iterate_separator", ";", "Number of results per answer");
520 
521  P.DUMP = getString("dump", "", "dump ptserver index to file (may be huge!)");
522 
523  if (pargc>1) {
524  printf("Unknown (or duplicate) parameter %s\n", pargv[1]);
525  return false;
526  }
527  if (outOfRange) {
528  puts("Not all parameters were inside allowed range\n");
529  return false;
530  }
531 
532  return !showhelp;
533 }
534 
535 // --------------------------------------------------------------------------------
536 
537 #ifdef UNIT_TESTS
538 #ifndef TEST_UNIT_H
539 #include <test_unit.h>
540 #endif
541 
542 void TEST_BASIC_parseCommandLine() {
543  {
544  const char *args[] = { NULp, "serverid=0"};
546 
547  // test default values here
551  TEST_EXPECT_EQUAL(P.MAXRESULT, 1000000);
552  }
553 
554  {
555  const char *args[] = {NULp, "serverid=4", "matchmismatches=2"};
559  TEST_EXPECT_EQUAL(args[1], "serverid=4"); // check array args was not modified
560  }
561 
562  {
563  const char *args[] = { NULp, "matchacceptN=0", "matchlimitN=5"};
567  }
568 
569  {
570  const char *args[] = { NULp, "matchmaxresults=100"};
573  }
574 }
575 
576 #endif // UNIT_TESTS
577 
578 // --------------------------------------------------------------------------------
579 
580 
581 static char *execute(ARB_ERROR& error) {
582  char *answer;
583  if (*P.DESIGNNAMES || P.sequence) {
584  answer = AP_probe_design_event(error);
585  }
586  else if (P.ITERATE>0) {
587  answer = AP_probe_iterate_event(error);
588  }
589  else if (P.DUMP[0]) {
590  answer = AP_dump_index_event(error);
591  }
592  else {
593  answer = AP_probe_match_event(error);
594  }
595  pd_gl.locs.clear();
596  return answer;
597 }
598 
599 int ARB_main(int argc, char *argv[]) {
600  bool ok = parseCommandLine(argc, argv);
601  if (ok) {
603  char *answer = execute(error);
604 
605  arb_assert(contradicted(answer, error));
606 
607  if (!answer) {
608  fprintf(stderr,
609  "arb_probe: Failed to process your request\n"
610  " Reason: %s",
611  error.deliver());
612  ok = false;
613  }
614  else {
615  fputs(answer, stdout);
616  free(answer);
617  error.expect_no_error();
618  }
619  }
620  return ok ? EXIT_SUCCESS : EXIT_FAILURE;
621 }
622 
623 // --------------------------------------------------------------------------------
624 
625 #ifdef UNIT_TESTS
626 #ifndef TEST_UNIT_H
627 #include <test_unit.h>
628 #endif
629 
630 static int test_setup(bool use_gene_ptserver) {
631  static bool setup[2] = { false, false };
632  if (!setup[use_gene_ptserver]) {
633  TEST_SETUP_GLOBAL_ENVIRONMENT(use_gene_ptserver ? "ptserver_gene" : "ptserver"); // first call will recreate the test pt-server
634  setup[use_gene_ptserver] = true;
635  }
636  return use_gene_ptserver ? TEST_GENESERVER_ID : TEST_SERVER_ID;
637 }
638 
639 // ----------------------------------
640 // test probe design / match
641 
642 #define TEST_RUN_ARB_PROBE__INT(fake_argc,fake_argv) \
643  int serverid = test_setup(use_gene_ptserver); \
644  TEST_EXPECT_EQUAL(true, parseCommandLine(fake_argc, fake_argv)); \
645  TEST_EXPECT((serverid == TEST_SERVER_ID)||(serverid == TEST_GENESERVER_ID)); \
646  P.SERVERID = serverid; \
647  ARB_ERROR error; \
648  char *answer = execute(error)
649 
650 #define TEST_ARB_PROBE__REPORTS_ERROR(fake_argc,fake_argv,expected_error) \
651  TEST_RUN_ARB_PROBE__INT(fake_argc,fake_argv); \
652  free(answer); \
653  TEST_EXPECT_ERROR_CONTAINS(error.deliver(), expected_error)
654 
655 #define TEST_ARB_PROBE__REPORTS_ERROR__BROKEN(fake_argc,fake_argv,expected_error) \
656  TEST_RUN_ARB_PROBE__INT(fake_argc,fake_argv); \
657  free(answer); \
658  TEST_EXPECT_ANY_ERROR(error.preserve()); \
659  TEST_EXPECT_ERROR_CONTAINS__BROKEN(error.deliver(), expected_error)
660 
661 
662 #define TEST_RUN_ARB_PROBE(fake_argc,fake_argv) \
663  TEST_RUN_ARB_PROBE__INT(fake_argc,fake_argv); \
664  TEST_EXPECT_NO_ERROR(error.deliver())
665 
666 #define TEST_ARB_PROBE(fake_argc,fake_argv,expected) do { \
667  TEST_RUN_ARB_PROBE(fake_argc,fake_argv); \
668  TEST_EXPECT_EQUAL(answer, expected); \
669  free(answer); \
670  } while(0)
671 
672 #define TEST_ARB_PROBE__BROKEN(fake_argc,fake_argv,expected) do { \
673  TEST_RUN_ARB_PROBE(fake_argc,fake_argv); \
674  TEST_EXPECT_EQUAL__BROKEN(answer, expected); \
675  free(answer); \
676  } while(0)
677 
678 #define TEST_ARB_PROBE_FILT(fake_argc,fake_argv,filter,expected) do { \
679  TEST_RUN_ARB_PROBE(fake_argc,fake_argv); \
680  char *filtered = filter(answer); \
681  TEST_EXPECT_EQUAL(filtered, expected); \
682  free(filtered); \
683  free(answer); \
684  } while(0)
685 
686 typedef const char *CCP;
687 
688 void TEST_SLOW_match_geneprobe() {
689  // test here runs versus database ../UNIT_TESTER/run/TEST_gpt_src.arb
690 
691  bool use_gene_ptserver = true;
692  {
693  const char *arguments[] = {
694  "prgnamefake",
695  "matchsequence=NNUCNN",
696  "matchacceptN=4",
697  "matchlimitN=5",
698  };
699  CCP expectd = " organism genename------- mis N_mis wmis pos gpos rev 'NNUCNN'\1"
700  "genome2\1" " genome2 gene3 0 4 2.6 2 1 0 .........-UU==GG-UUGAUC.\1"
701  "genome2\1" " genome2 joined1 0 4 2.6 2 1 0 .........-UU==GG-UUGAUCCUG\1"
702  "genome2\1" " genome2 gene1 0 4 2.6 2 2 0 ........A-UU==GG-U.\1"
703  "genome2\1" " genome2 intergene_19_65 0 4 2.7 31 12 0 GGUUACUGC-AU==GG-UGUUCGCCU\1"
704  "genome1\1" " genome1 intergene_17_65 0 4 2.7 31 14 0 GGUUACUGC-UA==GG-UGUUCGCCU\1"
705  "genome2\1" " genome2 intergene_19_65 0 4 2.7 38 19 0 GCAUUCGGU-GU==GC-CUAAGCACU\1"
706  "genome1\1" " genome1 intergene_17_65 0 4 2.7 38 21 0 GCUAUCGGU-GU==GC-CUAAGCCAU\1"
707  "genome2\1" " genome2 gene3 0 4 2.9 10 9 0 .UUUCGGUU-GA==..-\1"
708  "genome2\1" " genome2 intergene_19_65 0 4 3.1 56 37 0 AGCACUGCG-AG==AU-AUGUA.\1"
709  "genome1\1" " genome1 intergene_17_65 0 4 3.1 56 39 0 AGCCAUGCG-AG==AU-AUGUA.\1"
710  "genome1\1" " genome1 gene2 0 4 3.1 10 2 0 ........U-GA==CU-GC.\1"
711  "genome2\1" " genome2 gene2 0 4 3.1 10 4 0 ......GUU-GA==CU-GCCA.\1"
712  "genome1\1" " genome1 joined1 0 4 3.1 10 7 0 ...CUGGUU-GA==CU-GC.\1"
713  "genome2\1" " genome2 joined1 0 4 3.1 10 9 0 .UUUCGGUU-GA==CU-GCCA.\1";
714 
715  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd);
716  }
717 
718  {
719  const char *arguments[] = {
720  "prgnamefake",
721  "matchsequence=NGGUUN",
722  "matchacceptN=2",
723  "matchlimitN=3",
724  };
725  CCP expectd = " organism genename------- mis N_mis wmis pos gpos rev 'NGGUUN'\1"
726  "genome1\1" " genome1 gene3 0 2 1.3 5 2 0 ........C-U====G-A.\1"
727  "genome1\1" " genome1 joined1 0 2 1.3 5 2 0 ........C-U====G-AUCCUGC.\1"
728  "genome2\1" " genome2 gene3 0 2 1.4 5 4 0 ......UUU-C====G-AUC.\1"
729  "genome2\1" " genome2 joined1 0 2 1.4 5 4 0 ......UUU-C====G-AUCCUGCCA\1"
730  "genome2\1" " genome2 intergene_19_65 0 2 1.8 21 2 0 ........G-A====A-CUGCAUUCG\1"
731  "genome1\1" " genome1 intergene_17_65 0 2 1.8 21 4 0 ......CAG-A====A-CUGCUAUCG\1";
732 
733  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd);
734  }
735 
736  {
737  const char *arguments[] = {
738  "prgnamefake",
739  "matchsequence=UGAUCCU", // exists in data
740  };
741  CCP expectd = " organism genename mis N_mis wmis pos gpos rev 'UGAUCCU'\1"
742  "genome1\1" " genome1 gene2 0 0 0.0 9 1 0 .........-=======-GC.\1"
743  "genome2\1" " genome2 gene2 0 0 0.0 9 3 0 .......GU-=======-GCCA.\1"
744  "genome1\1" " genome1 joined1 0 0 0.0 9 6 0 ....CUGGU-=======-GC.\1"
745  "genome2\1" " genome2 joined1 0 0 0.0 9 8 0 ..UUUCGGU-=======-GCCA.\1";
746 
747  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd); // [fixed: now reports hits in 'joined1' (of both genomes)]
748  }
749  {
750  const char *arguments[] = {
751  "prgnamefake",
752  "matchsequence=GAUCCU",
753  };
754  CCP expectd = " organism genename mis N_mis wmis pos gpos rev 'GAUCCU'\1"
755  "genome1\1" " genome1 gene2 0 0 0.0 10 2 0 ........U-======-GC.\1"
756  "genome2\1" " genome2 gene2 0 0 0.0 10 4 0 ......GUU-======-GCCA.\1"
757  "genome1\1" " genome1 joined1 0 0 0.0 10 7 0 ...CUGGUU-======-GC.\1"
758  "genome2\1" " genome2 joined1 0 0 0.0 10 9 0 .UUUCGGUU-======-GCCA.\1";
759 
760  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd); // [fixed: now reports as much hits as previous test; expected cause probe is part of above probe]
761  }
762  {
763  const char *arguments[] = {
764  "prgnamefake",
765  "matchsequence=UUUCGG", // exists only in genome2
766  };
767  CCP expectd = " organism genename mis N_mis wmis pos gpos rev 'UUUCGG'\1"
768  "genome2\1" " genome2 gene3 0 0 0.0 2 1 0 .........-======-UUGAUC.\1"
769  "genome2\1" " genome2 joined1 0 0 0.0 2 1 0 .........-======-UUGAUCCUG\1"
770  "genome2\1" " genome2 gene1 0 0 0.0 2 2 0 ........A-======-U.\1";
771 
772  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd); // [fixed: now reports hit in genome2/gene1]
773  }
774  {
775  const char *arguments[] = {
776  "prgnamefake",
777  "matchsequence=AUCCUG",
778  };
779  CCP expectd = " organism genename mis N_mis wmis pos gpos rev 'AUCCUG'\1"
780  "genome1\1" " genome1 gene2 0 0 0.0 11 3 0 .......UG-======-C.\1"
781  "genome2\1" " genome2 gene2 0 0 0.0 11 5 0 .....GUUG-======-CCA.\1"
782  "genome1\1" " genome1 joined1 0 0 0.0 11 8 0 ..CUGGUUG-======-C.\1"
783  "genome2\1" " genome2 joined1 0 0 0.0 11 10 0 UUUCGGUUG-======-CCA.\1";
784 
785  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd); // [fixed: now reports hits in 'gene2' and 'joined1' of both genomes]
786  }
787  {
788  const char *arguments[] = {
789  "prgnamefake",
790  "matchsequence=UUGAUCCUGC",
791  };
792  CCP expectd = " organism genename mis N_mis wmis pos gpos rev 'UUGAUCCUGC'\1"
793  "genome2\1" " genome2 gene2 0 0 0.0 8 2 0 ........G-==========-CA.\1"
794  "genome1\1" " genome1 joined1 0 0 0.0 8 5 0 .....CUGG-==========-.\1"
795  "genome2\1" " genome2 joined1 0 0 0.0 8 7 0 ...UUUCGG-==========-CA.\1";
796 
797  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd); // [fixed: now reports hit in 'genome2/joined1']
798  }
799 }
800 
801 __ATTR__REDUCED_OPTIMIZE void TEST_SLOW_match_probe() {
802  // test here runs versus database ../UNIT_TESTER/run/TEST_pt_src.arb
803 
804  bool use_gene_ptserver = false;
805  {
806  const char *arguments[] = {
807  "prgnamefake",
808  "matchsequence=UAUCGGAGAGUUUGA",
809  };
810  CCP expected = " name---- fullname mis N_mis wmis pos ecoli rev 'UAUCGGAGAGUUUGA'\1"
811  "BcSSSS00\1" " BcSSSS00 0 0 0.0 3 2 0 .......UU-===============-UCAAGUCGA\1";
812 
813  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
814  }
815 
816  // ----------------------------------------------------------------------------
817  // match with old(=default) N-mismatch-behavior (accepting 1 N-match)
818 
819  {
820  const char *arguments[] = {
821  "prgnamefake",
822  "matchsequence=CANCUCCUUUC", // contains 1 N
823  NULp // matchmismatches
824  };
825 
826  CCP expectd0 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUUC'\1"
827  "BcSSSS00\1" " BcSSSS00 0 1 0.9 176 162 0 CGGCUGGAU-==C========-U.\1"; // only N-mismatch accepted
828 
829  CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUUC'\1"
830  "BcSSSS00\1" " BcSSSS00 0 1 0.9 176 162 0 CGGCUGGAU-==C========-U.\1"
831  "ClfPerfr\1" " ClfPerfr 1 1 2.0 176 162 0 AGAUUAAUA-=CC========-U.\1"
832  "PbcAcet2\1" " PbcAcet2 1 2 1.6 176 162 0 CGGCUGGAU-==C=======N-N.\1"
833  "PbrPropi\1" " PbrPropi 1 2 1.6 176 162 0 CGGCUGGAU-==C=======N-N.\1"
834  "Stsssola\1" " Stsssola 1 2 1.6 176 162 0 CGGCUGGAU-==C=======.-\1"
835  "DcdNodos\1" " DcdNodos 1 2 1.6 176 162 0 CGGUUGGAU-==C=======.-\1"
836  "VbrFurni\1" " VbrFurni 1 2 1.6 176 162 0 GCGCUGGAU-==C=======.-\1"
837  "VblVulni\1" " VblVulni 1 2 1.6 176 162 0 GCGCUGGAU-==C=======.-\1"
838  "VbhChole\1" " VbhChole 1 2 1.6 176 162 0 GCGCUGGAU-==C=======.-\1";
839 
840  CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUUC'\1"
841  "BcSSSS00\1" " BcSSSS00 0 1 0.9 176 162 0 CGGCUGGAU-==C========-U.\1"
842  "ClfPerfr\1" " ClfPerfr 1 1 2.0 176 162 0 AGAUUAAUA-=CC========-U.\1"
843  "PbcAcet2\1" " PbcAcet2 1 2 1.6 176 162 0 CGGCUGGAU-==C=======N-N.\1"
844  "PbrPropi\1" " PbrPropi 1 2 1.6 176 162 0 CGGCUGGAU-==C=======N-N.\1"
845  "Stsssola\1" " Stsssola 1 2 1.6 176 162 0 CGGCUGGAU-==C=======.-\1"
846  "DcdNodos\1" " DcdNodos 1 2 1.6 176 162 0 CGGUUGGAU-==C=======.-\1"
847  "VbrFurni\1" " VbrFurni 1 2 1.6 176 162 0 GCGCUGGAU-==C=======.-\1"
848  "VblVulni\1" " VblVulni 1 2 1.6 176 162 0 GCGCUGGAU-==C=======.-\1"
849  "VbhChole\1" " VbhChole 1 2 1.6 176 162 0 GCGCUGGAU-==C=======.-\1"
850  "AclPleur\1" " AclPleur 2 2 2.7 176 162 0 CGGUUGGAU-==C======A.-\1"
851  "PtVVVulg\1" " PtVVVulg 2 2 2.7 176 162 0 CGGUUGGAU-==C======A.-\1"
852  "DlcTolu2\1" " DlcTolu2 2 3 2.3 176 162 0 CGGCUGGAU-==C======NN-N.\1"
853  "FrhhPhil\1" " FrhhPhil 2 3 2.3 176 162 0 CGGCUGGAU-==C======..-\1"
854  "HllHalod\1" " HllHalod 2 3 2.3 176 162 0 CGGCUGGAU-==C======..-\1"
855  "CPPParap\1" " CPPParap 2 3 2.3 177 163 0 CGGNUGGAU-==C======..-\1";
856 
857  CCP expectd3 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUUC'\1"
858  "BcSSSS00\1" " BcSSSS00 0 1 0.9 176 162 0 CGGCUGGAU-==C========-U.\1"
859  "ClfPerfr\1" " ClfPerfr 1 1 2.0 176 162 0 AGAUUAAUA-=CC========-U.\1"
860  "PbcAcet2\1" " PbcAcet2 1 2 1.6 176 162 0 CGGCUGGAU-==C=======N-N.\1"
861  "PbrPropi\1" " PbrPropi 1 2 1.6 176 162 0 CGGCUGGAU-==C=======N-N.\1"
862  "Stsssola\1" " Stsssola 1 2 1.6 176 162 0 CGGCUGGAU-==C=======.-\1"
863  "DcdNodos\1" " DcdNodos 1 2 1.6 176 162 0 CGGUUGGAU-==C=======.-\1"
864  "VbrFurni\1" " VbrFurni 1 2 1.6 176 162 0 GCGCUGGAU-==C=======.-\1"
865  "VblVulni\1" " VblVulni 1 2 1.6 176 162 0 GCGCUGGAU-==C=======.-\1"
866  "VbhChole\1" " VbhChole 1 2 1.6 176 162 0 GCGCUGGAU-==C=======.-\1"
867  "AclPleur\1" " AclPleur 2 2 2.7 176 162 0 CGGUUGGAU-==C======A.-\1"
868  "PtVVVulg\1" " PtVVVulg 2 2 2.7 176 162 0 CGGUUGGAU-==C======A.-\1"
869  "DlcTolu2\1" " DlcTolu2 2 3 2.3 176 162 0 CGGCUGGAU-==C======NN-N.\1"
870  "FrhhPhil\1" " FrhhPhil 2 3 2.3 176 162 0 CGGCUGGAU-==C======..-\1"
871  "HllHalod\1" " HllHalod 2 3 2.3 176 162 0 CGGCUGGAU-==C======..-\1"
872  "CPPParap\1" " CPPParap 2 3 2.3 177 163 0 CGGNUGGAU-==C======..-\1"
873  "VblVulni\1" " VblVulni 3 1 3.6 49 44 0 AGCACAGAG-a=A==uG====-UCGGGUGGC\1";
874 
875  arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0);
876  arguments[2] = "matchmismatches=1"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd1);
877  arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2);
878  arguments[2] = "matchmismatches=3"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd3);
879  }
880 
881  {
882  const char *arguments[] = {
883  "prgnamefake",
884  "matchsequence=UCACCUCCUUUC", // contains no N
885  NULp // matchmismatches
886  };
887 
888  CCP expectd0 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUC'\1"
889  "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-============-U.\1"
890  "PbcAcet2\1" " PbcAcet2 0 1 0.7 175 161 0 GCGGCUGGA-===========N-N.\1"
891  "PbrPropi\1" " PbrPropi 0 1 0.7 175 161 0 GCGGCUGGA-===========N-N.\1"
892  "Stsssola\1" " Stsssola 0 1 0.7 175 161 0 GCGGCUGGA-===========.-\1"
893  "DcdNodos\1" " DcdNodos 0 1 0.7 175 161 0 GCGGUUGGA-===========.-\1"
894  "VbrFurni\1" " VbrFurni 0 1 0.7 175 161 0 GGCGCUGGA-===========.-\1"
895  "VblVulni\1" " VblVulni 0 1 0.7 175 161 0 GGCGCUGGA-===========.-\1"
896  "VbhChole\1" " VbhChole 0 1 0.7 175 161 0 GGCGCUGGA-===========.-\1";
897 
898  CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUC'\1"
899  "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-============-U.\1"
900  "PbcAcet2\1" " PbcAcet2 0 1 0.7 175 161 0 GCGGCUGGA-===========N-N.\1"
901  "PbrPropi\1" " PbrPropi 0 1 0.7 175 161 0 GCGGCUGGA-===========N-N.\1"
902  "Stsssola\1" " Stsssola 0 1 0.7 175 161 0 GCGGCUGGA-===========.-\1"
903  "DcdNodos\1" " DcdNodos 0 1 0.7 175 161 0 GCGGUUGGA-===========.-\1"
904  "VbrFurni\1" " VbrFurni 0 1 0.7 175 161 0 GGCGCUGGA-===========.-\1"
905  "VblVulni\1" " VblVulni 0 1 0.7 175 161 0 GGCGCUGGA-===========.-\1"
906  "VbhChole\1" " VbhChole 0 1 0.7 175 161 0 GGCGCUGGA-===========.-\1"
907  "AclPleur\1" " AclPleur 1 1 1.8 175 161 0 GCGGUUGGA-==========A.-\1"
908  "PtVVVulg\1" " PtVVVulg 1 1 1.8 175 161 0 GCGGUUGGA-==========A.-\1"
909  "DlcTolu2\1" " DlcTolu2 1 2 1.4 175 161 0 GCGGCUGGA-==========NN-N.\1"
910  "FrhhPhil\1" " FrhhPhil 1 2 1.4 175 161 0 GCGGCUGGA-==========..-\1"
911  "HllHalod\1" " HllHalod 1 2 1.4 175 161 0 GCGGCUGGA-==========..-\1"
912  "CPPParap\1" " CPPParap 1 2 1.4 176 162 0 GCGGNUGGA-==========..-\1";
913 
914  CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUC'\1"
915  "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-============-U.\1"
916  "PbcAcet2\1" " PbcAcet2 0 1 0.7 175 161 0 GCGGCUGGA-===========N-N.\1"
917  "PbrPropi\1" " PbrPropi 0 1 0.7 175 161 0 GCGGCUGGA-===========N-N.\1"
918  "Stsssola\1" " Stsssola 0 1 0.7 175 161 0 GCGGCUGGA-===========.-\1"
919  "DcdNodos\1" " DcdNodos 0 1 0.7 175 161 0 GCGGUUGGA-===========.-\1"
920  "VbrFurni\1" " VbrFurni 0 1 0.7 175 161 0 GGCGCUGGA-===========.-\1"
921  "VblVulni\1" " VblVulni 0 1 0.7 175 161 0 GGCGCUGGA-===========.-\1"
922  "VbhChole\1" " VbhChole 0 1 0.7 175 161 0 GGCGCUGGA-===========.-\1"
923  "AclPleur\1" " AclPleur 1 1 1.8 175 161 0 GCGGUUGGA-==========A.-\1"
924  "PtVVVulg\1" " PtVVVulg 1 1 1.8 175 161 0 GCGGUUGGA-==========A.-\1"
925  "DlcTolu2\1" " DlcTolu2 1 2 1.4 175 161 0 GCGGCUGGA-==========NN-N.\1"
926  "FrhhPhil\1" " FrhhPhil 1 2 1.4 175 161 0 GCGGCUGGA-==========..-\1"
927  "HllHalod\1" " HllHalod 1 2 1.4 175 161 0 GCGGCUGGA-==========..-\1"
928  "CPPParap\1" " CPPParap 1 2 1.4 176 162 0 GCGGNUGGA-==========..-\1"
929  "ClfPerfr\1" " ClfPerfr 2 0 2.2 175 161 0 AAGAUUAAU-A=C=========-U.\1"
930  "LgtLytic\1" " LgtLytic 2 3 2.1 175 161 0 GCGGCUGGA-=========N..-\1"
931  "PslFlave\1" " PslFlave 2 3 2.1 175 161 0 GCGGCUGGA-=========...-\1";
932 
933  arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0);
934  arguments[2] = "matchmismatches=1"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd1);
935  arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2);
936  }
937 
938  {
939  const char *arguments[] = {
940  "prgnamefake",
941  "matchsequence=UCACCUCCUUUC", // contains no N
942  NULp, // matchmismatches
943  "matchweighted=1", // use weighted mismatches
944  };
945 
946  CCP expectd0 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUC'\1"
947  "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-============-U.\1"
948  "PbcAcet2\1" " PbcAcet2 0 1 0.2 175 161 0 GCGGCUGGA-===========N-N.\1"
949  "PbrPropi\1" " PbrPropi 0 1 0.2 175 161 0 GCGGCUGGA-===========N-N.\1"
950  "Stsssola\1" " Stsssola 0 1 0.2 175 161 0 GCGGCUGGA-===========.-\1"
951  "DcdNodos\1" " DcdNodos 0 1 0.2 175 161 0 GCGGUUGGA-===========.-\1"
952  "VbrFurni\1" " VbrFurni 0 1 0.2 175 161 0 GGCGCUGGA-===========.-\1"
953  "VblVulni\1" " VblVulni 0 1 0.2 175 161 0 GGCGCUGGA-===========.-\1"
954  "VbhChole\1" " VbhChole 0 1 0.2 175 161 0 GGCGCUGGA-===========.-\1";
955 
956  CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUC'\1"
957  "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-============-U.\1"
958  "PbcAcet2\1" " PbcAcet2 0 1 0.2 175 161 0 GCGGCUGGA-===========N-N.\1"
959  "PbrPropi\1" " PbrPropi 0 1 0.2 175 161 0 GCGGCUGGA-===========N-N.\1"
960  "Stsssola\1" " Stsssola 0 1 0.2 175 161 0 GCGGCUGGA-===========.-\1"
961  "DcdNodos\1" " DcdNodos 0 1 0.2 175 161 0 GCGGUUGGA-===========.-\1"
962  "VbrFurni\1" " VbrFurni 0 1 0.2 175 161 0 GGCGCUGGA-===========.-\1"
963  "VblVulni\1" " VblVulni 0 1 0.2 175 161 0 GGCGCUGGA-===========.-\1"
964  "VbhChole\1" " VbhChole 0 1 0.2 175 161 0 GGCGCUGGA-===========.-\1"
965  "DlcTolu2\1" " DlcTolu2 1 2 0.6 175 161 0 GCGGCUGGA-==========NN-N.\1"
966  "FrhhPhil\1" " FrhhPhil 1 2 0.6 175 161 0 GCGGCUGGA-==========..-\1"
967  "HllHalod\1" " HllHalod 1 2 0.6 175 161 0 GCGGCUGGA-==========..-\1"
968  "CPPParap\1" " CPPParap 1 2 0.6 176 162 0 GCGGNUGGA-==========..-\1"
969  "AclPleur\1" " AclPleur 1 1 0.9 175 161 0 GCGGUUGGA-==========A.-\1"
970  "PtVVVulg\1" " PtVVVulg 1 1 0.9 175 161 0 GCGGUUGGA-==========A.-\1"
971  "LgtLytic\1" " LgtLytic 2 3 1.3 175 161 0 GCGGCUGGA-=========N..-\1"
972  "PslFlave\1" " PslFlave 2 3 1.3 175 161 0 GCGGCUGGA-=========...-\1"
973  "ClfPerfr\1" " ClfPerfr 2 0 1.3 175 161 0 AAGAUUAAU-A=C=========-U.\1";
974 
975  CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUC'\1"
976  "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-============-U.\1"
977  "PbcAcet2\1" " PbcAcet2 0 1 0.2 175 161 0 GCGGCUGGA-===========N-N.\1"
978  "PbrPropi\1" " PbrPropi 0 1 0.2 175 161 0 GCGGCUGGA-===========N-N.\1"
979  "Stsssola\1" " Stsssola 0 1 0.2 175 161 0 GCGGCUGGA-===========.-\1"
980  "DcdNodos\1" " DcdNodos 0 1 0.2 175 161 0 GCGGUUGGA-===========.-\1"
981  "VbrFurni\1" " VbrFurni 0 1 0.2 175 161 0 GGCGCUGGA-===========.-\1"
982  "VblVulni\1" " VblVulni 0 1 0.2 175 161 0 GGCGCUGGA-===========.-\1"
983  "VbhChole\1" " VbhChole 0 1 0.2 175 161 0 GGCGCUGGA-===========.-\1"
984  "DlcTolu2\1" " DlcTolu2 1 2 0.6 175 161 0 GCGGCUGGA-==========NN-N.\1"
985  "FrhhPhil\1" " FrhhPhil 1 2 0.6 175 161 0 GCGGCUGGA-==========..-\1"
986  "HllHalod\1" " HllHalod 1 2 0.6 175 161 0 GCGGCUGGA-==========..-\1"
987  "CPPParap\1" " CPPParap 1 2 0.6 176 162 0 GCGGNUGGA-==========..-\1"
988  "AclPleur\1" " AclPleur 1 1 0.9 175 161 0 GCGGUUGGA-==========A.-\1"
989  "PtVVVulg\1" " PtVVVulg 1 1 0.9 175 161 0 GCGGUUGGA-==========A.-\1"
990  "LgtLytic\1" " LgtLytic 2 3 1.3 175 161 0 GCGGCUGGA-=========N..-\1"
991  "PslFlave\1" " PslFlave 2 3 1.3 175 161 0 GCGGCUGGA-=========...-\1"
992  "ClfPerfr\1" " ClfPerfr 2 0 1.3 175 161 0 AAGAUUAAU-A=C=========-U.\1"
993  "AclPleur\1" " AclPleur 5 0 2.4 50 45 0 GAAGGGAGC-=ug=u=u====G-CCGACGAGU\1"
994  "PtVVVulg\1" " PtVVVulg 5 0 2.4 50 45 0 GGAGAAAGC-=ug=u=u===g=-UGACGAGCG\1";
995 
996  arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0);
997  arguments[2] = "matchmismatches=1"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd1);
998  arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2);
999  }
1000 
1001  // ----------------------------------------------
1002  // do not accept any N-matches as match
1003 
1004  {
1005  const char *arguments[] = {
1006  "prgnamefake",
1007  "matchsequence=CANCUCCUUUC", // contains 1 N
1008  NULp, // matchmismatches
1009  "matchacceptN=0",
1010  };
1011 
1012  CCP expectd0 = ""; // nothing matches
1013 
1014  CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUUC'\1"
1015  "BcSSSS00\1" " BcSSSS00 1 1 0.9 176 162 0 CGGCUGGAU-==C========-U.\1";
1016 
1017  CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUUC'\1"
1018  "BcSSSS00\1" " BcSSSS00 1 1 0.9 176 162 0 CGGCUGGAU-==C========-U.\1"
1019  "ClfPerfr\1" " ClfPerfr 2 1 2.0 176 162 0 AGAUUAAUA-=CC========-U.\1"
1020  "PbcAcet2\1" " PbcAcet2 2 2 1.6 176 162 0 CGGCUGGAU-==C=======N-N.\1"
1021  "PbrPropi\1" " PbrPropi 2 2 1.6 176 162 0 CGGCUGGAU-==C=======N-N.\1"
1022  "Stsssola\1" " Stsssola 2 2 1.6 176 162 0 CGGCUGGAU-==C=======.-\1"
1023  "DcdNodos\1" " DcdNodos 2 2 1.6 176 162 0 CGGUUGGAU-==C=======.-\1"
1024  "VbrFurni\1" " VbrFurni 2 2 1.6 176 162 0 GCGCUGGAU-==C=======.-\1"
1025  "VblVulni\1" " VblVulni 2 2 1.6 176 162 0 GCGCUGGAU-==C=======.-\1"
1026  "VbhChole\1" " VbhChole 2 2 1.6 176 162 0 GCGCUGGAU-==C=======.-\1";
1027 
1028  arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0);
1029  arguments[2] = "matchmismatches=1"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd1);
1030  arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2);
1031  }
1032  {
1033  const char *arguments[] = {
1034  "prgnamefake",
1035  "matchsequence=UUUCUUU", // contains no N
1036  NULp, // matchmismatches
1037  "matchacceptN=0",
1038  };
1039 
1040  CCP expectd0 = " name---- fullname mis N_mis wmis pos ecoli rev 'UUUCUUU'\1"
1041  "AclPleur\1" " AclPleur 0 0 0.0 54 49 0 GGAGCUUGC-=======-GCCGACGAG\1";
1042 
1043  CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'UUUCUUU'\1"
1044  "AclPleur\1" " AclPleur 0 0 0.0 54 49 0 GGAGCUUGC-=======-GCCGACGAG\1"
1045  "AclPleur\1" " AclPleur 1 0 0.6 50 45 0 GAAGGGAGC-==g====-CUUUGCCGA\1"
1046  "PtVVVulg\1" " PtVVVulg 1 0 0.6 50 45 0 GGAGAAAGC-==g====-CUUGCUGAC\1"
1047  "PtVVVulg\1" " PtVVVulg 1 0 0.6 54 49 0 AAAGCUUGC-======g-CUGACGAGC\1"
1048  "ClfPerfr\1" " ClfPerfr 1 0 1.1 49 44 0 GCGAUGAAG-====C==-CGGGAAACG\1";
1049 
1050  CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'UUUCUUU'\1"
1051  "AclPleur\1" " AclPleur 0 0 0.0 54 49 0 GGAGCUUGC-=======-GCCGACGAG\1"
1052  "AclPleur\1" " AclPleur 1 0 0.6 50 45 0 GAAGGGAGC-==g====-CUUUGCCGA\1"
1053  "PtVVVulg\1" " PtVVVulg 1 0 0.6 50 45 0 GGAGAAAGC-==g====-CUUGCUGAC\1"
1054  "PtVVVulg\1" " PtVVVulg 1 0 0.6 54 49 0 AAAGCUUGC-======g-CUGACGAGC\1"
1055  "ClfPerfr\1" " ClfPerfr 1 0 1.1 49 44 0 GCGAUGAAG-====C==-CGGGAAACG\1"
1056  "DlcTolu2\1" " DlcTolu2 2 0 1.2 47 42 0 AGAAAGGGA-==g===g-CAAUCCUGA\1"
1057  "ClnCorin\1" " ClnCorin 2 0 1.7 48 43 0 AGCGAUGAA-g===C==-CGGGAAUGG\1"
1058  "CPPParap\1" " CPPParap 2 0 1.7 48 43 0 AGCGAUGAA-g===C==-CGGGAACGG\1"
1059  "HllHalod\1" " HllHalod 2 0 1.7 49 44 0 GAUGGAAGC-==g===C-CAGGCGUCG\1"
1060  "DcdNodos\1" " DcdNodos 2 0 1.7 50 45 0 UUAUGUAGC-==g==A=-GUAACCUAG\1"
1061  "VbhChole\1" " VbhChole 2 0 1.7 55 50 0 GAGGAACUU-g===C==-GGGUGGCGA\1"
1062  "VbrFurni\1" " VbrFurni 2 0 1.7 62 57 0 UUCGGGGGA-===G==g-GGCGGCGAG\1"
1063  "VblVulni\1" " VblVulni 2 0 1.7 62 57 0 AGAAACUUG-=====Cg-GGUGGCGAG\1"
1064  "VbhChole\1" " VbhChole 2 0 1.7 62 57 0 AGGAACUUG-==C===g-GGUGGCGAG\1"
1065  "ClnCorin\1" " ClnCorin 2 0 2.2 49 44 0 GCGAUGAAG-==C===C-GGGAAUGGA\1"
1066  "CltBotul\1" " CltBotul 2 0 2.2 49 44 0 GCGAUGAAG-C=====C-GGAAGUGGA\1"
1067  "CPPParap\1" " CPPParap 2 0 2.2 49 44 0 GCGAUGAAG-==C===C-GGGAACGGA\1"
1068  "ClfPerfr\1" " ClfPerfr 2 0 2.2 50 45 0 CGAUGAAGU-==C===C-GGGAAACGG\1"
1069  "VblVulni\1" " VblVulni 2 0 2.2 52 47 0 ACAGAGAAA-C==G===-CUCGGGUGG\1"
1070  "BcSSSS00\1" " BcSSSS00 2 0 2.2 179 165 0 CUGGAUCAC-C=C====-CU.\1"
1071  "ClfPerfr\1" " ClfPerfr 2 0 2.2 179 165 0 UUAAUACCC-C=C====-CU.\1"
1072  "PbcAcet2\1" " PbcAcet2 2 0 2.2 179 165 0 CUGGAUCAC-C=C====-NN.\1"
1073  "PbrPropi\1" " PbrPropi 2 0 2.2 179 165 0 CUGGAUCAC-C=C====-NN.\1"
1074  "Stsssola\1" " Stsssola 2 0 2.2 179 165 0 CUGGAUCAC-C=C====-.\1"
1075  "DcdNodos\1" " DcdNodos 2 0 2.2 179 165 0 UUGGAUCAC-C=C====-.\1"
1076  "VbrFurni\1" " VbrFurni 2 0 2.2 179 165 0 CUGGAUCAC-C=C====-.\1"
1077  "VblVulni\1" " VblVulni 2 0 2.2 179 165 0 CUGGAUCAC-C=C====-.\1"
1078  "VbhChole\1" " VbhChole 2 0 2.2 179 165 0 CUGGAUCAC-C=C====-.\1"
1079  "BcSSSS00\1" " BcSSSS00 2 2 1.4 183 169 0 AUCACCUCC-=====..-\1"
1080  "ClfPerfr\1" " ClfPerfr 2 2 1.4 183 169 0 UACCCCUCC-=====..-\1";
1081 
1082  arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0);
1083  arguments[2] = "matchmismatches=1"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd1);
1084  arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2);
1085  }
1086  {
1087  const char *arguments[] = {
1088  "prgnamefake",
1089  "matchsequence=UCACCUCCUUUC", // contains no N
1090  NULp, // matchmismatches
1091  "matchacceptN=0",
1092  };
1093 
1094  CCP expectd0 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUC'\1"
1095  "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-============-U.\1" "";
1096 
1097  CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUC'\1"
1098  "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-============-U.\1"
1099  "PbcAcet2\1" " PbcAcet2 1 1 0.7 175 161 0 GCGGCUGGA-===========N-N.\1"
1100  "PbrPropi\1" " PbrPropi 1 1 0.7 175 161 0 GCGGCUGGA-===========N-N.\1"
1101  "Stsssola\1" " Stsssola 1 1 0.7 175 161 0 GCGGCUGGA-===========.-\1"
1102  "DcdNodos\1" " DcdNodos 1 1 0.7 175 161 0 GCGGUUGGA-===========.-\1"
1103  "VbrFurni\1" " VbrFurni 1 1 0.7 175 161 0 GGCGCUGGA-===========.-\1"
1104  "VblVulni\1" " VblVulni 1 1 0.7 175 161 0 GGCGCUGGA-===========.-\1"
1105  "VbhChole\1" " VbhChole 1 1 0.7 175 161 0 GGCGCUGGA-===========.-\1";
1106 
1107  CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUC'\1"
1108  "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-============-U.\1"
1109  "PbcAcet2\1" " PbcAcet2 1 1 0.7 175 161 0 GCGGCUGGA-===========N-N.\1"
1110  "PbrPropi\1" " PbrPropi 1 1 0.7 175 161 0 GCGGCUGGA-===========N-N.\1"
1111  "Stsssola\1" " Stsssola 1 1 0.7 175 161 0 GCGGCUGGA-===========.-\1"
1112  "DcdNodos\1" " DcdNodos 1 1 0.7 175 161 0 GCGGUUGGA-===========.-\1"
1113  "VbrFurni\1" " VbrFurni 1 1 0.7 175 161 0 GGCGCUGGA-===========.-\1"
1114  "VblVulni\1" " VblVulni 1 1 0.7 175 161 0 GGCGCUGGA-===========.-\1"
1115  "VbhChole\1" " VbhChole 1 1 0.7 175 161 0 GGCGCUGGA-===========.-\1"
1116  "ClfPerfr\1" " ClfPerfr 2 0 2.2 175 161 0 AAGAUUAAU-A=C=========-U.\1"
1117  "AclPleur\1" " AclPleur 2 1 1.8 175 161 0 GCGGUUGGA-==========A.-\1"
1118  "PtVVVulg\1" " PtVVVulg 2 1 1.8 175 161 0 GCGGUUGGA-==========A.-\1"
1119  "DlcTolu2\1" " DlcTolu2 2 2 1.4 175 161 0 GCGGCUGGA-==========NN-N.\1"
1120  "FrhhPhil\1" " FrhhPhil 2 2 1.4 175 161 0 GCGGCUGGA-==========..-\1"
1121  "HllHalod\1" " HllHalod 2 2 1.4 175 161 0 GCGGCUGGA-==========..-\1"
1122  "CPPParap\1" " CPPParap 2 2 1.4 176 162 0 GCGGNUGGA-==========..-\1";
1123 
1124  arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0);
1125  arguments[2] = "matchmismatches=1"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd1);
1126  arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2);
1127  }
1128  {
1129  const char *arguments[] = {
1130  "prgnamefake",
1131  "matchsequence=UCACCUCCUUUCU", // contains no N
1132  NULp, // matchmismatches
1133  "matchacceptN=0",
1134  };
1135 
1136  CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUCU'\1"
1137  "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-=============-.\1";
1138 
1139  CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUCU'\1"
1140  "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-=============-.\1"
1141  "ClfPerfr\1" " ClfPerfr 2 0 2.2 175 161 0 AAGAUUAAU-A=C==========-.\1"
1142  "PbcAcet2\1" " PbcAcet2 2 2 1.4 175 161 0 GCGGCUGGA-===========NN-.\1"
1143  "PbrPropi\1" " PbrPropi 2 2 1.4 175 161 0 GCGGCUGGA-===========NN-.\1"
1144  "Stsssola\1" " Stsssola 2 2 1.4 175 161 0 GCGGCUGGA-===========..-\1"
1145  "DcdNodos\1" " DcdNodos 2 2 1.4 175 161 0 GCGGUUGGA-===========..-\1"
1146  "VbrFurni\1" " VbrFurni 2 2 1.4 175 161 0 GGCGCUGGA-===========..-\1"
1147  "VblVulni\1" " VblVulni 2 2 1.4 175 161 0 GGCGCUGGA-===========..-\1"
1148  "VbhChole\1" " VbhChole 2 2 1.4 175 161 0 GGCGCUGGA-===========..-\1";
1149 
1150  CCP expectd3 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUCU'\1"
1151  "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-=============-.\1"
1152  "ClfPerfr\1" " ClfPerfr 2 0 2.2 175 161 0 AAGAUUAAU-A=C==========-.\1"
1153  "PbcAcet2\1" " PbcAcet2 2 2 1.4 175 161 0 GCGGCUGGA-===========NN-.\1"
1154  "PbrPropi\1" " PbrPropi 2 2 1.4 175 161 0 GCGGCUGGA-===========NN-.\1"
1155  "Stsssola\1" " Stsssola 2 2 1.4 175 161 0 GCGGCUGGA-===========..-\1"
1156  "DcdNodos\1" " DcdNodos 2 2 1.4 175 161 0 GCGGUUGGA-===========..-\1"
1157  "VbrFurni\1" " VbrFurni 2 2 1.4 175 161 0 GGCGCUGGA-===========..-\1"
1158  "VblVulni\1" " VblVulni 2 2 1.4 175 161 0 GGCGCUGGA-===========..-\1"
1159  "VbhChole\1" " VbhChole 2 2 1.4 175 161 0 GGCGCUGGA-===========..-\1"
1160  "AclPleur\1" " AclPleur 3 2 2.5 175 161 0 GCGGUUGGA-==========A..-\1"
1161  "PtVVVulg\1" " PtVVVulg 3 2 2.5 175 161 0 GCGGUUGGA-==========A..-\1"
1162  "DlcTolu2\1" " DlcTolu2 3 3 2.1 175 161 0 GCGGCUGGA-==========NNN-.\1"
1163  "FrhhPhil\1" " FrhhPhil 3 3 2.1 175 161 0 GCGGCUGGA-==========...-\1"
1164  "HllHalod\1" " HllHalod 3 3 2.1 175 161 0 GCGGCUGGA-==========...-\1"
1165  "CPPParap\1" " CPPParap 3 3 2.1 176 162 0 GCGGNUGGA-==========...-\1";
1166 
1167  CCP expectd4 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUCU'\1"
1168  "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-=============-.\1"
1169  "ClfPerfr\1" " ClfPerfr 2 0 2.2 175 161 0 AAGAUUAAU-A=C==========-.\1"
1170  "PbcAcet2\1" " PbcAcet2 2 2 1.4 175 161 0 GCGGCUGGA-===========NN-.\1"
1171  "PbrPropi\1" " PbrPropi 2 2 1.4 175 161 0 GCGGCUGGA-===========NN-.\1"
1172  "Stsssola\1" " Stsssola 2 2 1.4 175 161 0 GCGGCUGGA-===========..-\1"
1173  "DcdNodos\1" " DcdNodos 2 2 1.4 175 161 0 GCGGUUGGA-===========..-\1"
1174  "VbrFurni\1" " VbrFurni 2 2 1.4 175 161 0 GGCGCUGGA-===========..-\1"
1175  "VblVulni\1" " VblVulni 2 2 1.4 175 161 0 GGCGCUGGA-===========..-\1"
1176  "VbhChole\1" " VbhChole 2 2 1.4 175 161 0 GGCGCUGGA-===========..-\1"
1177  "AclPleur\1" " AclPleur 3 2 2.5 175 161 0 GCGGUUGGA-==========A..-\1"
1178  "PtVVVulg\1" " PtVVVulg 3 2 2.5 175 161 0 GCGGUUGGA-==========A..-\1"
1179  "DlcTolu2\1" " DlcTolu2 3 3 2.1 175 161 0 GCGGCUGGA-==========NNN-.\1"
1180  "FrhhPhil\1" " FrhhPhil 3 3 2.1 175 161 0 GCGGCUGGA-==========...-\1"
1181  "HllHalod\1" " HllHalod 3 3 2.1 175 161 0 GCGGCUGGA-==========...-\1"
1182  "CPPParap\1" " CPPParap 3 3 2.1 176 162 0 GCGGNUGGA-==========...-\1"
1183  "LgtLytic\1" " LgtLytic 4 4 2.8 175 161 0 GCGGCUGGA-=========N...-\1"
1184  "PslFlave\1" " PslFlave 4 4 2.8 175 161 0 GCGGCUGGA-=========....-\1";
1185 
1186  CCP expectd5 = " name---- fullname mis N_mis wmis pos ecoli rev 'UCACCUCCUUUCU'\1"
1187  "BcSSSS00\1" " BcSSSS00 0 0 0.0 175 161 0 GCGGCUGGA-=============-.\1"
1188  "ClfPerfr\1" " ClfPerfr 2 0 2.2 175 161 0 AAGAUUAAU-A=C==========-.\1"
1189  "PbcAcet2\1" " PbcAcet2 2 2 1.4 175 161 0 GCGGCUGGA-===========NN-.\1"
1190  "PbrPropi\1" " PbrPropi 2 2 1.4 175 161 0 GCGGCUGGA-===========NN-.\1"
1191  "Stsssola\1" " Stsssola 2 2 1.4 175 161 0 GCGGCUGGA-===========..-\1"
1192  "DcdNodos\1" " DcdNodos 2 2 1.4 175 161 0 GCGGUUGGA-===========..-\1"
1193  "VbrFurni\1" " VbrFurni 2 2 1.4 175 161 0 GGCGCUGGA-===========..-\1"
1194  "VblVulni\1" " VblVulni 2 2 1.4 175 161 0 GGCGCUGGA-===========..-\1"
1195  "VbhChole\1" " VbhChole 2 2 1.4 175 161 0 GGCGCUGGA-===========..-\1"
1196  "AclPleur\1" " AclPleur 3 2 2.5 175 161 0 GCGGUUGGA-==========A..-\1"
1197  "PtVVVulg\1" " PtVVVulg 3 2 2.5 175 161 0 GCGGUUGGA-==========A..-\1"
1198  "DlcTolu2\1" " DlcTolu2 3 3 2.1 175 161 0 GCGGCUGGA-==========NNN-.\1"
1199  "FrhhPhil\1" " FrhhPhil 3 3 2.1 175 161 0 GCGGCUGGA-==========...-\1"
1200  "HllHalod\1" " HllHalod 3 3 2.1 175 161 0 GCGGCUGGA-==========...-\1"
1201  "CPPParap\1" " CPPParap 3 3 2.1 176 162 0 GCGGNUGGA-==========...-\1"
1202  "LgtLytic\1" " LgtLytic 4 4 2.8 175 161 0 GCGGCUGGA-=========N...-\1"
1203  "PslFlave\1" " PslFlave 4 4 2.8 175 161 0 GCGGCUGGA-=========....-\1"
1204  "PtVVVulg\1" " PtVVVulg 5 0 2.6 50 45 0 GGAGAAAGC-=ug=u=u===g==-GACGAGCGG\1"
1205  "AclPleur\1" " AclPleur 5 0 3.5 46 41 0 ACGGGAAGG-gag=u=G======-UUGCCGACG\1"
1206  "PtVVVulg\1" " PtVVVulg 5 0 4.0 45 40 0 ...AGGAGA-Aag=u=G======-UGCUGACGA\1"
1207  "VblVulni\1" " VblVulni 5 0 4.3 48 43 0 CAGCACAGA-ga=a==uG=====-CGGGUGGCG\1";
1208 
1209  arguments[2] = "matchmismatches=1"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd1);
1210  arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2);
1211  arguments[2] = "matchmismatches=3"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd3);
1212  arguments[2] = "matchmismatches=4"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd4);
1213  arguments[2] = "matchmismatches=5"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd5);
1214  }
1215 
1216  // ----------------------------------
1217  // accept several N-matches
1218 
1219  {
1220  const char *arguments[] = {
1221  "prgnamefake",
1222  "matchsequence=CANCUCCUUNC", // contains 2 N
1223  NULp, // matchmismatches
1224  "matchacceptN=2",
1225  "matchlimitN=4",
1226  };
1227 
1228  CCP expectd0 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUNC'\1"
1229  "BcSSSS00\1" " BcSSSS00 0 2 1.7 176 162 0 CGGCUGGAU-==C======U=-U.\1";
1230 
1231  CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUNC'\1"
1232  "BcSSSS00\1" " BcSSSS00 0 2 1.7 176 162 0 CGGCUGGAU-==C======U=-U.\1"
1233  "ClfPerfr\1" " ClfPerfr 1 2 2.8 176 162 0 AGAUUAAUA-=CC======U=-U.\1"
1234  "DlcTolu2\1" " DlcTolu2 1 3 2.4 176 162 0 CGGCUGGAU-==C=======N-N.\1"
1235  "FrhhPhil\1" " FrhhPhil 1 3 2.4 176 162 0 CGGCUGGAU-==C======..-\1"
1236  "HllHalod\1" " HllHalod 1 3 2.4 176 162 0 CGGCUGGAU-==C======..-\1"
1237  "CPPParap\1" " CPPParap 1 3 2.4 177 163 0 CGGNUGGAU-==C======..-\1"
1238  "PbcAcet2\1" " PbcAcet2 1 3 2.4 176 162 0 CGGCUGGAU-==C======UN-N.\1"
1239  "PbrPropi\1" " PbrPropi 1 3 2.4 176 162 0 CGGCUGGAU-==C======UN-N.\1"
1240  "Stsssola\1" " Stsssola 1 3 2.4 176 162 0 CGGCUGGAU-==C======U.-\1"
1241  "DcdNodos\1" " DcdNodos 1 3 2.4 176 162 0 CGGUUGGAU-==C======U.-\1"
1242  "VbrFurni\1" " VbrFurni 1 3 2.4 176 162 0 GCGCUGGAU-==C======U.-\1"
1243  "VblVulni\1" " VblVulni 1 3 2.4 176 162 0 GCGCUGGAU-==C======U.-\1"
1244  "VbhChole\1" " VbhChole 1 3 2.4 176 162 0 GCGCUGGAU-==C======U.-\1"
1245  "AclPleur\1" " AclPleur 1 3 2.5 176 162 0 CGGUUGGAU-==C======A.-\1"
1246  "PtVVVulg\1" " PtVVVulg 1 3 2.5 176 162 0 CGGUUGGAU-==C======A.-\1";
1247 
1248  CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCUCCUUNC'\1"
1249  "BcSSSS00\1" " BcSSSS00 0 2 1.7 176 162 0 CGGCUGGAU-==C======U=-U.\1"
1250  "ClfPerfr\1" " ClfPerfr 1 2 2.8 176 162 0 AGAUUAAUA-=CC======U=-U.\1"
1251  "DlcTolu2\1" " DlcTolu2 1 3 2.4 176 162 0 CGGCUGGAU-==C=======N-N.\1"
1252  "FrhhPhil\1" " FrhhPhil 1 3 2.4 176 162 0 CGGCUGGAU-==C======..-\1"
1253  "HllHalod\1" " HllHalod 1 3 2.4 176 162 0 CGGCUGGAU-==C======..-\1"
1254  "CPPParap\1" " CPPParap 1 3 2.4 177 163 0 CGGNUGGAU-==C======..-\1"
1255  "PbcAcet2\1" " PbcAcet2 1 3 2.4 176 162 0 CGGCUGGAU-==C======UN-N.\1"
1256  "PbrPropi\1" " PbrPropi 1 3 2.4 176 162 0 CGGCUGGAU-==C======UN-N.\1"
1257  "Stsssola\1" " Stsssola 1 3 2.4 176 162 0 CGGCUGGAU-==C======U.-\1"
1258  "DcdNodos\1" " DcdNodos 1 3 2.4 176 162 0 CGGUUGGAU-==C======U.-\1"
1259  "VbrFurni\1" " VbrFurni 1 3 2.4 176 162 0 GCGCUGGAU-==C======U.-\1"
1260  "VblVulni\1" " VblVulni 1 3 2.4 176 162 0 GCGCUGGAU-==C======U.-\1"
1261  "VbhChole\1" " VbhChole 1 3 2.4 176 162 0 GCGCUGGAU-==C======U.-\1"
1262  "AclPleur\1" " AclPleur 1 3 2.5 176 162 0 CGGUUGGAU-==C======A.-\1"
1263  "PtVVVulg\1" " PtVVVulg 1 3 2.5 176 162 0 CGGUUGGAU-==C======A.-\1";
1264 
1265  arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0);
1266  arguments[2] = "matchmismatches=1"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd1);
1267  arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2);
1268  }
1269 
1270  {
1271  const char *arguments[] = {
1272  "prgnamefake",
1273  "matchsequence=GAGCGGUCAG", // similar to a region where dots occur in seqdata
1274  NULp, // matchmismatches
1275  "matchacceptN=0",
1276  "matchlimitN=4",
1277  };
1278 
1279  CCP expectd0 = "";
1280 
1281  CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'GAGCGGUCAG'\1"
1282  "BcSSSS00\1" " BcSSSS00 1 0 1.1 25 21 0 GAUCAAGUC-======A===-AUGGGAGCU\1";
1283 
1284  CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'GAGCGGUCAG'\1"
1285  "BcSSSS00\1" " BcSSSS00 1 0 1.1 25 21 0 GAUCAAGUC-======A===-AUGGGAGCU\1"
1286  "Bl0LLL00\1" " Bl0LLL00 2 0 2.2 25 21 0 GAUCAAGUC-======A=C=-ACGGGAGCU\1";
1287 
1288  // this probe-match is also tested with 'arb_probe_match'. see arb_test.cxx@TEST_arb_probe_match
1289  CCP expectd3 = " name---- fullname mis N_mis wmis pos ecoli rev 'GAGCGGUCAG'\1"
1290  "BcSSSS00\1" " BcSSSS00 1 0 1.1 25 21 0 GAUCAAGUC-======A===-AUGGGAGCU\1"
1291  "Bl0LLL00\1" " Bl0LLL00 2 0 2.2 25 21 0 GAUCAAGUC-======A=C=-ACGGGAGCU\1"
1292  "VbrFurni\1" " VbrFurni 3 0 2.4 68 60 0 GGAUUUGUU-=g====CG==-CGGCGGACG\1"
1293  "FrhhPhil\1" " FrhhPhil 3 0 2.8 82 70 0 ACGAGUGGC-=gA===C===-UUGGAAACG\1"
1294  "ClfPerfr\1" " ClfPerfr 3 0 3.2 86 74 0 CGGCGGGAC-=g==CU====-AACCUGCGG\1"
1295  "HllHalod\1" " HllHalod 3 0 3.6 25 21 0 GAUCAAGUC-======Aa=C-GAUGGAAGC\1"
1296  "DlcTolu2\1" " DlcTolu2 3 0 3.6 95 83 0 GGACUGCCC-==Aa==A===-CUAAUACCG\1"
1297  "FrhhPhil\1" " FrhhPhil 3 0 4.0 25 21 0 GAUCAAGUC-==A====a=C-AGGUCUUCG\1"
1298  "AclPleur\1" " AclPleur 3 0 4.0 29 24 0 GAUCAAGUC-==A====a=C-GGGAAGGGA\1"
1299  "ClnCorin\1" " ClnCorin 3 0 4.1 25 21 0 GAUCAAGUC-=====A=G=A-GUUCCUUCG\1"
1300  "CltBotul\1" " CltBotul 3 0 4.1 25 21 0 .AUCAAGUC-=====A=G=A-GCUUCUUCG\1"
1301  "CPPParap\1" " CPPParap 3 0 4.1 25 21 0 GAUCAAGUC-=====A=G=A-GUUCCUUCG\1"
1302  "ClfPerfr\1" " ClfPerfr 3 0 4.1 25 21 0 GAUCAAGUC-=====A=G=A-GUUUCCUUC\1"
1303  "DlcTolu2\1" " DlcTolu2 3 0 4.1 157 143 0 GUAGCCGUU-===GAA====-CGGCUGGAU\1"
1304  "PslFlave\1" " PslFlave 3 3 2.4 25 21 0 GAUCAAGUC-=======...-<more>\1"
1305  "PtVVVulg\1" " PtVVVulg 3 3 2.4 29 24 0 GAUCAAGUC-=======...-<more>\1";
1306 
1307  arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0);
1308  arguments[2] = "matchmismatches=1"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd1);
1309  arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2);
1310  arguments[2] = "matchmismatches=3"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd3);
1311  }
1312 
1313  {
1314  const char *arguments[] = {
1315  "prgnamefake",
1316  "matchsequence=GAGCGGUCAGGAG", // as above, but continues behind '...'
1317  NULp, // matchmismatches
1318  "matchweighted=1", // use weighted mismatches
1319  };
1320 
1321  CCP expectd2 = "";
1322  CCP expectd3 = " name---- fullname mis N_mis wmis pos ecoli rev 'GAGCGGUCAGGAG'\1"
1323  "ClnCorin\1" " ClnCorin 6 0 3.4 77 66 0 AUGGAUUAG-Cg====A=g==CC-UUUCGAAAG\1"
1324  "CltBotul\1" " CltBotul 6 0 3.4 77 66 0 GUGGAUUAG-Cg====A=g==CC-UUUCGAAAG\1"
1325  "CPPParap\1" " CPPParap 6 0 3.4 77 66 0 ACGGAUUAG-Cg====A=g==CC-UUCCGAAAG\1"
1326  "BcSSSS00\1" " BcSSSS00 3 0 3.4 25 21 0 GAUCAAGUC-======A===AU=-GGAGCUUGC\1";
1327 
1328  CCP expectd4 = " name---- fullname mis N_mis wmis pos ecoli rev 'GAGCGGUCAGGAG'\1"
1329  "ClnCorin\1" " ClnCorin 6 0 3.4 77 66 0 AUGGAUUAG-Cg====A=g==CC-UUUCGAAAG\1"
1330  "CltBotul\1" " CltBotul 6 0 3.4 77 66 0 GUGGAUUAG-Cg====A=g==CC-UUUCGAAAG\1"
1331  "CPPParap\1" " CPPParap 6 0 3.4 77 66 0 ACGGAUUAG-Cg====A=g==CC-UUCCGAAAG\1"
1332  "BcSSSS00\1" " BcSSSS00 3 0 3.4 25 21 0 GAUCAAGUC-======A===AU=-GGAGCUUGC\1"
1333  "ClfPerfr\1" " ClfPerfr 6 0 3.9 121 108 0 AUCAUAAUG-C====A=ug==gU-GAAGUCGUA\1"
1334  "ClnCorin\1" " ClnCorin 6 0 3.9 122 109 0 CGCAUAAGA-C====A=ug==gU-GAAGUCGUA\1"
1335  "CltBotul\1" " CltBotul 6 0 3.9 122 109 0 CUCAUAAGA-C====A=ug==gU-GAAGUCGUA\1"
1336  "CPPParap\1" " CPPParap 6 0 3.9 122 109 0 GCAUAAGAU-C====A=ug==gU-AAGUCGUAA\1"
1337  "DcdNodos\1" " DcdNodos 6 0 4.2 77 66 0 GUAACCUAG-Ug====A=g=AC=-UAUGGAAAC\1"
1338  "PsAAAA00\1" " PsAAAA00 6 0 4.2 77 66 0 UGGAUUCAG-Cg====A=g=AC=-UCCGGAAAC\1"
1339  "PslFlave\1" " PslFlave 6 0 4.2 77 66 0 CUGAUUCAG-Cg====A=g=AC=-UUUCGAAAG\1"
1340  "FrhhPhil\1" " FrhhPhil 5 0 4.2 149 135 0 UAACAAUGG-U===C==ag===A-CCUGCGGCU\1"
1341  "AclPleur\1" " AclPleur 4 0 4.3 29 24 0 GAUCAAGUC-==A====a=C=g=-AAGGGAGCU\1"
1342  "PbcAcet2\1" " PbcAcet2 6 0 4.3 149 135 0 GUAACAAGG-U===C==ag==gA-ACCUGCGGC\1"
1343  "PbrPropi\1" " PbrPropi 6 0 4.3 149 135 0 GUAACAAGG-U===C==ag==gA-ACCUGCGGC\1"
1344  "Stsssola\1" " Stsssola 6 0 4.3 149 135 0 GUAACAAGG-U===C==ag==gA-ACCUGCGGC\1"
1345  "LgtLytic\1" " LgtLytic 6 0 4.3 149 135 0 GUAACAAGG-U===C==ag==gA-ACCUGCGGC\1"
1346  "PslFlave\1" " PslFlave 6 0 4.3 149 135 0 GUAACAAGG-U===C==ag==gA-ACCUGCGGC\1"
1347  "HllHalod\1" " HllHalod 6 0 4.3 149 135 0 GUAACAAGG-U===C==ag==gA-ACCUGCGGC\1"
1348  "VbrFurni\1" " VbrFurni 5 0 4.4 68 60 0 GGAUUUGUU-=g====CG==Cg=-CGGACGGAC\1"
1349  "AclPleur\1" " AclPleur 6 0 4.4 35 30 0 GUCGAACGG-U=A===ga===gA-GCUUGCUUU\1"
1350  "PslFlave\1" " PslFlave 6 6 4.4 25 21 0 GAUCAAGUC-=======......-<more>\1"
1351  "PtVVVulg\1" " PtVVVulg 6 6 4.4 29 24 0 GAUCAAGUC-=======......-<more>\1"
1352  "VbrFurni\1" " VbrFurni 6 0 4.4 149 135 0 GUAACAAGG-U====C=ag==gA-ACCUGGCGC\1"
1353  "VblVulni\1" " VblVulni 6 0 4.4 149 135 0 GUAACAAGG-U====C=ag==gA-ACCUGGCGC\1"
1354  "VbhChole\1" " VbhChole 6 0 4.4 149 135 0 GUAACAAGG-U====C=ag==gA-ACCUGGCGC\1";
1355 
1356  arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2);
1357  arguments[2] = "matchmismatches=3"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd3);
1358  arguments[2] = "matchmismatches=4"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd4);
1359  }
1360 
1361  // --------------------------
1362  // truncate results
1363 
1364  {
1365  const char *arguments[] = {
1366  "prgnamefake",
1367  "matchsequence=CANCNCNNUNC", // contains 5N
1368  NULp, // matchmismatches
1369  "matchacceptN=5",
1370  "matchlimitN=7",
1371  "matchmaxresults=5",
1372  };
1373 
1374  CCP expectd0 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCNCNNUNC'\1"
1375  "BcSSSS00\1" " BcSSSS00 0 5 4.2 176 162 0 CGGCUGGAU-==C=U=CU=U=-U.\1";
1376 
1377  // many hits are truncated here:
1378  CCP expectd1 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCNCNNUNC'\1"
1379  "DlcTolu2\1" " DlcTolu2 1 6 4.9 176 162 0 CGGCUGGAU-==C=U=CU==N-N.\1"
1380  "FrhhPhil\1" " FrhhPhil 1 6 4.9 176 162 0 CGGCUGGAU-==C=U=CU=..-\1"
1381  "HllHalod\1" " HllHalod 1 6 4.9 176 162 0 CGGCUGGAU-==C=U=CU=..-\1"
1382  "CPPParap\1" " CPPParap 1 6 4.9 177 163 0 CGGNUGGAU-==C=U=CU=..-\1"
1383  "AclPleur\1" " AclPleur 1 6 5.0 176 162 0 CGGUUGGAU-==C=U=CU=A.-\1";
1384 
1385  // many hits are truncated here:
1386  CCP expectd2 = " name---- fullname mis N_mis wmis pos ecoli rev 'CANCNCNNUNC'\1"
1387  "HllHalod\1" " HllHalod 2 5 5.1 45 40 0 AAACGAUGG-a=G=UuGC=U=-CAGGCGUCG\1"
1388  "VblVulni\1" " VblVulni 2 5 5.4 49 44 0 AGCACAGAG-a=A=UuGU=U=-UCGGGUGGC\1"
1389  "VbrFurni\1" " VbrFurni 2 5 5.7 40 35 0 CGGCAGCGA-==A=AuUGAA=-CUUCGGGGG\1"
1390  "LgtLytic\1" " LgtLytic 2 5 6.2 101 89 0 GGGGAAACU-==AGCuAA=A=-CGCAUAAUC\1"
1391  "ClfPerfr\1" " ClfPerfr 2 5 6.5 172 158 0 AGGAAGAUU-a=UaC=CC=C=-UUUCU.\1";
1392 
1393  arguments[2] = "matchmismatches=0"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0);
1394  arguments[2] = "matchmismatches=1"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd1);
1395  arguments[2] = "matchmismatches=2"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd2);
1396  }
1397 
1398  // -------------------------------------------------------------
1399  // tests related to http://bugs.arb-home.de/ticket/410
1400  {
1401  const char *arguments[] = {
1402  "prgnamefake",
1403  "matchsequence=ACGGACUCCGGGAAACCGGGGCUAAUACC", // length=29
1404  NULp, // matchmismatches
1405  "matchacceptN=5",
1406  "matchlimitN=7",
1407  "matchmaxresults=10",
1408  };
1409 
1410  CCP expectd0 = " name---- fullname mis N_mis wmis pos ecoli rev 'ACGGACUCCGGGAAACCGGGGCUAAUACC'\1"
1411  "BcSSSS00\1" " BcSSSS00 0 0 0.0 84 72 0 UAGCGGCGG-=============================-GGAUGGUGA\1"
1412  "Bl0LLL00\1" " Bl0LLL00 0 0 0.0 84 72 0 CAGCGGCGG-=============================-GGAUGCUGA\1"
1413  "AclPleur\1" " AclPleur 4 0 4.6 84 72 0 GAGUGGCGG-=======a========u=UA=========-GCGUAAUCA\1"
1414  "PtVVVulg\1" " PtVVVulg 4 0 5.1 84 72 0 GAGCGGCGG-=======a=U======G=U==========-GCAUGACCA\1"
1415  "DsssDesu\1" " DsssDesu 5 0 5.3 84 72 0 GAGUGGCGC-========u=C====Gu==A=========-GGAUACAGA\1"
1416  "PsAAAA00\1" " PsAAAA00 5 0 5.3 84 72 0 CAGCGGCGG-======gu=C======G==C=========-GCAUACGCA\1";
1417 
1418  arguments[2] = "matchmismatches=5"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0);
1419  }
1420  {
1421  const char *arguments[] = {
1422  "prgnamefake",
1423  "matchsequence=ACGGACUCCGGGAAACCGGGGCUAAUACCGGAUGGUGA", // length=38
1424  NULp, // matchmismatches
1425  "matchacceptN=5",
1426  "matchlimitN=7",
1427  "matchmaxresults=100",
1428  };
1429 
1430  CCP expectd0 = " name---- fullname mis N_mis wmis pos ecoli rev 'ACGGACUCCGGGAAACCGGGGCUAAUACCGGAUGGUGA'\1"
1431  "BcSSSS00\1" " BcSSSS00 0 0 0.0 84 72 0 UAGCGGCGG-======================================-UGAUUGGGG\1"
1432  "Bl0LLL00\1" " Bl0LLL00 1 0 1.5 84 72 0 CAGCGGCGG-==================================C===-UGAUUGGGG\1"
1433  "DsssDesu\1" " DsssDesu 8 0 9.4 84 72 0 GAGUGGCGC-========u=C====Gu==A=============ACA==-G.\1"
1434  "PtVVVulg\1" " PtVVVulg 8 0 10.7 84 72 0 GAGCGGCGG-=======a=U======G=U===========C===ACC=-UGACUGGGG\1"
1435  "AclPleur\1" " AclPleur 9 0 10.8 84 72 0 GAGUGGCGG-=======a========u=UA==========Cg=AA=C=-UGACUGGGG\1"
1436  "PsAAAA00\1" " PsAAAA00 10 0 11.9 84 72 0 CAGCGGCGG-======gu=C======G==C==========C==ACgC=-UGGUAACAA\1"
1437  "LgtLytic\1" " LgtLytic 10 0 12.8 84 72 0 GAGNGGCGA-=======uG=======uCAA==========C==AA=C=-UGACUGGGG\1"
1438  "VbrFurni\1" " VbrFurni 10 0 12.8 84 72 0 GAGCGGCGG-======CauU======GAU===========C===A=C=-UGACUGGGG\1"
1439  "VblVulni\1" " VblVulni 10 0 12.8 84 72 0 GAGCGGCGG-======CauU======GAU===========C===A=C=-UGACUGGGG\1"
1440  "Stsssola\1" " Stsssola 10 0 12.9 84 72 0 AAGUGGCGC-======gG=U======G=UC=============AACA=-UGAUUGGGG\1"
1441  "DlcTolu2\1" " DlcTolu2 10 0 13.4 84 72 0 GAGUGGCGC-=======G=CC====GGACA==============AA==-UAAUUGGGG\1"
1442  "PbcAcet2\1" " PbcAcet2 11 0 12.2 84 72 0 AAGUGGCGC-======A=uUC====GG==U=============AAg=g-UAACUGGGG\1"
1443  "HllHalod\1" " HllHalod 11 0 13.0 84 72 0 GAGCGGCGG-======CuG=======uCA===========C==ACgC=-UGACUGGGG\1"
1444  "PbrPropi\1" " PbrPropi 12 0 13.6 84 72 0 UAGUGGCGC-======A=uUC====Ga==U=========U===AAg=g-UGACUGGGG\1"
1445  "DcdNodos\1" " DcdNodos 12 0 14.4 84 72 0 UAGUGGCGG-======guaU======GUAC==========C==AAg==-UGACUGGGG\1"
1446  "VbhChole\1" " VbhChole 12 0 15.4 84 72 0 GAGCGGCGG-======CauU======GAU===========C==AACC=-UGACUGGGG\1";
1447 
1448  arguments[2] = "matchmismatches=12"; TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expectd0);
1449  }
1450 
1451 
1452  // test expected errors
1453  {
1454  const char *arguments[] = {
1455  "prgnamefake",
1456  "matchsequence=ACGGACUCCGGGAAACCGGGGCUAAUACCGGAUGGUGA", // length = 38
1457  "matchmismatches=20",
1458  };
1459 
1460  TEST_ARB_PROBE__REPORTS_ERROR(ARRAY_ELEMS(arguments), arguments, "Max. 19 mismatches are allowed for probes of length 38");
1461  }
1462 }
1463 
1464 static char *extract_locations(const char *probe_design_result) {
1465  const char *Target = strstr(probe_design_result, "\nTarget");
1466  if (Target) {
1467  const char *designed = strchr(Target+7, '\n');
1468  if (designed) {
1469  ++designed;
1470 
1471  GBS_strstruct result(300);
1472  RegExpr reg_designed("^[A-Z]+"
1473  "[[:space:]]+[0-9]+"
1474  "[[:space:]]+([A-Z][=+-])" // subexpr #1 (loc+-=)
1475  "[[:space:]]*([0-9]+)", // subexpr #2 (abs or locrel)
1476  true);
1477 
1478 
1479  while (designed) {
1480  const char *eol = strchr(designed, '\n');
1481  const RegMatch *match = reg_designed.match(designed); if (!match) break;
1482 
1483  match = reg_designed.subexpr_match(1); if (!match) break;
1484  std::string loc = match->extract(designed);
1485 
1486  match = reg_designed.subexpr_match(2); if (!match) break;
1487  std::string pos = match->extract(designed);
1488 
1489  result.cat(loc.c_str());
1490  result.cat(pos.c_str());
1491 
1492  designed = eol ? eol+1 : NULp;
1493  }
1494  arb_assert(implicated(designed, !reg_designed.has_failed())); // assert RegExpr compiled
1495 
1496  return result.release();
1497  }
1498  }
1499  return ARB_strdup("can't extract");
1500 }
1501 
1502 inline const char *next_line(const char *this_line) {
1503  const char *lf = strchr(this_line, '\n');
1504  return (lf && lf[1] && strchr("ACGTU", lf[1])) ? lf+1 : NULp;
1505 }
1506 inline int count_hits(const char *design_result) {
1507  const char *target = strstr(design_result, "\nTarget");
1508  if (target) {
1509  const char *hit = next_line(target+1);
1510  int hits = 0;
1511 
1512  while (hit) {
1513  ++hits;
1514  hit = next_line(hit);
1515  }
1516  return hits;
1517  }
1518  return -1;
1519 }
1520 
1521 void TEST_SLOW_design_probe() {
1522  // test here runs versus database ../UNIT_TESTER/run/TEST_pt_src.arb
1523 
1524  bool use_gene_ptserver = false;
1525  {
1526  int hits_len_18;
1527  {
1528  const char *arguments[] = {
1529  "prgnamefake",
1530  "designnames=ClnCorin#CltBotul#CPPParap#ClfPerfr",
1531  "designmintargets=100",
1532  };
1533  const char *expected =
1534  "Probe design parameters:\n"
1535  "Length of probe 18\n"
1536  "Temperature [ 0.0 -400.0]\n"
1537  "GC-content [30.0 - 80.0]\n"
1538  "E.Coli position [any]\n"
1539  "Max. nongroup hits 0\n"
1540  "Min. group hits 100% (max. rejected coverage: 75%)\n"
1541  "Target le apos ecol qual grps G+C temp Probe sequence | Decrease T by n*.3C -> probe matches n non group species\n"
1542  "CGAAAGGAAGAUUAAUAC 18 A=94 82 77 4 33.3 48.0 GUAUUAAUCUUCCUUUCG | - - - - - - - - - - - - - - - - - - - -\n"
1543  "GAAAGGAAGAUUAAUACC 18 A+ 1 83 77 4 33.3 48.0 GGUAUUAAUCUUCCUUUC | - - - - - - - - - - - - - - - - - - - -\n"
1544  "UCAAGUCGAGCGAUGAAG 18 B=18 17 61 4 50.0 54.0 CUUCAUCGCUCGACUUGA | - - - - - - - - - - - - - - - 2 2 2 2 2\n"
1545  "AUCAAGUCGAGCGAUGAA 18 B- 1 16 45 4 44.4 52.0 UUCAUCGCUCGACUUGAU | - - - - - - - - - - - 2 2 2 2 2 2 2 2 2\n";
1546 
1547  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
1548  hits_len_18 = count_hits(expected);
1549  TEST_EXPECT_EQUAL(hits_len_18, 4);
1550 
1551  // test extraction of positions:
1552  {
1553  char *positions = extract_locations(expected);
1554  TEST_EXPECT_EQUAL(positions, "A=94A+1B=18B-1");
1555  free(positions);
1556  }
1557  }
1558  // same as above with probelength 17
1559  int hits_len_17;
1560  {
1561  const char *arguments[] = {
1562  "prgnamefake",
1563  "designnames=ClnCorin#CltBotul#CPPParap#ClfPerfr",
1564  "designmintargets=100",
1565  "designprobelength=17",
1566  };
1567  const char *expected =
1568  "Probe design parameters:\n"
1569  "Length of probe 17\n"
1570  "Temperature [ 0.0 -400.0]\n"
1571  "GC-content [30.0 - 80.0]\n"
1572  "E.Coli position [any]\n"
1573  "Max. nongroup hits 0\n"
1574  "Min. group hits 100% (max. rejected coverage: 75%)\n"
1575  "Target le apos ecol qual grps G+C temp Probe sequence | Decrease T by n*.3C -> probe matches n non group species\n"
1576  "CAAGUCGAGCGAUGAAG 17 A=19 18 65 4 52.9 52.0 CUUCAUCGCUCGACUUG | - - - - - - - - - - - - - - - - 2 2 2 2\n"
1577  "UCAAGUCGAGCGAUGAA 17 A- 1 17 49 4 47.1 50.0 UUCAUCGCUCGACUUGA | - - - - - - - - - - - - 2 2 2 2 2 2 2 2\n"
1578  "AUCAAGUCGAGCGAUGA 17 A- 2 16 33 4 47.1 50.0 UCAUCGCUCGACUUGAU | - - - - - - - - 2 2 2 2 2 2 2 2 2 2 2 4\n";
1579 
1580  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
1581  hits_len_17 = count_hits(expected);
1582  TEST_EXPECT_EQUAL(hits_len_17, 3);
1583  }
1584  // same as above with probelength 16
1585  int hits_len_16;
1586  {
1587  const char *arguments[] = {
1588  "prgnamefake",
1589  "designnames=ClnCorin#CltBotul#CPPParap#ClfPerfr",
1590  "designmintargets=100",
1591  "designprobelength=16",
1592  };
1593  const char *expected =
1594  "Probe design parameters:\n"
1595  "Length of probe 16\n"
1596  "Temperature [ 0.0 -400.0]\n"
1597  "GC-content [30.0 - 80.0]\n"
1598  "E.Coli position [any]\n"
1599  "Max. nongroup hits 0\n"
1600  "Min. group hits 100% (max. rejected coverage: 75%)\n"
1601  "Target le apos ecol qual grps G+C temp Probe sequence | Decrease T by n*.3C -> probe matches n non group species\n"
1602  "CGAAAGGAAGAUUAAU 16 A=94 82 77 4 31.2 42.0 AUUAAUCUUCCUUUCG | - - - - - - - - - - - - - - - - - - - -\n"
1603  "AAGGAAGAUUAAUACC 16 A+ 3 85 77 4 31.2 42.0 GGUAUUAAUCUUCCUU | - - - - - - - - - - - - - - - - - - - -\n"
1604  "AAGUCGAGCGAUGAAG 16 B=20 19 69 4 50.0 48.0 CUUCAUCGCUCGACUU | - - - - - - - - - - - - - - - - - 2 2 2\n"
1605  "CAAGUCGAGCGAUGAA 16 B- 1 18 49 4 50.0 48.0 UUCAUCGCUCGACUUG | - - - - - - - - - - - - 2 2 2 2 2 2 2 2\n"
1606  "UCAAGUCGAGCGAUGA 16 B- 2 17 37 4 50.0 48.0 UCAUCGCUCGACUUGA | - - - - - - - - - 2 2 2 2 2 2 2 2 2 2 2\n"
1607  "AUCAAGUCGAGCGAUG 16 B- 3 16 21 4 50.0 48.0 CAUCGCUCGACUUGAU | - - - - - 2 2 2 2 2 2 2 2 2 2 2 2 9 9 9\n";
1608 
1609  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
1610  hits_len_16 = count_hits(expected);
1611  TEST_EXPECT_EQUAL(hits_len_16, 6);
1612  }
1613  // combine the 3 preceeding designs
1614  int combined_hits;
1615  {
1616  const char *arguments[] = {
1617  "prgnamefake",
1618  "designnames=ClnCorin#CltBotul#CPPParap#ClfPerfr",
1619  "designmintargets=100",
1620  "designprobelength=16",
1621  "designmaxprobelength=18",
1622  };
1623  const char *expected =
1624  "Probe design parameters:\n"
1625  "Length of probe 16-18\n"
1626  "Temperature [ 0.0 -400.0]\n"
1627  "GC-content [30.0 - 80.0]\n"
1628  "E.Coli position [any]\n"
1629  "Max. nongroup hits 0\n"
1630  "Min. group hits 100% (max. rejected coverage: 75%)\n"
1631  "Target le apos ecol qual grps G+C temp Probe sequence | Decrease T by n*.3C -> probe matches n non group species\n"
1632  "CGAAAGGAAGAUUAAU 16 A=94 82 77 4 31.2 42.0 AUUAAUCUUCCUUUCG | - - - - - - - - - - - - - - - - - - - -\n"
1633  "CGAAAGGAAGAUUAAUAC 18 A+ 0 82 77 4 33.3 48.0 GUAUUAAUCUUCCUUUCG | - - - - - - - - - - - - - - - - - - - -\n"
1634  "GAAAGGAAGAUUAAUACC 18 A+ 1 83 77 4 33.3 48.0 GGUAUUAAUCUUCCUUUC | - - - - - - - - - - - - - - - - - - - -\n"
1635  "AAGGAAGAUUAAUACC 16 A+ 3 85 77 4 31.2 42.0 GGUAUUAAUCUUCCUU | - - - - - - - - - - - - - - - - - - - -\n"
1636  "AAGUCGAGCGAUGAAG 16 B=20 19 69 4 50.0 48.0 CUUCAUCGCUCGACUU | - - - - - - - - - - - - - - - - - 2 2 2\n"
1637  "CAAGUCGAGCGAUGAAG 17 B- 1 18 65 4 52.9 52.0 CUUCAUCGCUCGACUUG | - - - - - - - - - - - - - - - - 2 2 2 2\n"
1638  "UCAAGUCGAGCGAUGAAG 18 B- 2 17 61 4 50.0 54.0 CUUCAUCGCUCGACUUGA | - - - - - - - - - - - - - - - 2 2 2 2 2\n"
1639  "UCAAGUCGAGCGAUGAA 17 B- 2 17 49 4 47.1 50.0 UUCAUCGCUCGACUUGA | - - - - - - - - - - - - 2 2 2 2 2 2 2 2\n"
1640  "CAAGUCGAGCGAUGAA 16 B- 1 18 49 4 50.0 48.0 UUCAUCGCUCGACUUG | - - - - - - - - - - - - 2 2 2 2 2 2 2 2\n"
1641  "AUCAAGUCGAGCGAUGAA 18 B- 3 16 45 4 44.4 52.0 UUCAUCGCUCGACUUGAU | - - - - - - - - - - - 2 2 2 2 2 2 2 2 2\n"
1642  "UCAAGUCGAGCGAUGA 16 B- 2 17 37 4 50.0 48.0 UCAUCGCUCGACUUGA | - - - - - - - - - 2 2 2 2 2 2 2 2 2 2 2\n"
1643  "AUCAAGUCGAGCGAUGA 17 B- 3 16 33 4 47.1 50.0 UCAUCGCUCGACUUGAU | - - - - - - - - 2 2 2 2 2 2 2 2 2 2 2 4\n"
1644  "AUCAAGUCGAGCGAUG 16 B- 3 16 21 4 50.0 48.0 CAUCGCUCGACUUGAU | - - - - - 2 2 2 2 2 2 2 2 2 2 2 2 9 9 9\n";
1645 
1646  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
1647  combined_hits = count_hits(expected);
1648  }
1649 
1650  // check that combined design reports all probes reported by single designs:
1651  TEST_EXPECT_EQUAL(combined_hits, hits_len_16+hits_len_17+hits_len_18);
1652  }
1653  // test vs bug (fails with [8988] .. [9175])
1654  {
1655  const char *arguments[] = {
1656  "prgnamefake",
1657  "designnames=VbhChole#VblVulni",
1658  "designmintargets=50", // hit at least 1 of the 2 targets
1659  "designmingc=60", "designmaxgc=75", // specific GC range
1660  };
1661 
1662  const char *expected =
1663  "Probe design parameters:\n"
1664  "Length of probe 18\n"
1665  "Temperature [ 0.0 -400.0]\n"
1666  "GC-content [60.0 - 75.0]\n"
1667  "E.Coli position [any]\n"
1668  "Max. nongroup hits 0 (lowest rejected nongroup hits: 1)\n"
1669  "Min. group hits 50%\n"
1670  "Target le apos ecol qual grps G+C temp Probe sequence | Decrease T by n*.3C -> probe matches n non group species\n"
1671  "AGUCGAGCGGCAGCACAG 18 A=21 20 39 2 66.7 60.0 CUGUGCUGCCGCUCGACU | - - - - - - - - - - - - - - - - - - - -\n"
1672  "GUCGAGCGGCAGCACAGA 18 A+ 1 21 39 2 66.7 60.0 UCUGUGCUGCCGCUCGAC | - - - - - - - - - - - - - - - - - - - -\n"
1673  "UCGAGCGGCAGCACAGAG 18 A+ 2 21 39 2 66.7 60.0 CUCUGUGCUGCCGCUCGA | - - - - - - - - - - - - - - - - - - - -\n"
1674  "AAGUCGAGCGGCAGCACA 18 A- 1 19 25 2 61.1 58.0 UGUGCUGCCGCUCGACUU | - - - - - - - - - - - - 1 1 1 1 1 1 1 1\n"
1675  "CGAGCGGCAGCACAGAGA 18 A+ 3 21 20 1 66.7 60.0 UCUCUGUGCUGCCGCUCG | - - - - - - - - - - - - - - - - - - - -\n"
1676  "CGAGCGGCAGCACAGAGG 18 A+ 3 21 20 1 72.2 62.0 CCUCUGUGCUGCCGCUCG | - - - - - - - - - - - - - - - - - - - -\n"
1677  "GAGCGGCAGCACAGAGAA 18 A+ 4 21 20 1 61.1 58.0 UUCUCUGUGCUGCCGCUC | - - - - - - - - - - - - - - - - - - - -\n"
1678  "GAGCGGCAGCACAGAGGA 18 A+ 4 21 20 1 66.7 60.0 UCCUCUGUGCUGCCGCUC | - - - - - - - - - - - - - - - - - - - -\n"
1679  "AGCGGCAGCACAGAGGAA 18 A+ 5 21 20 1 61.1 58.0 UUCCUCUGUGCUGCCGCU | - - - - - - - - - - - - - - - - - - - -\n"
1680  "GCGGCAGCACAGAGAAAC 18 A+ 6 22 20 1 61.1 58.0 GUUUCUCUGUGCUGCCGC | - - - - - - - - - - - - - - - - - - - -\n"
1681  "GCGGCAGCACAGAGGAAC 18 A+ 6 22 20 1 66.7 60.0 GUUCCUCUGUGCUGCCGC | - - - - - - - - - - - - - - - - - - - -\n"
1682  "CGGCAGCACAGAGGAACU 18 A+ 7 23 20 1 61.1 58.0 AGUUCCUCUGUGCUGCCG | - - - - - - - - - - - - - - - - - - - -\n"
1683  "CUUGUUCCUUGGGUGGCG 18 B=52 47 20 1 61.1 58.0 CGCCACCCAAGGAACAAG | - - - - - - - - - - - - - - - - - - - -\n"
1684  "CUUGUUUCUCGGGUGGCG 18 B+ 0 47 20 1 61.1 58.0 CGCCACCCGAGAAACAAG | - - - - - - - - - - - - - - - - - - - -\n"
1685  "UGUUCCUUGGGUGGCGAG 18 B+ 2 49 20 1 61.1 58.0 CUCGCCACCCAAGGAACA | - - - - - - - - - - - - - - - - - - - -\n"
1686  "UGUUUCUCGGGUGGCGAG 18 B+ 2 49 20 1 61.1 58.0 CUCGCCACCCGAGAAACA | - - - - - - - - - - - - - - - - - - - -\n"
1687  "GUUCCUUGGGUGGCGAGC 18 B+ 3 50 20 1 66.7 60.0 GCUCGCCACCCAAGGAAC | - - - - - - - - - - - - - - - - - - - -\n"
1688  "GUUUCUCGGGUGGCGAGC 18 B+ 3 50 20 1 66.7 60.0 GCUCGCCACCCGAGAAAC | - - - - - - - - - - - - - - - - - - - -\n"
1689  "UUCCUUGGGUGGCGAGCG 18 B+10 57 20 1 66.7 60.0 CGCUCGCCACCCAAGGAA | - - - - - - - - - - - - - - - - - - - -\n"
1690  "UUUCUCGGGUGGCGAGCG 18 B+10 57 20 1 66.7 60.0 CGCUCGCCACCCGAGAAA | - - - - - - - - - - - - - - - - - - - -\n"
1691  "UCCUUGGGUGGCGAGCGG 18 B+11 58 20 1 72.2 62.0 CCGCUCGCCACCCAAGGA | - - - - - - - - - - - - - - - - - - - -\n"
1692  "UUCUCGGGUGGCGAGCGG 18 B+11 58 20 1 72.2 62.0 CCGCUCGCCACCCGAGAA | - - - - - - - - - - - - - - - - - - - -\n"
1693  "CAAGUCGAGCGGCAGCAC 18 A- 2 18 13 2 66.7 60.0 GUGCUGCCGCUCGACUUG | - - - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"
1694  "UCAAGUCGAGCGGCAGCA 18 A- 3 17 3 2 61.1 58.0 UGCUGCCGCUCGACUUGA | - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3\n";
1695 
1696  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
1697  }
1698 
1699  // design MANY probes to test location specifier
1700  {
1701  const char *arguments_loc[] = {
1702  "prgnamefake",
1703  // "designnames=Stsssola#Stsssola", // @@@ crashes the ptserver
1704  "designnames=CPPParap#PsAAAA00",
1705  "designmintargets=50", // hit at least 1 of the 2 targets
1706  "designmingc=0", "designmaxgc=100", // allow all GCs
1707  "designmintemp=30", "designmaxtemp=100", // allow all temp above 30 deg
1708  "designmishit=7", // allow enough outgroup hits
1709  "designprobelength=9",
1710  };
1711 
1712  const char *expected_loc =
1713  "A=29B=51B+1C=99A+8D=112E=80E+2E+3E+4B-1A-5B-6B-5F=124F+1B-2E-7B+0C-5E+2E-1D-1E+6E+7E+8G=89C-2A-1H=61A-6C-1C-3E+3B+3B+4B+5E+5C+1E+4E+6E+7E+8C-7C-6E+5H+1H+2E-6C-4I=152I+1A-7";
1714 
1715  TEST_ARB_PROBE_FILT(ARRAY_ELEMS(arguments_loc), arguments_loc, extract_locations, expected_loc);
1716  }
1717 
1718  // same as above
1719  {
1720  const char *arguments[] = {
1721  "prgnamefake",
1722  "designnames=CPPParap#PsAAAA00",
1723  "designmintargets=50", // hit at least 1 of the 2 targets
1724  "designmingc=0", "designmaxgc=100", // allow all GCs
1725  "designmintemp=30", "designmaxtemp=100", // allow all temp above 30 deg
1726  "designmishit=7", // allow enough outgroup hits
1727  "designprobelength=9",
1728  };
1729 
1730  const char *expected =
1731  "Probe design parameters:\n"
1732  "Length of probe 9\n"
1733  "Temperature [30.0 -100.0]\n"
1734  "GC-content [ 0.0 -100.0]\n"
1735  "E.Coli position [any]\n"
1736  "Max. nongroup hits 7 (lowest rejected nongroup hits: 9)\n"
1737  "Min. group hits 50%\n"
1738  "Target le apos ecol qual grps G+C temp Probe | Decrease T by n*.3C -> probe matches n non group species\n"
1739  "GAGCGGAUG 9 A= 29 24 20 1 66.7 30.0 CAUCCGCUC | - - - - - - - - - - - - - - - - - - - -\n"
1740  "UGCUCCUGG 9 B= 51 46 20 1 66.7 30.0 CCAGGAGCA | - - - - - - - - - - - - - - - - - - - -\n"
1741  "GCUCCUGGA 9 B+ 1 47 20 1 66.7 30.0 UCCAGGAGC | - - - - - - - - - - - - - - - - - - - -\n"
1742  "CGGGCGCUA 9 C= 99 87 20 1 77.8 32.0 UAGCGCCCG | - - - - - - - - - - - - - - - - - - - -\n"
1743  "GAAGGGAGC 9 A+ 8 32 20 1 66.7 30.0 GCUCCCUUC | 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2\n"
1744  "CGCAUACGC 9 D=112 100 20 1 66.7 30.0 GCGUAUGCG | 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n"
1745  "CGGACGGGC 9 E= 80 69 20 1 88.9 34.0 GCCCGUCCG | 2 2 2 2 2 2 2 2 2 2 2 2 2 2 3 3 3 3 3 3\n"
1746  "GGACGGGCC 9 E+ 2 70 20 1 88.9 34.0 GGCCCGUCC | 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n"
1747  "GACGGGCCU 9 E+ 3 71 20 1 77.8 32.0 AGGCCCGUC | 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n"
1748  "ACGGGCCUU 9 E+ 4 72 20 1 66.7 30.0 AAGGCCCGU | 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n"
1749  "UCCUUCGGG 9 B- 1 45 20 1 66.7 30.0 CCCGAAGGA | 2 2 2 2 2 2 2 2 2 2 2 2 3 4 4 4 4 4 4 4\n"
1750  "CGAGCGAUG 9 A- 5 21 20 1 66.7 30.0 CAUCGCUCG | 3 3 3 3 3 3 3 3 3 3 5 5 5 5 5 5 5 5 5 5\n"
1751  "GGGAGCUUG 9 B- 6 40 20 1 66.7 30.0 CAAGCUCCC | 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 5 5\n"
1752  "GGAGCUUGC 9 B- 5 41 20 1 66.7 30.0 GCAAGCUCC | 4 4 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5 5\n"
1753  "GCGAUUGGG 9 F=124 111 20 1 66.7 30.0 CCCAAUCGC | 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 6 6\n"
1754  "CGAUUGGGG 9 F+ 1 112 20 1 66.7 30.0 CCCCAAUCG | 3 3 3 3 3 3 6 6 6 6 6 6 6 6 6 6 6 6 6 6\n"
1755  "GCUUGCUCC 9 B- 2 44 20 1 66.7 30.0 GGAGCAAGC | 4 4 4 4 4 4 5 5 5 5 5 5 5 7 7 7 7 8 8 8\n"
1756  "UUAGCGGCG 9 E- 7 62 19 1 66.7 30.0 CGCCGCUAA | 4 4 4 4 4 4 4 4 5 5 5 5 5 5 5 6 6 6 11 11\n"
1757  "CCUUCGGGA 9 B+ 0 46 18 1 66.7 30.0 UCCCGAAGG | 2 2 3 3 3 3 4 4 4 4 4 4 4 4 4 4 4 5 5 13\n"
1758  "GGAAACGGG 9 C- 5 82 17 1 66.7 30.0 CCCGUUUCC | - - - - - - - - - - - - - - - - 3 3 3 3\n"
1759  "GGACGGACG 9 E+ 2 70 17 1 77.8 32.0 CGUCCGUCC | 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 10 10 14 14\n"
1760  "GCGGACGGG 9 E- 1 68 17 1 88.9 34.0 CCCGUCCGC | 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 13 13 13 13\n"
1761  "CCGCAUACG 9 D- 1 99 16 1 66.7 30.0 CGUAUGCGG | 2 2 2 2 2 2 2 2 2 2 2 4 4 4 4 5 5 5 5 5\n"
1762  "GGACGUCCG 9 E+ 6 74 14 1 77.8 32.0 CGGACGUCC | - - - - - - - - - - - - - 1 1 1 1 3 3 3\n"
1763  "GACGUCCGG 9 E+ 7 75 14 1 77.8 32.0 CCGGACGUC | - - - - - - - - - - - - - 1 1 1 1 2 2 14\n"
1764  "ACGUCCGGA 9 E+ 8 76 14 1 66.7 30.0 UCCGGACGU | - - - - - - - - - - - - - 1 1 11 11 12 12 17\n"
1765  "CGUCCGGAA 9 G= 89 77 14 1 66.7 30.0 UUCCGGACG | - - - - - - - - - - - - - 1 1 1 1 2 2 2\n"
1766  "AACGGGCGC 9 C- 2 85 14 1 77.8 32.0 GCGCCCGUU | - - - - - - - - - - - - - 1 1 1 1 1 1 2\n"
1767  "CGAGCGGAU 9 A- 1 23 13 1 66.7 30.0 AUCCGCUCG | - - - - - - - - - - - - 3 3 3 3 3 3 3 3\n"
1768  "UUCAGCGGC 9 H= 61 56 13 1 66.7 30.0 GCCGCUGAA | 1 1 1 1 1 1 2 2 2 2 2 2 3 4 4 4 4 4 7 7\n"
1769  "UCGAGCGGA 9 A- 6 21 13 1 66.7 30.0 UCCGCUCGA | 3 3 3 3 3 3 3 3 3 3 3 3 8 8 8 8 8 8 8 8\n"
1770  "ACGGGCGCU 9 C- 1 86 12 1 77.8 32.0 AGCGCCCGU | - - - - - - - - - - - 1 1 1 1 1 1 2 2 2\n"
1771  "AAACGGGCG 9 C- 3 84 9 1 66.7 30.0 CGCCCGUUU | - - - - - - - - 1 1 1 1 1 1 1 1 1 1 1 1\n"
1772  "GACGGACGU 9 E+ 3 71 9 1 66.7 30.0 ACGUCCGUC | 2 2 2 2 2 2 2 2 13 13 13 13 13 13 13 14 14 14 14 14\n"
1773  "UCGGGAACG 9 B+ 3 49 7 1 66.7 30.0 CGUUCCCGA | - - - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"
1774  "CGGGAACGG 9 B+ 4 50 7 1 77.8 32.0 CCGUUCCCG | - - - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"
1775  "GGGAACGGA 9 B+ 5 51 7 1 66.7 30.0 UCCGUUCCC | - - - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"
1776  "CGGACGUCC 9 E+ 5 73 7 1 77.8 32.0 GGACGUCCG | - - - - - - 1 1 1 1 1 1 1 3 3 3 3 12 12 12\n"
1777  "GGGCGCUAA 9 C+ 1 88 7 1 66.7 30.0 UUAGCGCCC | - - - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"
1778  "ACGGACGUC 9 E+ 4 72 7 1 66.7 30.0 GACGUCCGU | - - - - - - 2 2 3 3 3 4 4 4 4 5 5 5 5 13\n"
1779  "GGGCCUUCC 9 E+ 6 74 7 1 77.8 32.0 GGAAGGCCC | - - - - - - 2 2 2 2 2 3 3 3 3 3 3 3 3 4\n"
1780  "GGCCUUCCG 9 E+ 7 75 7 1 77.8 32.0 CGGAAGGCC | - - - - - - 2 2 2 2 2 3 3 3 3 3 3 3 3 3\n"
1781  "GCCUUCCGA 9 E+ 8 76 7 1 66.7 30.0 UCGGAAGGC | - - - - - - 2 2 2 2 2 3 3 3 3 3 3 3 3 3\n"
1782  "CCGGAAACG 9 C- 7 80 7 1 66.7 30.0 CGUUUCCGG | - - - - - - 2 2 2 2 2 2 2 6 7 9 9 10 10 10\n"
1783  "CGGAAACGG 9 C- 6 81 7 1 66.7 30.0 CCGUUUCCG | - - - - - - 2 2 4 4 4 4 4 4 5 5 6 6 6 6\n"
1784  "CGGGCCUUC 9 E+ 5 73 7 1 77.8 32.0 GAAGGCCCG | 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n"
1785  "UCAGCGGCG 9 H+ 1 57 7 1 77.8 32.0 CGCCGCUGA | 2 2 2 2 2 2 6 6 6 6 6 6 6 6 6 6 7 7 7 7\n"
1786  "CAGCGGCGG 9 H+ 2 58 7 1 88.9 34.0 CCGCCGCUG | 2 2 2 2 2 2 6 6 6 6 6 6 6 7 12 12 12 12 12 12\n"
1787  "UAGCGGCGG 9 E- 6 63 7 1 77.8 32.0 CCGCCGCUA | 4 4 4 4 4 4 10 10 10 10 10 10 12 14 14 14 14 14 14 14\n"
1788  "GAAACGGGC 9 C- 4 83 5 1 66.7 30.0 GCCCGUUUC | - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"
1789  "GCCGUAGGA 9 I=152 138 3 1 66.7 30.0 UCCUACGGC | 1 1 8 8 8 8 8 8 8 8 8 8 9 9 9 9 9 9 12 12\n"
1790  "CCGUAGGAG 9 I+ 1 139 3 1 66.7 30.0 CUCCUACGG | 1 1 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 10 11 11\n"
1791  "GUCGAGCGA 9 A- 7 21 3 1 66.7 30.0 UCGCUCGAC | 3 3 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 11 13\n";
1792 
1793  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
1794  }
1795 
1796 #if defined(ARB_64)
1797 #define RES_64
1798 #else // !defined(ARB_64)
1799 // results below differ for some(!) 32 bit arb versions (numeric issues?)
1800 // (e.g. u1004 behaves like 64bit version; u1204 doesnt in NDEBUG mode)
1801 // #define RES_64 // uncomment for u1004
1802 #if defined(DEBUG)
1803 #define RES_64
1804 #endif
1805 
1806 #endif
1807 
1808 
1809  // same as above (with probelen == 8)
1810  {
1811  const char *arguments[] = {
1812  "prgnamefake",
1813  "designnames=CPPParap#PsAAAA00",
1814  "designmintargets=50", // hit at least 1 of the 2 targets
1815  "designmingc=0", "designmaxgc=100", // allow all GCs
1816  "designmintemp=30", "designmaxtemp=100", // allow all temp above 30 deg
1817  // "designmishit=7",
1818  "designmishit=15", // @@@ reports more results than with 7 mishits, but no mishits reported below!
1819  "designprobelength=8",
1820  };
1821 
1822  const char *expected =
1823  "Probe design parameters:\n"
1824  "Length of probe 8\n"
1825  "Temperature [30.0 -100.0]\n"
1826  "GC-content [ 0.0 -100.0]\n"
1827  "E.Coli position [any]\n"
1828  "Max. nongroup hits 15\n"
1829  "Min. group hits 50%\n"
1830  "Target le apos ecol qual grps G+C temp Probe | Decrease T by n*.3C -> probe matches n non group species\n"
1831  "GGCGGACG 8 A=78 67 39 2 87.5 30.0 CGUCCGCC | 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13\n"
1832  "GCGGACGG 8 A+ 1 68 39 2 87.5 30.0 CCGUCCGC | 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13\n"
1833  "AGCGGCGG 8 A- 3 64 39 2 87.5 30.0 CCGCCGCU | 11 11 11 11 11 11 11 14 14 14 14 14 14 14 14 14 14 14 14 14\n"
1834  "GCGGCGGA 8 A- 2 65 39 2 87.5 30.0 UCCGCCGC | 10 10 11 11 11 11 11 14 14 14 14 14 14 14 14 14 14 14 14 14\n"
1835  "CGGCGGAC 8 A- 1 66 39 2 87.5 30.0 GUCCGCCG | 10 10 10 10 10 10 10 13 13 13 13 13 13 13 14 14 14 14 14 14\n"
1836  "CGGACGGG 8 A+ 2 69 20 1 87.5 30.0 CCCGUCCG | 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n"
1837  "GGACGGGC 8 A+ 4 70 20 1 87.5 30.0 GCCCGUCC | 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n"
1838  "GACGGGCC 8 A+ 5 71 20 1 87.5 30.0 GGCCCGUC | 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3\n"
1839 #if defined(RES_64)
1840  "ACGGGCGC 8 B=98 86 13 1 87.5 30.0 GCGCCCGU | - - - - - - - - - - - - 1 1 1 1 1 1 1 1\n"
1841  "CGGGCGCU 8 B+ 1 87 13 1 87.5 30.0 AGCGCCCG | - - - - - - - - - - - - 1 1 1 1 1 1 1 1\n"
1842  "CAGCGGCG 8 C=63 58 8 1 87.5 30.0 CGCCGCUG | 2 2 2 2 2 2 2 6 6 6 6 6 6 6 8 8 8 8 8 8\n";
1843 #else // !defined(RES_64)
1844  "ACGGGCGC 8 B=98 86 13 1 87.5 30.0 GCGCCCGU | - - - - - - - - - - - - 1 1 1 1 1 1 1 2\n"
1845  "CGGGCGCU 8 B+ 1 87 13 1 87.5 30.0 AGCGCCCG | - - - - - - - - - - - - 1 1 1 1 1 1 1 2\n"
1846  "CAGCGGCG 8 C=63 58 8 1 87.5 30.0 CGCCGCUG | 2 2 2 2 2 2 2 6 6 6 6 6 6 6 8 8 8 8 8 10\n";
1847 #endif
1848 
1849  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
1850  }
1851 
1852  // same as above (but restricting ecoli-range)
1853  {
1854  const char *arguments[] = {
1855  "prgnamefake",
1856  "designnames=CPPParap#PsAAAA00",
1857  "designmintargets=50", // hit at least 1 of the 2 targets
1858  "designmingc=0", "designmaxgc=100", // allow all GCs
1859  "designmintemp=30", "designmaxtemp=100", // allow all temp above 30 deg
1860  "designmishit=15",
1861  "designprobelength=8",
1862  "designminpos=65", "designmaxpos=69", // restrict ecoli-range
1863  };
1864 
1865  const char *expected =
1866  "Probe design parameters:\n"
1867  "Length of probe 8\n"
1868  "Temperature [30.0 -100.0]\n"
1869  "GC-content [ 0.0 -100.0]\n"
1870  "E.Coli position [ 65 - 69]\n"
1871  "Max. nongroup hits 15\n"
1872  "Min. group hits 50%\n"
1873  "Target le apos ecol qual grps G+C temp Probe | Decrease T by n*.3C -> probe matches n non group species\n"
1874  "GGCGGACG 8 A=78 67 39 2 87.5 30.0 CGUCCGCC | 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13\n"
1875  "GCGGACGG 8 A+ 1 68 39 2 87.5 30.0 CCGUCCGC | 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13 13\n"
1876  "GCGGCGGA 8 A- 2 65 39 2 87.5 30.0 UCCGCCGC | 10 10 11 11 11 11 11 14 14 14 14 14 14 14 14 14 14 14 14 14\n"
1877  "CGGCGGAC 8 A- 1 66 39 2 87.5 30.0 GUCCGCCG | 10 10 10 10 10 10 10 13 13 13 13 13 13 13 14 14 14 14 14 14\n"
1878  "CGGACGGG 8 A+ 2 69 20 1 87.5 30.0 CCCGUCCG | 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2\n";
1879 
1880  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
1881  }
1882 
1883  {
1884  const char *arguments[] = {
1885  "prgnamefake",
1886  "designnames=ClnCorin#CPPParap#ClfPerfr",
1887  "designprobelength=16",
1888  "designmintargets=100",
1889  "designmishit=2",
1890  };
1891  const char *expected =
1892  "Probe design parameters:\n"
1893  "Length of probe 16\n"
1894  "Temperature [ 0.0 -400.0]\n"
1895  "GC-content [30.0 - 80.0]\n"
1896  "E.Coli position [any]\n"
1897  "Max. nongroup hits 2 (lowest rejected nongroup hits: 6)\n"
1898  "Min. group hits 100% (max. rejected coverage: 67%)\n"
1899  "Target le apos ecol qual grps G+C temp Probe sequence | Decrease T by n*.3C -> probe matches n non group species\n"
1900  "CGAAAGGAAGAUUAAU 16 A=94 82 58 3 31.2 42.0 AUUAAUCUUCCUUUCG | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"
1901  "AAGGAAGAUUAAUACC 16 A+ 3 85 58 3 31.2 42.0 GGUAUUAAUCUUCCUU | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"
1902  "AAGUCGAGCGAUGAAG 16 B=20 19 52 3 50.0 48.0 CUUCAUCGCUCGACUU | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3\n"
1903  "CAAGUCGAGCGAUGAA 16 B- 1 18 37 3 50.0 48.0 UUCAUCGCUCGACUUG | 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3\n"
1904  "GUCGAGCGAUGAAGUU 16 B+ 2 21 31 3 50.0 48.0 AACUUCAUCGCUCGAC | - - - - - - - - - - 1 1 1 1 1 1 1 1 1 1\n"
1905  "UCAAGUCGAGCGAUGA 16 B- 2 17 28 3 50.0 48.0 UCAUCGCUCGACUUGA | 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3\n"
1906  "AGUCGAGCGAUGAAGU 16 B+ 1 20 19 3 50.0 48.0 ACUUCAUCGCUCGACU | - - - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"
1907  "AUCAAGUCGAGCGAUG 16 B- 3 16 16 3 50.0 48.0 CAUCGCUCGACUUGAU | 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 3 10 10 10\n"
1908  "GAUCAAGUCGAGCGAU 16 B- 4 15 4 3 50.0 48.0 AUCGCUCGACUUGAUC | - 2 2 2 3 3 3 3 10 10 10 10 10 10 10 10 10 10 10 10\n"
1909  "UGAUCAAGUCGAGCGA 16 B- 5 14 4 3 50.0 48.0 UCGCUCGACUUGAUCA | - 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10\n";
1910 
1911  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
1912  }
1913  // test same design as above, but add 2 "unknown species" each of which is missing one of the previously designed probes
1914  {
1915  const char *arguments[] = {
1916  "prgnamefake",
1917  "designnames=ClnCorin#Unknown1#CPPParap#ClfPerfr#Unknown2",
1918  "designprobelength=16",
1919  "designmintargets=100",
1920  "designmishit=2",
1921  // pass sequences for the unknown species
1922  "designsequence=---CGAAAGGAAGAUUAAU------------------AAGUCGAGCGAUGAAG-CAAGUCGAGCGAUGAA-GUCGAGCGAUGAAGUU-UCAAGUCGAGCGAUGA-AGUCGAGCGAUGAAGU-AUCAAGUCGAGCGAUG-GAUCAAGUCGAGCGAU-UGAUCAAGUCGAGCGA",
1923  "designsequence=---CGAAAGGAAGAUUAAU-AAGGAAGAUUAAUACC-AAGUCGAGCGAUGAAG-CAAGUCGAGCGAUGAA-GUCGAGCGAUGAAGUU-UCAAGUCGAGCGAUGA-AGUCGAGCGAUGAAGU-AUCAAGUCGAGCGAUG------------------UGAUCAAGUCGAGCGA",
1924  };
1925  const char *expected =
1926  "Probe design parameters:\n"
1927  "Length of probe 16\n"
1928  "Temperature [ 0.0 -400.0]\n"
1929  "GC-content [30.0 - 80.0]\n"
1930  "E.Coli position [any]\n"
1931  "Max. nongroup hits 2\n"
1932  "Min. group hits 100% (max. rejected coverage: 80%)\n"
1933  "Target le apos ecol qual grps G+C temp Probe sequence | Decrease T by n*.3C -> probe matches n non group species\n"
1934  "CGAAAGGAAGAUUAAU 16 A=94 82 96 5 31.2 42.0 AUUAAUCUUCCUUUCG | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"
1935  // AAGGAAGAUUAAUACC is not designed here
1936  "AAGUCGAGCGAUGAAG 16 B=20 19 86 5 50.0 48.0 CUUCAUCGCUCGACUU | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3\n"
1937  "CAAGUCGAGCGAUGAA 16 B- 1 18 61 5 50.0 48.0 UUCAUCGCUCGACUUG | 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3\n"
1938  "GUCGAGCGAUGAAGUU 16 B+ 2 21 51 5 50.0 48.0 AACUUCAUCGCUCGAC | - - - - - - - - - - 1 1 1 1 1 1 1 1 1 1\n"
1939  "UCAAGUCGAGCGAUGA 16 B- 2 17 46 5 50.0 48.0 UCAUCGCUCGACUUGA | 1 1 1 1 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3\n"
1940  "AGUCGAGCGAUGAAGU 16 B+ 1 20 31 5 50.0 48.0 ACUUCAUCGCUCGACU | - - - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1 1\n"
1941  "AUCAAGUCGAGCGAUG 16 B- 3 16 26 5 50.0 48.0 CAUCGCUCGACUUGAU | 1 1 1 1 1 3 3 3 3 3 3 3 3 3 3 3 3 10 10 10\n"
1942  // GAUCAAGUCGAGCGAU is not designed here
1943  "UGAUCAAGUCGAGCGA 16 B- 5 14 6 5 50.0 48.0 UCGCUCGACUUGAUCA | - 9 9 9 9 9 9 9 10 10 10 10 10 10 10 10 10 10 10 10\n";
1944 
1945  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
1946  }
1947  {
1948  const char *arguments[] = {
1949  "prgnamefake",
1950  "designnames=VbrFurni",
1951  "designprobelength=8",
1952  "designmingc=80",
1953  "designmaxgc=100",
1954  };
1955  const char *expected =
1956  "Probe design parameters:\n"
1957  "Length of probe 8\n"
1958  "Temperature [ 0.0 -400.0]\n"
1959  "GC-content [80.0 -100.0]\n"
1960  "E.Coli position [any]\n"
1961  "Max. nongroup hits 0 (lowest rejected nongroup hits: 2)\n"
1962  "Min. group hits 50%\n"
1963  "Target le apos ecol qual grps G+C temp Probe | Decrease T by n*.3C -> probe matches n non group species\n"
1964 #if defined(RES_64)
1965  "CGGCAGCG 8 A=28 23 20 1 87.5 30.0 CGCUGCCG | - - - - - - - - - - - - - - - - - - - -\n"
1966 #else // !defined(RES_64)
1967  "CGGCAGCG 8 A=28 23 20 1 87.5 30.0 CGCUGCCG | - - - - - - - - - - - - - - - - - - - 3\n"
1968 #endif
1969  "UGGGCGGC 8 B=67 60 8 1 87.5 30.0 GCCGCCCA | - - - - - - - 1 1 1 1 1 1 1 1 1 1 1 1 1\n"
1970 #if defined(RES_64)
1971  "CGGCGAGC 8 B+ 4 60 8 1 87.5 30.0 GCUCGCCG | - - - - - - - 2 2 2 2 2 2 2 3 3 3 3 3 3\n"
1972 #else // !defined(RES_64)
1973  "CGGCGAGC 8 B+ 4 60 8 1 87.5 30.0 GCUCGCCG | - - - - - - - 2 2 2 2 2 2 2 4 4 4 4 4 5\n"
1974 #endif
1975  "GGGCGGCG 8 B+ 1 60 8 1 100.0 32.0 CGCCGCCC | - - - - - - - 3 3 3 3 3 3 3 3 3 3 3 3 3\n"
1976  "GGCGGCGA 8 B+ 2 60 8 1 87.5 30.0 UCGCCGCC | - - - - - - - 3 3 3 3 3 3 3 3 3 3 3 3 3\n"
1977  "GCGGCGAG 8 B+ 3 60 3 1 87.5 30.0 CUCGCCGC | - - 1 1 1 1 1 4 4 4 4 4 4 4 4 4 4 4 4 4\n";
1978 
1979  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
1980  }
1981  {
1982  const char *arguments[] = {
1983  "prgnamefake",
1984  "designnames=HllHalod#VbhChole#VblVulni#VbrFurni#PtVVVulg",
1985  "designprobelength=14",
1986  "designmintargets=100",
1987  "designmishit=4",
1988  "designmingc=70",
1989  "designmaxgc=100",
1990  };
1991  const char *expected =
1992  "Probe design parameters:\n"
1993  "Length of probe 14\n"
1994  "Temperature [ 0.0 -400.0]\n"
1995  "GC-content [70.0 -100.0]\n"
1996  "E.Coli position [any]\n"
1997  "Max. nongroup hits 4\n"
1998  "Min. group hits 100% (max. rejected coverage: 80%)\n"
1999  "Target le apos ecol qual grps G+C temp Probe sequence | Decrease T by n*.3C -> probe matches n non group species\n"
2000  "GAGCGGCGGACGGA 14 A=75 64 21 5 78.6 50.0 UCCGUCCGCCGCUC | - - - - 1 1 1 1 1 1 5 5 9 9 10 10 10 10 10 10\n"
2001  "CGAGCGGCGGACGG 14 A- 1 63 21 5 85.7 52.0 CCGUCCGCCGCUCG | - - - - 2 2 2 2 2 2 2 2 2 2 2 2 2 2 9 9\n"
2002  "AGCGGCGGACGGAC 14 A+ 0 64 21 5 78.6 50.0 GUCCGUCCGCCGCU | 4 7 7 7 9 9 9 9 9 9 9 9 9 9 9 9 9 10 10 10\n";
2003 
2004  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
2005  }
2006  {
2007  const char *arguments[] = {
2008  "prgnamefake",
2009  "designnames=HllHalod#VbhChole#VblVulni#VbrFurni#PtVVVulg",
2010  "designprobelength=14",
2011  "designmintargets=100",
2012  "designmishit=0",
2013  "designmingc=51",
2014  "designmaxgc=60",
2015  };
2016  const char *expected = ""; // no probes found!
2017 
2018  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
2019  }
2020 
2021 }
2022 
2023 void TEST_SLOW_probe_design_errors() {
2024  // test here runs versus database ../UNIT_TESTER/run/TEST_pt_src.arb
2025 
2026  bool use_gene_ptserver = false;
2027  {
2028  const char *arguments[] = {
2029  "prgnamefake",
2030  "designnames=CPPParap#PsAAAA00",
2031  "designprobelength=3",
2032  };
2033  const char *expected_error = "Specified min. probe length 3 is below the min. allowed probe length of 8";
2034 
2035  TEST_ARB_PROBE__REPORTS_ERROR(ARRAY_ELEMS(arguments), arguments, expected_error);
2036  }
2037  {
2038  const char *arguments[] = {
2039  "prgnamefake",
2040  "designnames=CPPParap#PsAAAA00",
2041  "designprobelength=15",
2042  "designmaxprobelength=12",
2043  };
2044  const char *expected_error = "Max. probe length 12 is below the specified min. probe length of 15";
2045 
2046  TEST_ARB_PROBE__REPORTS_ERROR(ARRAY_ELEMS(arguments), arguments, expected_error);
2047  }
2048  {
2049  const char *expected_error = "Sequence contains only 0 bp. Impossible design request for one of the added sequences";
2050  {
2051  const char *arguments[] = {
2052  "prgnamefake",
2053  "designsequence=", // pass an empty sequence
2054  "designprobelength=16",
2055  };
2056  TEST_ARB_PROBE__REPORTS_ERROR(ARRAY_ELEMS(arguments), arguments, expected_error);
2057  }
2058  {
2059  const char *arguments[] = {
2060  "prgnamefake",
2061  "designsequence=-------------", // pass a gap-only sequence
2062  "designprobelength=16",
2063  };
2064  TEST_ARB_PROBE__REPORTS_ERROR(ARRAY_ELEMS(arguments), arguments, expected_error);
2065  }
2066  }
2067  {
2068  const char *arguments[] = {
2069  "prgnamefake",
2070  "designsequence=ACGTACGTACGTACGT", // pass a long enough (unexpected) sequence
2071  "designprobelength=16",
2072  };
2073  const char *expected_error = "Got 0 unknown marked species, but 1 custom sequence was added (has to match)";
2074  TEST_ARB_PROBE__REPORTS_ERROR(ARRAY_ELEMS(arguments), arguments, expected_error);
2075  }
2076  {
2077  const char *arguments[] = {
2078  "prgnamefake",
2079  "designnames=Unknown", // one unknown species
2080  "designprobelength=16",
2081  };
2082  const char *expected_error = "No species marked - no probes designed";
2083  TEST_ARB_PROBE__REPORTS_ERROR(ARRAY_ELEMS(arguments), arguments, expected_error);
2084  }
2085  {
2086  const char *arguments[] = {
2087  "prgnamefake",
2088  "designnames=Unknown#CPPParap", // one unknown species, one known species
2089  "designprobelength=16",
2090  };
2091  const char *expected_error = "Got 1 unknown marked species, but 0 custom sequences were added (has to match)";
2092  TEST_ARB_PROBE__REPORTS_ERROR(ARRAY_ELEMS(arguments), arguments, expected_error);
2093  }
2094  {
2095  const char *expected_error = "Sequence contains only 0 bp. Impossible design request for one of the added sequences";
2096  {
2097  const char *arguments[] = {
2098  "prgnamefake",
2099  "designnames=Unknown", // one unknown species
2100  "designsequence=", // pass an empty sequence
2101  "designprobelength=16",
2102  };
2103  TEST_ARB_PROBE__REPORTS_ERROR(ARRAY_ELEMS(arguments), arguments, expected_error);
2104  }
2105  {
2106  const char *arguments[] = {
2107  "prgnamefake",
2108  "designnames=Unknown", // one unknown species
2109  "designsequence=-------------", // pass a gap-only sequence
2110  "designprobelength=16",
2111  };
2112  TEST_ARB_PROBE__REPORTS_ERROR(ARRAY_ELEMS(arguments), arguments, expected_error);
2113  }
2114  }
2115 }
2116 
2117 void TEST_SLOW_match_designed_probe() {
2118  // test here runs versus database ../UNIT_TESTER/run/TEST_pt_src.arb
2119 
2120  bool use_gene_ptserver = false;
2121  const char *arguments[] = {
2122  "prgnamefake",
2123  "matchsequence=UCAAGUCGAGCGAUGAAG",
2124  };
2125  CCP expected = " name---- fullname mis N_mis wmis pos ecoli rev 'UCAAGUCGAGCGAUGAAG'\1"
2126  "ClnCorin\1" " ClnCorin 0 0 0.0 18 17 0 .GAGUUUGA-==================-UUCCUUCGG\1"
2127  "CltBotul\1" " CltBotul 0 0 0.0 18 17 0 ........A-==================-CUUCUUCGG\1"
2128  "CPPParap\1" " CPPParap 0 0 0.0 18 17 0 AGAGUUUGA-==================-UUCCUUCGG\1"
2129  "ClfPerfr\1" " ClfPerfr 0 0 0.0 18 17 0 AGAGUUUGA-==================-UUUCCUUCG\1";
2130 
2131  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
2132 }
2133 
2134 void TEST_SLOW_get_existing_probes() {
2135  // test here runs versus database ../UNIT_TESTER/run/TEST_pt_src.arb
2136 
2137  bool use_gene_ptserver = false;
2138  {
2139  const char *arguments[] = {
2140  "prgnamefake",
2141  "iterate=20",
2142  "iterate_amount=10",
2143  };
2144  CCP expected =
2145  "AAACCGGGGCTAATACCGGA;AAACGACTGTTAATACCGCA;AAACGATGGAAGCTTGCTTC;AAACGATGGCTAATACCGCA;AAACGGATTAGCGGCGGGAC;"
2146  "AAACGGGCGCTAATACCGCA;AAACGGTCGCTAATACCGGA;AAACGGTGGCTAATACCGCA;AAACGTACGCTAATACCGCA;AAACTCAAGCTAATACCGCA";
2147 
2148  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
2149  }
2150  {
2151  const char *arguments[] = {
2152  "prgnamefake",
2153  "iterate=15",
2154  "iterate_amount=20",
2155  "iterate_separator=:",
2156  };
2157  CCP expected =
2158  "AAACCGGGGCTAATA:AAACGACTGTTAATA:AAACGATGGAAGCTT:AAACGATGGCTAATA:AAACGGATTAGCGGC:AAACGGGCGCTAATA:AAACGGTCGCTAATA:"
2159  "AAACGGTGGCTAATA:AAACGTACGCTAATA:AAACTCAAGCTAATA:AAACTCAGGCTAATA:AAACTGGAGAGTTTG:AAACTGTAGCTAATA:AAACTTGTTTCTCGG:"
2160  "AAAGAGGTGCTAATA:AAAGCTTGCTTTCTT:AAAGGAACGCTAATA:AAAGGAAGATTAATA:AAAGGACAGCTAATA:AAAGGGACTTCGGTC";
2161 
2162  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
2163  }
2164  {
2165  const char *arguments[] = {
2166  "prgnamefake",
2167  "iterate=10",
2168  "iterate_amount=5",
2169  "iterate_readable=0",
2170  };
2171  CCP expected =
2172  "\2\2\2\3\3\4\4\4\4\3;\2\2\2\3\4\2\3\5\4\5;\2\2\2\3\4\2\5\4\4\2;\2\2\2\3\4\2\5\4\4\3;\2\2\2\3\4\4\2\5\5\2";
2173 
2174  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
2175  }
2176  {
2177  const char *arguments[] = {
2178  "prgnamefake",
2179  "iterate=3",
2180  "iterate_amount=70",
2181  "iterate_tu=U",
2182  };
2183  CCP expected =
2184  "AAA;AAC;AAG;AAU;ACA;ACC;ACG;ACU;AGA;AGC;AGG;AGU;AUA;AUC;AUG;AUU;"
2185  "CAA;CAC;CAG;CAU;CCA;CCC;CCG;CCU;CGA;CGC;CGG;CGU;CUA;CUC;CUG;CUU;"
2186  "GAA;GAC;GAG;GAU;GCA;GCC;GCG;GCU;GGA;GGC;GGG;GGU;GUA;GUC;GUG;GUU;"
2187  "UAA;UAC;UAG;UAU;UCA;UCC;UCG;UCU;UGA;UGC;UGG;UGU;UUA;UUC;UUG;UUU";
2188 
2189  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
2190  }
2191  {
2192  const char *arguments[] = {
2193  "prgnamefake",
2194  "iterate=2",
2195  "iterate_amount=20",
2196  };
2197  CCP expected =
2198  "AA;AC;AG;AT;"
2199  "CA;CC;CG;CT;"
2200  "GA;GC;GG;GT;"
2201  "TA;TC;TG;TT";
2202 
2203  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, expected);
2204  }
2205 }
2206 
2207 // #define TEST_AUTO_UPDATE // uncomment to auto-update expected index dumps
2208 
2209 void TEST_SLOW_index_dump() {
2210  for (int use_gene_ptserver = 0; use_gene_ptserver <= 1; use_gene_ptserver++) {
2211  const char *dumpfile = use_gene_ptserver ? "index_gpt.dump" : "index_pt.dump";
2212  char *dumpfile_exp = GBS_global_string_copy("%s.expected", dumpfile);
2213 
2214  const char *arguments[] = {
2215  "prgnamefake",
2216  GBS_global_string_copy("dump=%s", dumpfile),
2217  };
2218  TEST_ARB_PROBE(ARRAY_ELEMS(arguments), arguments, "ok");
2219 
2220 #if defined(TEST_AUTO_UPDATE)
2221  TEST_COPY_FILE(dumpfile, dumpfile_exp);
2222 #else // !defined(TEST_AUTO_UPDATE)
2223  TEST_EXPECT_TEXTFILES_EQUAL(dumpfile_exp, dumpfile);
2224 #endif
2225  TEST_EXPECT_ZERO_OR_SHOW_ERRNO(unlink(dumpfile));
2226 
2227  free((char*)arguments[1]);
2228  free(dumpfile_exp);
2229  }
2230 }
2231 
2232 #undef TEST_AUTO_UPDATE
2233 
2234 // --------------------------------------------------------------------------------
2235 
2236 #include <arb_strarray.h>
2237 #include <set>
2238 #include <iterator>
2239 
2240 using namespace std;
2241 
2242 typedef set<string> Matches;
2243 
2244 inline void parseMatches(char*& answer, Matches& matches) {
2245  ConstStrArray match_results;
2246 
2247  GBT_splitNdestroy_string(match_results, answer, "\1", false);
2248 
2249  for (size_t i = 1; i<match_results.size(); i += 2) {
2250  if (match_results[i][0]) {
2251  matches.insert(match_results[i]);
2252  }
2253  }
2254 }
2255 
2256 inline void getMatches(const char *probe, Matches& matches) {
2257  bool use_gene_ptserver = false;
2258  char *matchseq = GBS_global_string_copy("matchsequence=%s", probe);
2259  const char *arguments[] = {
2260  "prgnamefake",
2261  matchseq,
2262  };
2263  TEST_RUN_ARB_PROBE(ARRAY_ELEMS(arguments), arguments);
2264  parseMatches(answer, matches);
2265  free(matchseq);
2266 }
2267 
2268 inline string matches2hitlist(const Matches& matches) {
2269  string hitlist;
2270  if (!matches.empty()) {
2271  for (Matches::const_iterator m = matches.begin(); m != matches.end(); ++m) {
2272  hitlist = hitlist + ',' + *m;
2273  }
2274  hitlist = hitlist.substr(1);
2275  }
2276  return hitlist;
2277 }
2278 
2279 inline void extract_first_but_not_second(const Matches& first, const Matches& second, Matches& result) {
2280  set_difference(first.begin(), first.end(),
2281  second.begin(), second.end(),
2282  inserter(result, result.begin()));
2283 }
2284 
2285 // --------------------------------------------------------------------------------
2286 
2287 // #define TEST_INDEX_COMPLETENESS // only uncomment temporarily (slow as hell)
2288 
2289 #if defined(TEST_INDEX_COMPLETENESS)
2290 
2291 void TEST_SLOW_find_unmatched_probes() {
2292  bool use_gene_ptserver = false;
2293 
2294  // get all 20mers indexed in ptserver:
2295  ConstStrArray fullProbes;
2296  {
2297  const char *arguments[] = {
2298  "prgnamefake",
2299  "iterate=20",
2300  "iterate_amount=1000000",
2301  "iterate_tu=U",
2302  };
2303  TEST_RUN_ARB_PROBE(ARRAY_ELEMS(arguments), arguments);
2304 
2305  GBT_splitNdestroy_string(fullProbes, answer, ";", false);
2306  TEST_EXPECT_EQUAL(fullProbes.size(), 2040);
2307  }
2308 
2309  for (size_t lp = 0; lp<fullProbes.size(); ++lp) { // with all 20mers existing in ptserver
2310  const char *fullProbe = fullProbes[lp];
2311 
2312  size_t fullLen = strlen(fullProbe);
2313  TEST_EXPECT_EQUAL(fullLen, 20);
2314 
2315  Matches fullHits;
2316  getMatches(fullProbe, fullHits);
2317  TEST_EXPECT(fullHits.size()>0);
2318 
2319  bool fewerHitsSeen = false;
2320 
2321  for (size_t subLen = fullLen-1; !fewerHitsSeen && subLen >= 10; --subLen) { // for each partial sub-probe of 20mer
2322  char subProbe[20];
2323  subProbe[subLen] = 0;
2324 
2325  for (size_t pos = 0; pos+subLen <= fullLen; ++pos) {
2326  Matches subHits, onlyFull;
2327 
2328  memcpy(subProbe, fullProbe+pos, subLen);
2329  getMatches(subProbe, subHits);
2330  extract_first_but_not_second(fullHits, subHits, onlyFull);
2331 
2332  if (!onlyFull.empty()) {
2333  fprintf(stderr, "TEST_PARTIAL_COVERS_FULL_PROBE__BROKEN(\"%s\", \"%s\");\n", subProbe, fullProbe);
2334  fewerHitsSeen = true; // only list first wrong hit for each fullProbe
2335  }
2336  }
2337  }
2338  }
2339 }
2340 
2341 #endif
2342 // --------------------------------------------------------------------------------
2343 
2344 static arb_test::match_expectation partial_covers_full_probe(const char *part, const char *full) {
2345  using namespace arb_test;
2346  using namespace std;
2347 
2348  expectation_group expected;
2349  expected.add(that(strstr(full, part)).does_differ_from_NULL());
2350  expected.add(that(strlen(part)).is_less_than(strlen(full)));
2351 
2352  {
2353  Matches matchFull, matchPart;
2354  getMatches(full, matchFull);
2355  getMatches(part, matchPart);
2356 
2357  expected.add(that(matchFull.empty()).is_equal_to(false));
2358 
2359  Matches onlyFirst;
2360  extract_first_but_not_second(matchFull, matchPart, onlyFirst);
2361 
2362  string only_hit_by_full = matches2hitlist(onlyFirst);
2363  expected.add(that(only_hit_by_full).is_equal_to(""));
2364  }
2365 
2366 
2367  return all().ofgroup(expected);
2368 }
2369 
2370 #define TEST_PARTIAL_COVERS_FULL_PROBE(part,full) TEST_EXPECTATION(partial_covers_full_probe(part, full))
2371 #define TEST_PARTIAL_COVERS_FULL_PROBE__BROKEN(part,full) TEST_EXPECTATION__BROKEN(partial_covers_full_probe(part, full))
2372 
2373 void TEST_SLOW_unmatched_probes() {
2374  TEST_PARTIAL_COVERS_FULL_PROBE("CCUCCUUUCU", "GAUUAAUACCCCUCCUUUCU");
2375 
2376  TEST_PARTIAL_COVERS_FULL_PROBE("CGGUUGGAUC", "GGGGAACCUGCGGUUGGAUC");
2377  TEST_PARTIAL_COVERS_FULL_PROBE("CGGUUGGAUCA", "GGGAACCUGCGGUUGGAUCA");
2378  TEST_PARTIAL_COVERS_FULL_PROBE("CGGUUGGAUCAC", "GGAACCUGCGGUUGGAUCAC");
2379  TEST_PARTIAL_COVERS_FULL_PROBE("CGGUUGGAUCACC", "GAACCUGCGGUUGGAUCACC");
2380  TEST_PARTIAL_COVERS_FULL_PROBE("CGGUUGGAUCACCU", "AACCUGCGGUUGGAUCACCU");
2381  TEST_PARTIAL_COVERS_FULL_PROBE("CGGUUGGAUCACCUC", "ACCUGCGGUUGGAUCACCUC");
2382  TEST_PARTIAL_COVERS_FULL_PROBE("CGGUUGGAUCACCUCC", "CCUGCGGUUGGAUCACCUCC");
2383  TEST_PARTIAL_COVERS_FULL_PROBE("CGGUUGGAUCACCUCCU", "CUGCGGUUGGAUCACCUCCU");
2384  TEST_PARTIAL_COVERS_FULL_PROBE("CGGUUGGAUCACCUCCUU", "UGCGGUUGGAUCACCUCCUU");
2385  TEST_PARTIAL_COVERS_FULL_PROBE("CGGUUGGAUCACCUCCUUA", "GCGGUUGGAUCACCUCCUUA");
2386 
2387  TEST_PARTIAL_COVERS_FULL_PROBE("GCGCUGGAUC", "GGGGAACCUGGCGCUGGAUC");
2388  TEST_PARTIAL_COVERS_FULL_PROBE("GCGCUGGAUCA", "GGGAACCUGGCGCUGGAUCA");
2389  TEST_PARTIAL_COVERS_FULL_PROBE("GCGCUGGAUCAC", "GGAACCUGGCGCUGGAUCAC");
2390  TEST_PARTIAL_COVERS_FULL_PROBE("GCGCUGGAUCACC", "GAACCUGGCGCUGGAUCACC");
2391  TEST_PARTIAL_COVERS_FULL_PROBE("GCGCUGGAUCACCU", "AACCUGGCGCUGGAUCACCU");
2392  TEST_PARTIAL_COVERS_FULL_PROBE("GCGCUGGAUCACCUC", "ACCUGGCGCUGGAUCACCUC");
2393  TEST_PARTIAL_COVERS_FULL_PROBE("GCGCUGGAUCACCUCC", "CCUGGCGCUGGAUCACCUCC");
2394  TEST_PARTIAL_COVERS_FULL_PROBE("GCGCUGGAUCACCUCCU", "CUGGCGCUGGAUCACCUCCU");
2395  TEST_PARTIAL_COVERS_FULL_PROBE("GCGCUGGAUCACCUCCUU", "UGGCGCUGGAUCACCUCCUU");
2396  TEST_PARTIAL_COVERS_FULL_PROBE("GCGCUGGAUCACCUCCUUU", "GGCGCUGGAUCACCUCCUUU");
2397 
2398  TEST_PARTIAL_COVERS_FULL_PROBE("GCUGGAUCAC", "GGAACCUGCGGCUGGAUCAC");
2399  TEST_PARTIAL_COVERS_FULL_PROBE("GCUGGAUCACC", "GAACCUGCGGCUGGAUCACC");
2400  TEST_PARTIAL_COVERS_FULL_PROBE("GCUGGAUCACCU", "AACCUGCGGCUGGAUCACCU");
2401  TEST_PARTIAL_COVERS_FULL_PROBE("GCUGGAUCACCUC", "ACCUGCGGCUGGAUCACCUC");
2402  TEST_PARTIAL_COVERS_FULL_PROBE("GCUGGAUCACCUCC", "CCUGCGGCUGGAUCACCUCC");
2403  TEST_PARTIAL_COVERS_FULL_PROBE("GCUGGAUCACCUCCU", "CUGCGGCUGGAUCACCUCCU");
2404  TEST_PARTIAL_COVERS_FULL_PROBE("GCUGGAUCACCUCCUU", "UGCGGCUGGAUCACCUCCUU");
2405  TEST_PARTIAL_COVERS_FULL_PROBE("GCUGGAUCACCUCCUUU", "GCGGCUGGAUCACCUCCUUU");
2406  TEST_PARTIAL_COVERS_FULL_PROBE("GCUGGAUCACCUCCUUUC", "CGGCUGGAUCACCUCCUUUC");
2407 
2408  // the data of the following tests is located right in front of the dots inserted in [8962]
2409  TEST_PARTIAL_COVERS_FULL_PROBE("UUUGAUCAAG", "AAUUGAAGAGUUUGAUCAAG");
2410  TEST_PARTIAL_COVERS_FULL_PROBE("UUUGAUCAAGU", "AUUGAAGAGUUUGAUCAAGU");
2411  TEST_PARTIAL_COVERS_FULL_PROBE("UUUGAUCAAGUC", "UUGAAGAGUUUGAUCAAGUC");
2412  TEST_PARTIAL_COVERS_FULL_PROBE("UUUGAUCAAGUCG", "UGAAGAGUUUGAUCAAGUCG");
2413  TEST_PARTIAL_COVERS_FULL_PROBE("UUUGAUCAAGUCGA", "GAAGAGUUUGAUCAAGUCGA");
2414  TEST_PARTIAL_COVERS_FULL_PROBE("UUUGAUCAAGUCGAG", "AAGAGUUUGAUCAAGUCGAG");
2415  TEST_PARTIAL_COVERS_FULL_PROBE("UUUGAUCAAGUCGAGC", "AGAGUUUGAUCAAGUCGAGC");
2416  TEST_PARTIAL_COVERS_FULL_PROBE("UUUGAUCAAGUCGAGCG", "GAGUUUGAUCAAGUCGAGCG");
2417  TEST_PARTIAL_COVERS_FULL_PROBE("UUUGAUCAAGUCGAGCGG", "AGUUUGAUCAAGUCGAGCGG");
2418  TEST_PARTIAL_COVERS_FULL_PROBE("UUUGAUCAAGUCGAGCGGU", "GUUUGAUCAAGUCGAGCGGU");
2419 }
2420 
2421 void TEST_SLOW_variable_defaults_in_server() {
2422  test_setup(false);
2423 
2424  const char *server_tag = GBS_ptserver_tag(TEST_SERVER_ID);
2426 
2427  const char *servername = GBS_read_arb_tcp(server_tag);
2428  {
2429  char *socketname = GBS_global_string_copy(":%s", GB_path_in_ARBHOME("UNIT_TESTER/sok/pt.socket"));
2430  TEST_EXPECT_EQUAL(servername, socketname); // as defined in ../lib/arb_tcp_org.dat@ARB_TEST_PT_SERVER
2431  free(socketname);
2432  }
2433 
2434  T_PT_MAIN com;
2435  T_PT_LOCS locs;
2436  GB_ERROR error = NULp;
2437  aisc_com *link = aisc_open(servername, com, AISC_MAGIC_NUMBER, &error);
2438  TEST_EXPECT_NO_ERROR(error);
2439  TEST_REJECT_NULL(link);
2440 
2441  TEST_EXPECT_ZERO(aisc_create(link, PT_MAIN, com,
2442  MAIN_LOCS, PT_LOCS, locs,
2443  NULp));
2444 
2445  {
2446 #define LOCAL(rvar) prev_read_##rvar
2447 
2448 
2449 #define FREE_LOCAL_long(rvar)
2450 #define FREE_LOCAL_charp(rvar) free(LOCAL(rvar))
2451 #define FREE_LOCAL(type,rvar) FREE_LOCAL_##type(rvar)
2452 
2453 #define TEST__READ(type,rvar,expected) \
2454  do { \
2455  TEST_EXPECT_ZERO(aisc_get(link, PT_LOCS, locs, rvar, &(LOCAL(rvar)), NULp)); \
2456  TEST_EXPECT_EQUAL(LOCAL(rvar), expected); \
2457  FREE_LOCAL(type,rvar); \
2458  } while(0)
2459 #define TEST_WRITE(type,rvar,val) \
2460  TEST_EXPECT_ZERO(aisc_put(link, PT_LOCS, locs, rvar, (type)val, NULp))
2461 #define TEST_CHANGE(type,rvar,val) \
2462  do { \
2463  TEST_WRITE(type, rvar, val); \
2464  TEST__READ(type, rvar, val); \
2465  } while(0)
2466 #define TEST_DEFAULT_CHANGE(ctype,type,remote_variable,default_value,other_value) \
2467  do { \
2468  ctype DEFAULT_VALUE = default_value; \
2469  ctype OTHER_VALUE = other_value; \
2470  type LOCAL(remote_variable); \
2471  TEST__READ(type, remote_variable, DEFAULT_VALUE); \
2472  TEST_CHANGE(type, remote_variable, OTHER_VALUE); \
2473  TEST_CHANGE(type, remote_variable, DEFAULT_VALUE); \
2474  } while(0)
2475 
2476  TEST_DEFAULT_CHANGE(const long, long, LOCS_MATCH_ALSO_REVCOMP, 1, 67);
2477  typedef char *charp;
2478  typedef const char *ccharp;
2479  TEST_DEFAULT_CHANGE(ccharp, charp, LOCS_LOGINTIME, "notime", "sometime");
2480  }
2481 
2482  TEST_EXPECT_ZERO(aisc_close(link, com));
2483  link = NULp;
2484 }
2485 
2486 #endif // UNIT_TESTS
#define arb_assert(cond)
Definition: arb_assert.h:245
int MINTEMP
Definition: arb_probe.cxx:39
static const char * AP_probe_pt_look_for_server(ARB_ERROR &error)
Definition: arb_probe.cxx:97
string result
int MAXBOND
Definition: arb_probe.cxx:43
int MISMATCHES
Definition: arb_probe.cxx:49
int ARB_main(int argc, char *argv[])
Definition: arb_probe.cxx:599
group_matcher all()
Definition: test_unit.h:1000
const char * DESIGNSEQUENCE
Definition: arb_probe.cxx:37
int MINGC
Definition: arb_probe.cxx:41
size_t size() const
Definition: arb_strarray.h:85
#define is_less_than(val)
Definition: test_unit.h:1020
#define implicated(hypothesis, conclusion)
Definition: arb_assert.h:289
return string(buffer, length)
const char * ITERATE_TU
Definition: arb_probe.cxx:62
static char * AP_probe_design_event(ARB_ERROR &error)
Definition: arb_probe.cxx:242
const char * ITERATE_SEPARATOR
Definition: arb_probe.cxx:61
int aisc_close(aisc_com *link, AISC_Object &object)
Definition: client.c:249
#define TEST_SETUP_GLOBAL_ENVIRONMENT(modulename)
Definition: test_unit.h:1459
#define AISC_MAX_STRING_LEN
Definition: client_privat.h:28
char * ARB_strdup(const char *str)
Definition: arb_string.h:27
int SERVERID
Definition: arb_probe.cxx:33
int WEIGHTED
Definition: arb_probe.cxx:54
GB_ERROR arb_look_and_start_server(long magic_number, const char *arb_tcp_env)
int MAXPOS
Definition: arb_probe.cxx:45
static int init_local_com_struct()
Definition: arb_probe.cxx:84
int aisc_nput(aisc_com *link, int o_type, const AISC_Object &object,...)
Definition: client.c:564
static char * AP_dump_index_event(ARB_ERROR &error)
Definition: arb_probe.cxx:154
STL namespace.
char * release()
Definition: arb_strbuf.h:80
void cat(const char *from)
Definition: arb_strbuf.h:158
#define EXIT_SUCCESS
Definition: arb_a2ps.c:154
AISC_Object com
Definition: servercntrl.cxx:58
const char * DESIGNNAMES
Definition: arb_probe.cxx:34
#define ARRAY_ELEMS(array)
Definition: arb_defs.h:19
int DESIGNMAXPROBELEN
Definition: arb_probe.cxx:36
static const char * getString(const char *param, const char *val, const char *description)
Definition: arb_probe.cxx:433
apd_sequence * next
Definition: arb_probe.cxx:27
int MINTARGETS
Definition: arb_probe.cxx:47
static char * AP_probe_match_event(ARB_ERROR &error)
Definition: arb_probe.cxx:344
const char * sequence
Definition: arb_probe.cxx:28
GBS_strstruct * GBS_stropen(long init_size)
Definition: arb_strbuf.cxx:39
int aisc_put(aisc_com *link, int o_type, const AISC_Object &object,...)
Definition: client.c:539
int LIMITN
Definition: arb_probe.cxx:51
GB_ERROR GB_await_error()
Definition: arb_msg.cxx:353
#define TEST_EXPECT(cond)
Definition: test_unit.h:1313
const char * GBS_read_arb_tcp(const char *env)
Definition: adtcp.cxx:325
GB_ERROR deliver() const
Definition: arb_error.h:114
TYPE * ARB_alloc(size_t nelem)
Definition: arb_mem.h:56
static const char ** pargv
Definition: arb_probe.cxx:386
int MAXRESULT
Definition: arb_probe.cxx:52
T_PT_MAIN com
char * data
Definition: bytestring.h:16
#define false
Definition: ureadseq.h:13
int ITERATE_AMOUNT
Definition: arb_probe.cxx:59
static bool parseCommandLine(int argc, const char *const *const argv)
Definition: arb_probe.cxx:460
#define TEST_REJECT_NULL(n)
Definition: test_unit.h:1310
void GBS_strcat(GBS_strstruct *strstr, const char *ptr)
Definition: arb_strbuf.cxx:108
static void error(const char *msg)
Definition: mkptypes.cxx:96
GB_CSTR GB_path_in_ARBHOME(const char *relative_path)
Definition: adsocket.cxx:1121
void expect_no_error() const
Definition: arb_error.h:136
void GBT_splitNdestroy_string(ConstStrArray &names, char *&namelist, const char *separator, bool dropEmptyTokens)
expectation_group & add(const expectation &e)
Definition: test_unit.h:801
#define that(thing)
Definition: test_unit.h:1032
#define TEST_EXPECT_ZERO_OR_SHOW_ERRNO(iocond)
Definition: test_unit.h:1079
int MISHIT
Definition: arb_probe.cxx:46
#define does_differ_from_NULL()
Definition: test_unit.h:1018
aisc_com * link
Definition: servercntrl.cxx:57
#define EXIT_FAILURE
Definition: arb_a2ps.c:157
#define is_equal_to(val)
Definition: test_unit.h:1014
static char * execute(ARB_ERROR &error)
Definition: arb_probe.cxx:581
T_PT_MAIN com
Definition: arb_probe.cxx:70
static bool showhelp
Definition: arb_probe.cxx:387
#define TEST_EXPECT_ZERO(cond)
Definition: test_unit.h:1074
#define __ATTR__REDUCED_OPTIMIZE
Definition: test_unit.h:83
#define AISC_MAGIC_NUMBER
Definition: client_privat.h:51
void GBS_chrcat(GBS_strstruct *strstr, char ch)
Definition: arb_strbuf.cxx:119
fputs(TRACE_PREFIX, stderr)
static int getInt(const char *param, int val, int min, int max, const char *description)
Definition: arb_probe.cxx:390
T_PT_LOCS locs
int MINPOS
Definition: arb_probe.cxx:44
GB_CSTR GB_getenvUSER(void)
Definition: adsocket.cxx:531
const char * DUMP
Definition: arb_probe.cxx:64
aisc_com * link
aisc_com * aisc_open(const char *path, AISC_Object &main_obj, long magic, GB_ERROR *error)
Definition: client.c:205
static char * AP_probe_iterate_event(ARB_ERROR &error)
Definition: arb_probe.cxx:175
T_PT_LOCS locs
Definition: arb_probe.cxx:71
static char eol[3]
char * GBS_strclose(GBS_strstruct *strstr)
Definition: arb_strbuf.cxx:69
const char * GBS_static_string(const char *str)
Definition: arb_msg.cxx:213
int ALSO_REVCOMPL
Definition: arb_probe.cxx:53
#define TEST_EXPECT_NO_ERROR(call)
Definition: test_unit.h:1107
#define NULp
Definition: cxxforward.h:97
int DESIGNCLIPOUTPUT
Definition: arb_probe.cxx:32
int aisc_get(aisc_com *link, int o_type, const AISC_Object &object,...)
Definition: client.c:266
int ITERATE
Definition: arb_probe.cxx:58
static int pargc
Definition: arb_probe.cxx:385
PTserverConnection(ARB_ERROR &error)
Definition: arb_probe.cxx:115
std::string extract(const std::string &s) const
Definition: RegExpr.hxx:54
static bool outOfRange
Definition: arb_probe.cxx:388
const char * SEQUENCE
Definition: arb_probe.cxx:48
int MAXTEMP
Definition: arb_probe.cxx:40
int ACCEPTN
Definition: arb_probe.cxx:50
const char * GBS_ptserver_tag(int id)
Definition: adtcp.cxx:312
int MAXGC
Definition: arb_probe.cxx:42
size_t length
int DESIGNPROBELEN
Definition: arb_probe.cxx:35
#define min(a, b)
Definition: f2c.h:153
#define TEST_EXPECT_TEXTFILES_EQUAL(fgot, fwant)
Definition: test_unit.h:1396
static Params P
Definition: arb_probe.cxx:81
int ITERATE_READABLE
Definition: arb_probe.cxx:60
#define TEST_EXPECT_EQUAL(expr, want)
Definition: test_unit.h:1283
int pd_design_id
Definition: arb_probe.cxx:72
apd_sequence * sequence
Definition: arb_probe.cxx:56
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
Target
Definition: NT_taxonomy.cxx:42
char * GBS_global_string_copy(const char *templat,...)
Definition: arb_msg.cxx:195
void put(char c)
Definition: arb_strbuf.h:138
static gl_struct pd_gl
Definition: arb_probe.cxx:82
#define max(a, b)
Definition: f2c.h:154
GB_write_int const char s
Definition: AW_awar.cxx:156