33{
34 int failures = 0, testNum = 0;
36
37
38
39
40 check(failures, ++testNum, "foundInReference(none)", false,
42 check(failures, ++testNum, "foundInReference(match)", true,
44 check(failures, ++testNum, "foundInReference(mismatch)", true,
46 check(failures, ++testNum, "foundInReference(insert)", false,
48 check(failures, ++testNum, "foundInReference(del)", true,
50 check(failures, ++testNum, "foundInReference(skip)", true,
52 check(failures, ++testNum, "foundInReference(softClip)", false,
54 check(failures, ++testNum, "foundInReference(hardClip)", false,
56 check(failures, ++testNum, "foundInReference(pad)", false,
58
59 check(failures, ++testNum,
61 check(failures, ++testNum,
63 check(failures, ++testNum,
65 check(failures, ++testNum,
67 check(failures, ++testNum,
69 check(failures, ++testNum,
71 check(failures, ++testNum,
73 check(failures, ++testNum,
75 check(failures, ++testNum,
77 check(failures, ++testNum,
79 check(failures, ++testNum,
81
82 op.count = 3;
84 check(failures, ++testNum, "foundInReference(none)", false,
87 check(failures, ++testNum, "foundInReference(match)", true,
90 check(failures, ++testNum, "foundInReference(mismatch)", true,
93 check(failures, ++testNum, "foundInReference(insert)", false,
96 check(failures, ++testNum, "foundInReference(del)", true,
99 check(failures, ++testNum, "foundInReference(skip)", true,
102 check(failures, ++testNum, "foundInReference(softClip)", false,
105 check(failures, ++testNum, "foundInReference(hardClip)", false,
108 check(failures, ++testNum, "foundInReference(pad)", false,
110
111
112
113 check(failures, ++testNum, "foundInQuery(none)", false,
115 check(failures, ++testNum, "foundInQuery(match)", true,
117 check(failures, ++testNum, "foundInQuery(mismatch)", true,
119 check(failures, ++testNum, "foundInQuery(insert)", true,
121 check(failures, ++testNum, "foundInQuery(del)", false,
123 check(failures, ++testNum, "foundInQuery(skip)", false,
125 check(failures, ++testNum, "foundInQuery(softClip)", true,
127 check(failures, ++testNum, "foundInQuery(hardClip)", false,
129 check(failures, ++testNum, "foundInQuery(pad)", false,
131
132 check(failures, ++testNum,
134 check(failures, ++testNum,
136 check(failures, ++testNum,
138 check(failures, ++testNum,
140 check(failures, ++testNum,
142 check(failures, ++testNum,
144 check(failures, ++testNum,
146 check(failures, ++testNum,
148 check(failures, ++testNum,
150 check(failures, ++testNum,
152 check(failures, ++testNum,
154
155 op.count = 3;
157 check(failures, ++testNum, "foundInQuery(none)", false,
160 check(failures, ++testNum, "foundInQuery(match)", true,
163 check(failures, ++testNum, "foundInQuery(mismatch)", true,
166 check(failures, ++testNum, "foundInQuery(insert)", true,
169 check(failures, ++testNum, "foundInQuery(del)", false,
172 check(failures, ++testNum, "foundInQuery(skip)", false,
175 check(failures, ++testNum, "foundInQuery(softClip)", true,
178 check(failures, ++testNum, "foundInQuery(hardClip)", false,
181 check(failures, ++testNum, "foundInQuery(pad)", false,
183
184
185
186
187 check(failures, ++testNum, "isClip(none)", false,
189 check(failures, ++testNum, "isClip(match)", false,
191 check(failures, ++testNum, "isClip(mismatch)", false,
193 check(failures, ++testNum, "isClip(insert)", false,
195 check(failures, ++testNum, "isClip(del)", false,
197 check(failures, ++testNum, "isClip(skip)", false,
199 check(failures, ++testNum, "isClip(softClip)", true,
201 check(failures, ++testNum, "isClip(hardClip)", true,
203 check(failures, ++testNum, "isClip(pad)", false,
205
206 check(failures, ++testNum,
208 check(failures, ++testNum,
210 check(failures, ++testNum,
212 check(failures, ++testNum,
214 check(failures, ++testNum,
216 check(failures, ++testNum,
218 check(failures, ++testNum,
220 check(failures, ++testNum,
222 check(failures, ++testNum,
224 check(failures, ++testNum,
226 check(failures, ++testNum,
228
229 op.count = 3;
231 check(failures, ++testNum, "isClip(none)", false,
234 check(failures, ++testNum, "isClip(match)", false,
237 check(failures, ++testNum, "isClip(mismatch)", false,
240 check(failures, ++testNum, "isClip(insert)", false,
243 check(failures, ++testNum, "isClip(del)", false,
246 check(failures, ++testNum, "isClip(skip)", false,
249 check(failures, ++testNum, "isClip(softClip)", true,
252 check(failures, ++testNum, "isClip(hardClip)", true,
255 check(failures, ++testNum, "isClip(pad)", false,
257
258
259
260
261
262
263
264
265
267
268
270 std::string result;
271
273 result = str.c_str();
274
275
276 check(failures, ++testNum, "constructor", result, "");
277
279 op.count = 10;
280
281 cigar += op;
282
283 op.count=5;
284
285 cigar += op;
286
288
289 cigar += op;
290
292
293 cigar += op;
294
296
297 cigar += op;
298
300
301 cigar += op;
302
304
305 cigar += op;
306
308
309 cigar += op;
310
312
313 cigar += op;
314
316
317 cigar += op;
318
320
321 cigar += op;
322
324
325 cigar += op;
326
328 result = str.c_str();
329
330
331 check(failures, ++testNum, "match combining", "20M10I5D10M5N5M2P3M", result);
332 check(failures, ++testNum,
"length check", 8, cigar.
size());
333
334
335
336
337
338
339
340 check(failures, ++testNum,
"getRefOffset(20)", -1, cigar.
getRefOffset(20));
341 check(failures, ++testNum,
"getRefOffset(30)", 25, cigar.
getRefOffset(30));
342 check(failures, ++testNum,
"getRefOffset(46)", 46, cigar.
getRefOffset(46));
343 check(failures, ++testNum,
"getRefOffset(0)", 0, cigar.
getRefOffset(0));
344 check(failures, ++testNum,
"getRefPosition(20, 5)", -1, cigar.
getRefPosition(20, 5));
345 check(failures, ++testNum,
"getRefPosition(30, 5)", 30, cigar.
getRefPosition(30, 5));
346 check(failures, ++testNum,
"getRefPosition(46, 5)", 51, cigar.
getRefPosition(46, 5));
347 check(failures, ++testNum,
"getRefPosition(0, 5)", 5, cigar.
getRefPosition(0, 5));
349 check(failures, ++testNum,
"getQueryIndex(30)", 35, cigar.
getQueryIndex(30));
351 check(failures, ++testNum,
"getQueryIndex(46)", 46, cigar.
getQueryIndex(46));
352 check(failures, ++testNum,
"getQueryIndex(0)", 0, cigar.
getQueryIndex(0));
353 check(failures, ++testNum,
"getQueryIndex(25, 5)", -1, cigar.
getQueryIndex(20));
354 check(failures, ++testNum,
"getQueryIndex(35, 5)", 35, cigar.
getQueryIndex(30));
355 check(failures, ++testNum,
"getQueryIndex(40, 5)", -1, cigar.
getQueryIndex(35));
356 check(failures, ++testNum,
"getQueryIndex(51, 5)", 46, cigar.
getQueryIndex(46));
357 check(failures, ++testNum,
"getQueryIndex(5, 5)", 0, cigar.
getQueryIndex(0));
358
359 int i = 0;
360 int queryIndex = 0;
361 int refOffset = 0;
362
363 for(i = 0; i < 20; i++)
364 {
365 check(failures, ++testNum,
"getRefOffset(queryIndex)", refOffset, cigar.
getRefOffset(queryIndex));
366 check(failures, ++testNum,
"getQueryIndex(refOffset)", queryIndex, cigar.
getQueryIndex(refOffset));
367 check(failures, ++testNum,
"getRefPosition(queryIndex, 5)", refOffset + 5, cigar.
getRefPosition(queryIndex, 5));
368 check(failures, ++testNum,
"getQueryIndex(refPosition, 5)", queryIndex, cigar.
getQueryIndex(refOffset + 5, 5));
369 ++queryIndex;
370 ++refOffset;
371 }
372
373 for(i = 0; i < 10; i++)
374 {
375 check(failures, ++testNum,
"getRefOffset(queryIndex)", -1, cigar.
getRefOffset(queryIndex));
376 check(failures, ++testNum,
"getRefPosition(queryIndex, 5)", -1, cigar.
getRefPosition(queryIndex, 5));
377 ++queryIndex;
378 }
379
380 for(i = 0; i < 5; i++)
381 {
382 check(failures, ++testNum,
"getQueryIndex(refOffset)", -1, cigar.
getQueryIndex(refOffset));
383 check(failures, ++testNum,
"getQueryIndex(refPosition, 5)", -1, cigar.
getQueryIndex(refOffset + 5, 5));
384 refOffset++;
385 }
386
387 for(i = 0; i < 10; i++)
388 {
389 check(failures, ++testNum,
"getRefOffset(queryIndex)", refOffset, cigar.
getRefOffset(queryIndex));
390 check(failures, ++testNum,
"getQueryIndex(refOffset)", queryIndex, cigar.
getQueryIndex(refOffset));
391 check(failures, ++testNum,
"getRefPosition(queryIndex, 5)", refOffset + 5, cigar.
getRefPosition(queryIndex, 5));
392 check(failures, ++testNum,
"getQueryIndex(refPosition, 5)", queryIndex, cigar.
getQueryIndex(refOffset + 5, 5));
393 ++queryIndex;
394 ++refOffset;
395 }
396
397 for(i = 0; i < 5; i++)
398 {
399 check(failures, ++testNum,
"getQueryIndex(refOffset)", -1, cigar.
getQueryIndex(refOffset));
400 check(failures, ++testNum,
"getQueryIndex(refPosition, 5)", -1, cigar.
getQueryIndex(refOffset + 5, 5));
401 refOffset++;
402 }
403
404 for(i = 0; i < 5; i++)
405 {
406 check(failures, ++testNum,
"getRefOffset(queryIndex)", refOffset, cigar.
getRefOffset(queryIndex));
407 check(failures, ++testNum,
"getQueryIndex(refOffset)", queryIndex, cigar.
getQueryIndex(refOffset));
408 check(failures, ++testNum,
"getRefPosition(queryIndex, 5)", refOffset + 5, cigar.
getRefPosition(queryIndex, 5));
409 check(failures, ++testNum,
"getQueryIndex(refPosition, 5)", queryIndex, cigar.
getQueryIndex(refOffset + 5, 5));
410 ++queryIndex;
411 ++refOffset;
412 }
413
414
415 for(i = 0; i < 3; i++)
416 {
417 check(failures, ++testNum,
"getRefOffset(queryIndex)", refOffset, cigar.
getRefOffset(queryIndex));
418 check(failures, ++testNum,
"getQueryIndex(refOffset)", queryIndex, cigar.
getQueryIndex(refOffset));
419 check(failures, ++testNum,
"getRefPosition(queryIndex, 5)", refOffset + 5, cigar.
getRefPosition(queryIndex, 5));
420 check(failures, ++testNum,
"getQueryIndex(refPosition, 5)", queryIndex, cigar.
getQueryIndex(refOffset + 5, 5));
421 ++queryIndex;
422 ++refOffset;
423 }
424
425
426 check(failures, ++testNum,
"getRefOffset(queryIndex)", -1, cigar.
getRefOffset(queryIndex));
427 check(failures, ++testNum,
"getQueryIndex(refOffset)", -1, cigar.
getQueryIndex(refOffset));
428 check(failures, ++testNum,
"getRefPosition(queryIndex, 5)", -1, cigar.
getRefPosition(queryIndex, 5));
429 check(failures, ++testNum,
"getQueryIndex(refPosition, 5)", -1, cigar.
getQueryIndex(refOffset + 5, 5));
430 ++queryIndex;
431 ++refOffset;
432 check(failures, ++testNum,
"getRefOffset(queryIndex)", -1, cigar.
getRefOffset(queryIndex));
433 check(failures, ++testNum,
"getQueryIndex(refOffset)", -1, cigar.
getQueryIndex(refOffset));
434 check(failures, ++testNum,
"getRefPosition(queryIndex, 5)", -1, cigar.
getRefPosition(queryIndex, 5));
435 check(failures, ++testNum,
"getQueryIndex(refPosition, 5)", -1, cigar.
getQueryIndex(refOffset + 5, 5));
436
437
438
439
440
441
442
443
444 check(failures, ++testNum,
"getNumOverlaps(1, 5, 5)", (uint32_t)0, cigar.
getNumOverlaps(1, 5, 5));
445
446
447 check(failures, ++testNum,
"getNumOverlaps(53, 101, 5)", (uint32_t)0, cigar.
getNumOverlaps(53, 101, 5));
448
449
450 check(failures, ++testNum,
"getNumOverlaps(53, 10, 5)", (uint32_t)0, cigar.
getNumOverlaps(53, 10, 5));
451
452
453 check(failures, ++testNum,
"getNumOverlaps(35, 10, 5)", (uint32_t)0, cigar.
getNumOverlaps(35, 10, 5));
454
455
456 check(failures, ++testNum,
"getNumOverlaps(35, 1, 5)", (uint32_t)0, cigar.
getNumOverlaps(35, 1, 5));
457
458
459 check(failures, ++testNum,
"getNumOverlaps(1, 6, 5)", (uint32_t)1, cigar.
getNumOverlaps(1, 6, 5));
460
461
462 check(failures, ++testNum,
"getNumOverlaps(25, 30, 5)", (uint32_t)0, cigar.
getNumOverlaps(25, 30, 5));
463
464
465 check(failures, ++testNum,
"getNumOverlaps(24, 30, 5)", (uint32_t)1, cigar.
getNumOverlaps(24, 30, 5));
466
467
468 check(failures, ++testNum,
"getNumOverlaps(25, 31, 5)", (uint32_t)1, cigar.
getNumOverlaps(25, 31, 5));
469
470
471 check(failures, ++testNum,
"getNumOverlaps(1, 31, 5)", (uint32_t)21, cigar.
getNumOverlaps(1, 31, 5));
472
473
474 check(failures, ++testNum,
"getNumOverlaps(1, 101, 5)", (uint32_t)38, cigar.
getNumOverlaps(1, 101, 5));
475
476
477 check(failures, ++testNum,
"getNumOverlaps(-1, -1, 5)", (uint32_t)38, cigar.
getNumOverlaps(-1, -1, 5));
478
479
480 check(failures, ++testNum,
"getNumOverlaps(6, 52, 5)", (uint32_t)36, cigar.
getNumOverlaps(6, 52, 5));
481
482
483 check(failures, ++testNum,
"getNumOverlaps(40, 45, 5)", (uint32_t)0, cigar.
getNumOverlaps(40, 45, 5));
484
485
486 check(failures, ++testNum,
"getNumOverlaps(-1, 10, 5)", (uint32_t)5, cigar.
getNumOverlaps(-1, 10, 5));
487
488
489 check(failures, ++testNum,
"getNumOverlaps(50, -1, 5)", (uint32_t)3, cigar.
getNumOverlaps(50, -1, 5));
490
491
492
493 cigar.
Set(
"4M10N4M3I2M4D3M");
494 String expectedResult =
"4M10N4M3I2M4D3M";
495 String cigarString =
"HI";
497 check(failures, ++testNum, "getCigarString", expectedResult, cigarString);
498
499
500
501
502
503
504
505
506
507
508
509
510
543
544
577
578
611
612
613 check(failures, ++testNum,
"getCigarCharOp(-1)",
'?', cigar.
getCigarCharOp(-1));
614 check(failures, ++testNum,
"getCigarCharOp(0)",
'M', cigar.
getCigarCharOp(0));
615 check(failures, ++testNum,
"getCigarCharOp(1)",
'M', cigar.
getCigarCharOp(1));
616 check(failures, ++testNum,
"getCigarCharOp(2)",
'M', cigar.
getCigarCharOp(2));
617 check(failures, ++testNum,
"getCigarCharOp(3)",
'M', cigar.
getCigarCharOp(3));
618 check(failures, ++testNum,
"getCigarCharOp(4)",
'N', cigar.
getCigarCharOp(4));
619 check(failures, ++testNum,
"getCigarCharOp(5)",
'N', cigar.
getCigarCharOp(5));
620 check(failures, ++testNum,
"getCigarCharOp(6)",
'N', cigar.
getCigarCharOp(6));
621 check(failures, ++testNum,
"getCigarCharOp(7)",
'N', cigar.
getCigarCharOp(7));
622 check(failures, ++testNum,
"getCigarCharOp(8)",
'N', cigar.
getCigarCharOp(8));
623 check(failures, ++testNum,
"getCigarCharOp(9)",
'N', cigar.
getCigarCharOp(9));
624 check(failures, ++testNum,
"getCigarCharOp(10)",
'N', cigar.
getCigarCharOp(10));
625 check(failures, ++testNum,
"getCigarCharOp(11)",
'N', cigar.
getCigarCharOp(11));
626 check(failures, ++testNum,
"getCigarCharOp(12)",
'N', cigar.
getCigarCharOp(12));
627 check(failures, ++testNum,
"getCigarCharOp(13)",
'N', cigar.
getCigarCharOp(13));
628 check(failures, ++testNum,
"getCigarCharOp(14)",
'M', cigar.
getCigarCharOp(14));
629 check(failures, ++testNum,
"getCigarCharOp(15)",
'M', cigar.
getCigarCharOp(15));
630 check(failures, ++testNum,
"getCigarCharOp(16)",
'M', cigar.
getCigarCharOp(16));
631 check(failures, ++testNum,
"getCigarCharOp(17)",
'M', cigar.
getCigarCharOp(17));
632 check(failures, ++testNum,
"getCigarCharOp(18)",
'I', cigar.
getCigarCharOp(18));
633 check(failures, ++testNum,
"getCigarCharOp(19)",
'I', cigar.
getCigarCharOp(19));
634 check(failures, ++testNum,
"getCigarCharOp(20)",
'I', cigar.
getCigarCharOp(20));
635 check(failures, ++testNum,
"getCigarCharOp(21)",
'M', cigar.
getCigarCharOp(21));
636 check(failures, ++testNum,
"getCigarCharOp(22)",
'M', cigar.
getCigarCharOp(22));
637 check(failures, ++testNum,
"getCigarCharOp(23)",
'D', cigar.
getCigarCharOp(23));
638 check(failures, ++testNum,
"getCigarCharOp(24)",
'D', cigar.
getCigarCharOp(24));
639 check(failures, ++testNum,
"getCigarCharOp(25)",
'D', cigar.
getCigarCharOp(25));
640 check(failures, ++testNum,
"getCigarCharOp(26)",
'D', cigar.
getCigarCharOp(26));
641 check(failures, ++testNum,
"getCigarCharOp(27)",
'M', cigar.
getCigarCharOp(27));
642 check(failures, ++testNum,
"getCigarCharOp(28)",
'M', cigar.
getCigarCharOp(28));
643 check(failures, ++testNum,
"getCigarCharOp(29)",
'M', cigar.
getCigarCharOp(29));
644 check(failures, ++testNum,
"getCigarCharOp(30)",
'?', cigar.
getCigarCharOp(30));
645
646
647
667
668
701
702
703
739
740
741
742
743
744
745 check(failures, ++testNum,
"getNumOverlaps(5,32,5)", (uint32_t)13, cigar.
getNumOverlaps(5,32,5));
746 check(failures, ++testNum,
"getNumOverlaps(5,31,5)", (uint32_t)12, cigar.
getNumOverlaps(5,31,5));
747 check(failures, ++testNum,
"getNumOverlaps(0,100,5)", (uint32_t)13, cigar.
getNumOverlaps(0,100,5));
748 check(failures, ++testNum,
"getNumOverlaps(-1, -1,5)", (uint32_t)13, cigar.
getNumOverlaps(-1, -1,5));
749 check(failures, ++testNum,
"getNumOverlaps(-1,10,5)", (uint32_t)4, cigar.
getNumOverlaps(-1,10,5));
750 check(failures, ++testNum,
"getNumOverlaps(10,-1,5)", (uint32_t)9, cigar.
getNumOverlaps(10,-1,5));
751 check(failures, ++testNum,
"getNumOverlaps(9,19,5)", (uint32_t)0, cigar.
getNumOverlaps(9,19,5));
752 check(failures, ++testNum,
"getNumOverlaps(9,20,5)", (uint32_t)1, cigar.
getNumOverlaps(9,20,5));
753 check(failures, ++testNum,
"getNumOverlaps(9,6,5)", (uint32_t)0, cigar.
getNumOverlaps(9,6,5));
754 check(failures, ++testNum,
"getNumOverlaps(0,5,5)", (uint32_t)0, cigar.
getNumOverlaps(0,5,5));
755 check(failures, ++testNum,
"getNumOverlaps(32,40,5)", (uint32_t)0, cigar.
getNumOverlaps(32,40,5));
756 check(failures, ++testNum,
"getNumOverlaps(0,5,1)", (uint32_t)4, cigar.
getNumOverlaps(0,5,1));
757 check(failures, ++testNum,
"getNumOverlaps(32,40,32)", (uint32_t)4, cigar.
getNumOverlaps(32,40,32));
758
759
760
761 check(failures, ++testNum,
"getQueryIndex(0)", 0, cigar.
getQueryIndex(0));
762 check(failures, ++testNum,
"getQueryIndex(1)", 1, cigar.
getQueryIndex(1));
763 check(failures, ++testNum,
"getQueryIndex(2)", 2, cigar.
getQueryIndex(2));
764 check(failures, ++testNum,
"getQueryIndex(3)", 3, cigar.
getQueryIndex(3));
765
766 check(failures, ++testNum,
"getQueryIndex(4)", -1, cigar.
getQueryIndex(4));
767 check(failures, ++testNum,
"getQueryIndex(5)", -1, cigar.
getQueryIndex(5));
768 check(failures, ++testNum,
"getQueryIndex(6)", -1, cigar.
getQueryIndex(6));
769 check(failures, ++testNum,
"getQueryIndex(7)", -1, cigar.
getQueryIndex(7));
770 check(failures, ++testNum,
"getQueryIndex(8)", -1, cigar.
getQueryIndex(8));
771 check(failures, ++testNum,
"getQueryIndex(9)", -1, cigar.
getQueryIndex(9));
772 check(failures, ++testNum,
"getQueryIndex(10)", -1, cigar.
getQueryIndex(10));
773 check(failures, ++testNum,
"getQueryIndex(11)", -1, cigar.
getQueryIndex(11));
774 check(failures, ++testNum,
"getQueryIndex(12)", -1, cigar.
getQueryIndex(12));
775 check(failures, ++testNum,
"getQueryIndex(13)", -1, cigar.
getQueryIndex(13));
776
777 check(failures, ++testNum,
"getQueryIndex(14)", 4, cigar.
getQueryIndex(14));
778 check(failures, ++testNum,
"getQueryIndex(15)", 5, cigar.
getQueryIndex(15));
779 check(failures, ++testNum,
"getQueryIndex(16)", 6, cigar.
getQueryIndex(16));
780 check(failures, ++testNum,
"getQueryIndex(17)", 7, cigar.
getQueryIndex(17));
781
782
783 check(failures, ++testNum,
"getQueryIndex(18)", 11, cigar.
getQueryIndex(18));
784 check(failures, ++testNum,
"getQueryIndex(19)", 12, cigar.
getQueryIndex(19));
785
786 check(failures, ++testNum,
"getQueryIndex(20)", -1, cigar.
getQueryIndex(20));
787 check(failures, ++testNum,
"getQueryIndex(21)", -1, cigar.
getQueryIndex(21));
788 check(failures, ++testNum,
"getQueryIndex(22)", -1, cigar.
getQueryIndex(22));
789 check(failures, ++testNum,
"getQueryIndex(23)", -1, cigar.
getQueryIndex(23));
790
791 check(failures, ++testNum,
"getQueryIndex(24)", 13, cigar.
getQueryIndex(24));
792 check(failures, ++testNum,
"getQueryIndex(25)", 14, cigar.
getQueryIndex(25));
793 check(failures, ++testNum,
"getQueryIndex(26)", 15, cigar.
getQueryIndex(26));
794
795
796
797 check(failures, ++testNum,
"getQueryIndex(0, 5)", -1, cigar.
getQueryIndex(0, 5));
798 check(failures, ++testNum,
"getQueryIndex(1, 5)", -1, cigar.
getQueryIndex(1, 5));
799 check(failures, ++testNum,
"getQueryIndex(2, 5)", -1, cigar.
getQueryIndex(2, 5));
800 check(failures, ++testNum,
"getQueryIndex(3, 5)", -1, cigar.
getQueryIndex(3, 5));
801 check(failures, ++testNum,
"getQueryIndex(4, 5)", -1, cigar.
getQueryIndex(4, 5));
802
803 check(failures, ++testNum,
"getQueryIndex(5, 5)", 0, cigar.
getQueryIndex(5, 5));
804 check(failures, ++testNum,
"getQueryIndex(6, 5)", 1, cigar.
getQueryIndex(6, 5));
805 check(failures, ++testNum,
"getQueryIndex(7, 5)", 2, cigar.
getQueryIndex(7, 5));
806 check(failures, ++testNum,
"getQueryIndex(8, 5)", 3, cigar.
getQueryIndex(8, 5));
807
808 check(failures, ++testNum,
"getQueryIndex(9, 5)", -1, cigar.
getQueryIndex(9, 5));
809 check(failures, ++testNum,
"getQueryIndex(10, 5)", -1, cigar.
getQueryIndex(10, 5));
810 check(failures, ++testNum,
"getQueryIndex(11, 5)", -1, cigar.
getQueryIndex(11, 5));
811 check(failures, ++testNum,
"getQueryIndex(12, 5)", -1, cigar.
getQueryIndex(12, 5));
812 check(failures, ++testNum,
"getQueryIndex(13, 5)", -1, cigar.
getQueryIndex(13, 5));
813 check(failures, ++testNum,
"getQueryIndex(14, 5)", -1, cigar.
getQueryIndex(14, 5));
814 check(failures, ++testNum,
"getQueryIndex(15, 5)", -1, cigar.
getQueryIndex(15, 5));
815 check(failures, ++testNum,
"getQueryIndex(16, 5)", -1, cigar.
getQueryIndex(16, 5));
816 check(failures, ++testNum,
"getQueryIndex(17, 5)", -1, cigar.
getQueryIndex(17, 5));
817 check(failures, ++testNum,
"getQueryIndex(18, 5)", -1, cigar.
getQueryIndex(18, 5));
818
819 check(failures, ++testNum,
"getQueryIndex(19, 5)", 4, cigar.
getQueryIndex(19, 5));
820 check(failures, ++testNum,
"getQueryIndex(20, 5)", 5, cigar.
getQueryIndex(20, 5));
821 check(failures, ++testNum,
"getQueryIndex(21, 5)", 6, cigar.
getQueryIndex(21, 5));
822 check(failures, ++testNum,
"getQueryIndex(22, 5)", 7, cigar.
getQueryIndex(22, 5));
823
824
825 check(failures, ++testNum,
"getQueryIndex(23, 5)", 11, cigar.
getQueryIndex(23, 5));
826 check(failures, ++testNum,
"getQueryIndex(24, 5)", 12, cigar.
getQueryIndex(24, 5));
827
828 check(failures, ++testNum,
"getQueryIndex(25, 5)", -1, cigar.
getQueryIndex(25, 5));
829 check(failures, ++testNum,
"getQueryIndex(26, 5)", -1, cigar.
getQueryIndex(26, 5));
830 check(failures, ++testNum,
"getQueryIndex(27, 5)", -1, cigar.
getQueryIndex(27, 5));
831 check(failures, ++testNum,
"getQueryIndex(28, 5)", -1, cigar.
getQueryIndex(28, 5));
832
833 check(failures, ++testNum,
"getQueryIndex(29, 5)", 13, cigar.
getQueryIndex(29, 5));
834 check(failures, ++testNum,
"getQueryIndex(30, 5)", 14, cigar.
getQueryIndex(30, 5));
835 check(failures, ++testNum,
"getQueryIndex(31, 5)", 15, cigar.
getQueryIndex(31, 5));
836
837
838
839 check(failures, ++testNum,
"getRefOffset(0)", 0, cigar.
getRefOffset(0));
840 check(failures, ++testNum,
"getRefOffset(1)", 1, cigar.
getRefOffset(1));
841 check(failures, ++testNum,
"getRefOffset(2)", 2, cigar.
getRefOffset(2));
842 check(failures, ++testNum,
"getRefOffset(3)", 3, cigar.
getRefOffset(3));
843
844
845 check(failures, ++testNum,
"getRefOffset(4)", 14, cigar.
getRefOffset(4));
846 check(failures, ++testNum,
"getRefOffset(5)", 15, cigar.
getRefOffset(5));
847 check(failures, ++testNum,
"getRefOffset(6)", 16, cigar.
getRefOffset(6));
848 check(failures, ++testNum,
"getRefOffset(7)", 17, cigar.
getRefOffset(7));
849
850 check(failures, ++testNum,
"getRefOffset(8)", -1, cigar.
getRefOffset(8));
851 check(failures, ++testNum,
"getRefOffset(9)", -1, cigar.
getRefOffset(9));
852 check(failures, ++testNum,
"getRefOffset(10)", -1, cigar.
getRefOffset(10));
853
854 check(failures, ++testNum,
"getRefOffset(11)", 18, cigar.
getRefOffset(11));
855 check(failures, ++testNum,
"getRefOffset(12)", 19, cigar.
getRefOffset(12));
856
857
858 check(failures, ++testNum,
"getRefOffset(13)", 24, cigar.
getRefOffset(13));
859 check(failures, ++testNum,
"getRefOffset(14)", 25, cigar.
getRefOffset(14));
860 check(failures, ++testNum,
"getRefOffset(15)", 26, cigar.
getRefOffset(15));
861
862
863
864
865 check(failures, ++testNum,
"getRefPosition(0, 5)", 5, cigar.
getRefPosition(0, 5));
866 check(failures, ++testNum,
"getRefPosition(1, 5)", 6, cigar.
getRefPosition(1, 5));
867 check(failures, ++testNum,
"getRefPosition(2, 5)", 7, cigar.
getRefPosition(2, 5));
868 check(failures, ++testNum,
"getRefPosition(3, 5)", 8, cigar.
getRefPosition(3, 5));
869
870
871 check(failures, ++testNum,
"getRefPosition(4, 5)", 19, cigar.
getRefPosition(4, 5));
872 check(failures, ++testNum,
"getRefPosition(5, 5)", 20, cigar.
getRefPosition(5, 5));
873 check(failures, ++testNum,
"getRefPosition(6, 5)", 21, cigar.
getRefPosition(6, 5));
874 check(failures, ++testNum,
"getRefPosition(7, 5)", 22, cigar.
getRefPosition(7, 5));
875
876 check(failures, ++testNum,
"getRefPosition(8, 5)", -1, cigar.
getRefPosition(8, 5));
877 check(failures, ++testNum,
"getRefPosition(9, 5)", -1, cigar.
getRefPosition(9, 5));
878 check(failures, ++testNum,
"getRefPosition(10, 5)", -1, cigar.
getRefPosition(10, 5));
879
880 check(failures, ++testNum,
"getRefPosition(11, 5)", 23, cigar.
getRefPosition(11, 5));
881 check(failures, ++testNum,
"getRefPosition(12, 5)", 24, cigar.
getRefPosition(12, 5));
882
883
884 check(failures, ++testNum,
"getRefPosition(13, 5)", 29, cigar.
getRefPosition(13, 5));
885 check(failures, ++testNum,
"getRefPosition(14, 5)", 30, cigar.
getRefPosition(14, 5));
886 check(failures, ++testNum,
"getRefPosition(15, 5)", 31, cigar.
getRefPosition(15, 5));
887
888
889
890
891
892
893 uint32_t cigarBuf[] = {0x24,
894 0x30,
895 0x11,
896 0x20,
897 0x12,
898 0x10,
899 0x26,
900 0x10,
901 0x33,
902 0x10,
903 0x35};
904 cigar.
Set(cigarBuf, 11);
905 cigarString = "HI";
907 expectedResult = "2S3M1I2M1D1M2P1M3N1M3H";
908 check(failures, ++testNum, "getCigarString", expectedResult, cigarString);
909 check(failures, ++testNum,
"getNumEndClips", 3, cigar.
getNumEndClips());
910 check(failures, ++testNum,
"getNumBeginClips", 2, cigar.
getNumBeginClips());
911
912 std::cout << "\nCigarRoller PASS: " << testNum - failures << " FAIL: " << failures << std::endl;
913
914 return(failures);
915}
The purpose of this class is to provide accessors for setting, updating, modifying the CIGAR object....
void Set(const char *cigarString)
Sets this object to the specified cigarString.
int size() const
Return the number of cigar operations.
static const int32_t INDEX_NA
Value associated with an index that is not applicable/does not exist, used for converting between que...
char getCigarCharOp(int32_t expandedCigarIndex)
Return the character code of the cigar operator associated with the specified expanded CIGAR index.
static bool foundInReference(Operation op)
Return true if the specified operation is found in the reference sequence, false if not.
char getCigarCharOpFromQueryIndex(int32_t queryIndex)
Return the character code of the cigar operator associated with the specified queryIndex.
int32_t getExpandedCigarIndexFromQueryIndex(int32_t queryIndex)
Returns the index into the expanded cigar for the cigar associated with the specified queryIndex.
static bool foundInQuery(Operation op)
Return true if the specified operation is found in the query sequence, false if not.
int32_t getExpandedCigarIndexFromRefPos(int32_t refPosition, int32_t queryStartPos)
Returns the index into the expanded cigar for the cigar associated with the specified reference posit...
int getNumBeginClips() const
Return the number of clips that are at the beginning of the cigar.
int getNumEndClips() const
Return the number of clips that are at the end of the cigar.
char getCigarCharOpFromRefOffset(int32_t refOffset)
Return the character code of the cigar operator associated with the specified reference offset.
int32_t getRefPosition(int32_t queryIndex, int32_t queryStartPos)
Return the reference position associated with the specified query index or INDEX_NA based on this cig...
int32_t getExpandedCigarIndexFromRefOffset(int32_t refOffset)
Returns the index into the expanded cigar for the cigar associated with the specified reference offse...
@ del
deletion from the reference (the reference contains bases that have no corresponding base in the quer...
@ mismatch
mismatch operation. Associated with CIGAR Operation "M"
@ hardClip
Hard clip on the read (clipped sequence not present in the query sequence or reference)....
@ match
match/mismatch operation. Associated with CIGAR Operation "M"
@ pad
Padding (not in reference or query). Associated with CIGAR Operation "P".
@ insert
insertion to the reference (the query sequence contains bases that have no corresponding base in the ...
@ skip
skipped region from the reference (the reference contains bases that have no corresponding base in th...
@ softClip
Soft clip on the read (clipped sequence present in the query sequence, but not in reference)....
@ none
no operation has been set.
int32_t getRefOffset(int32_t queryIndex)
Return the reference offset associated with the specified query index or INDEX_NA based on this cigar...
uint32_t getNumOverlaps(int32_t start, int32_t end, int32_t queryStartPos)
Return the number of bases that overlap the reference and the read associated with this cigar that fa...
char getCigarCharOpFromRefPos(int32_t refPosition, int32_t queryStartPos)
Return the character code of the cigar operator associated with the specified reference position.
void getCigarString(String &cigarString) const
Set the passed in String to the string reprentation of the Cigar operations in this object.
int32_t getQueryIndex(int32_t refOffset)
Return the query index associated with the specified reference offset or INDEX_NA based on this cigar...
static bool isClip(Operation op)
Return true if the specified operation is a clipping operation, false if not.