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