26 #include "CigarRollerTest.h" 32 int CigarRollerTest::test(
void)
34 int failures = 0, testNum = 0;
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,
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,
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,
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,
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,
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,
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,
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,
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,
273 result = str.c_str();
276 check(failures, ++testNum,
"constructor", result,
"");
328 result = str.c_str();
331 check(failures, ++testNum,
"match combining",
"20M10I5D10M5N5M2P3M", result);
332 check(failures, ++testNum,
"length check", 8, cigar.
size());
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));
363 for(i = 0; i < 20; i++)
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));
373 for(i = 0; i < 10; i++)
375 check(failures, ++testNum,
"getRefOffset(queryIndex)", -1, cigar.
getRefOffset(queryIndex));
376 check(failures, ++testNum,
"getRefPosition(queryIndex, 5)", -1, cigar.
getRefPosition(queryIndex, 5));
380 for(i = 0; i < 5; i++)
382 check(failures, ++testNum,
"getQueryIndex(refOffset)", -1, cigar.
getQueryIndex(refOffset));
383 check(failures, ++testNum,
"getQueryIndex(refPosition, 5)", -1, cigar.
getQueryIndex(refOffset + 5, 5));
387 for(i = 0; i < 10; i++)
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));
397 for(i = 0; i < 5; i++)
399 check(failures, ++testNum,
"getQueryIndex(refOffset)", -1, cigar.
getQueryIndex(refOffset));
400 check(failures, ++testNum,
"getQueryIndex(refPosition, 5)", -1, cigar.
getQueryIndex(refOffset + 5, 5));
404 for(i = 0; i < 5; i++)
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));
415 for(i = 0; i < 3; i++)
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));
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));
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));
444 check(failures, ++testNum,
"getNumOverlaps(1, 5, 5)", (uint32_t)0, cigar.
getNumOverlaps(1, 5, 5));
447 check(failures, ++testNum,
"getNumOverlaps(53, 101, 5)", (uint32_t)0, cigar.
getNumOverlaps(53, 101, 5));
450 check(failures, ++testNum,
"getNumOverlaps(53, 10, 5)", (uint32_t)0, cigar.
getNumOverlaps(53, 10, 5));
453 check(failures, ++testNum,
"getNumOverlaps(35, 10, 5)", (uint32_t)0, cigar.
getNumOverlaps(35, 10, 5));
456 check(failures, ++testNum,
"getNumOverlaps(35, 1, 5)", (uint32_t)0, cigar.
getNumOverlaps(35, 1, 5));
459 check(failures, ++testNum,
"getNumOverlaps(1, 6, 5)", (uint32_t)1, cigar.
getNumOverlaps(1, 6, 5));
462 check(failures, ++testNum,
"getNumOverlaps(25, 30, 5)", (uint32_t)0, cigar.
getNumOverlaps(25, 30, 5));
465 check(failures, ++testNum,
"getNumOverlaps(24, 30, 5)", (uint32_t)1, cigar.
getNumOverlaps(24, 30, 5));
468 check(failures, ++testNum,
"getNumOverlaps(25, 31, 5)", (uint32_t)1, cigar.
getNumOverlaps(25, 31, 5));
471 check(failures, ++testNum,
"getNumOverlaps(1, 31, 5)", (uint32_t)21, cigar.
getNumOverlaps(1, 31, 5));
474 check(failures, ++testNum,
"getNumOverlaps(1, 101, 5)", (uint32_t)38, cigar.
getNumOverlaps(1, 101, 5));
477 check(failures, ++testNum,
"getNumOverlaps(-1, -1, 5)", (uint32_t)38, cigar.
getNumOverlaps(-1, -1, 5));
480 check(failures, ++testNum,
"getNumOverlaps(6, 52, 5)", (uint32_t)36, cigar.
getNumOverlaps(6, 52, 5));
483 check(failures, ++testNum,
"getNumOverlaps(40, 45, 5)", (uint32_t)0, cigar.
getNumOverlaps(40, 45, 5));
486 check(failures, ++testNum,
"getNumOverlaps(-1, 10, 5)", (uint32_t)5, cigar.
getNumOverlaps(-1, 10, 5));
489 check(failures, ++testNum,
"getNumOverlaps(50, -1, 5)", (uint32_t)3, cigar.
getNumOverlaps(50, -1, 5));
493 cigar.
Set(
"4M10N4M3I2M4D3M");
494 String expectedResult =
"4M10N4M3I2M4D3M";
495 String cigarString =
"HI";
497 check(failures, ++testNum,
"getCigarString", expectedResult, cigarString);
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));
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));
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));
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));
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));
783 check(failures, ++testNum,
"getQueryIndex(18)", 11, cigar.
getQueryIndex(18));
784 check(failures, ++testNum,
"getQueryIndex(19)", 12, cigar.
getQueryIndex(19));
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));
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));
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));
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));
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));
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));
825 check(failures, ++testNum,
"getQueryIndex(23, 5)", 11, cigar.
getQueryIndex(23, 5));
826 check(failures, ++testNum,
"getQueryIndex(24, 5)", 12, cigar.
getQueryIndex(24, 5));
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));
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));
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));
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));
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));
854 check(failures, ++testNum,
"getRefOffset(11)", 18, cigar.
getRefOffset(11));
855 check(failures, ++testNum,
"getRefOffset(12)", 19, cigar.
getRefOffset(12));
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));
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));
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));
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));
880 check(failures, ++testNum,
"getRefPosition(11, 5)", 23, cigar.
getRefPosition(11, 5));
881 check(failures, ++testNum,
"getRefPosition(12, 5)", 24, cigar.
getRefPosition(12, 5));
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));
893 uint32_t cigarBuf[] = {0x24,
904 cigar.
Set(cigarBuf, 11);
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());
912 std::cout <<
"\nCigarRoller PASS: " << testNum - failures <<
" FAIL: " << failures << std::endl;
918 int main(
int argc,
const char **argv)
922 bool showAllCasesFlag =
false;
925 while(( opt = getopt(argc, (
char **) argv,
"v")) != -1) {
928 showAllCasesFlag =
true;
931 std::cerr <<
"usage: testSW [-v]" << std::endl;
942 return(roller.test());
int32_t getExpandedCigarIndexFromQueryIndex(int32_t queryIndex)
Returns the index into the expanded cigar for the cigar associated with the specified queryIndex...
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...
void Set(const char *cigarString)
Sets this object to the specified cigarString.
insertion to the reference (the query sequence contains bases that have no corresponding base in the ...
static bool isClip(Operation op)
Return true if the specified operation is a clipping operation, false if not.
Padding (not in reference or query). Associated with CIGAR Operation "P".
int getNumEndClips() const
Return the number of clips that are at the end of the cigar.
skipped region from the reference (the reference contains bases that have no corresponding base in th...
no operation has been set.
static bool foundInReference(Operation op)
Return true if the specified operation is found in the reference sequence, false if not...
int size() const
Return the number of cigar operations.
int getNumBeginClips() const
Return the number of clips that are at the beginning of the cigar.
static const int32_t INDEX_NA
Value associated with an index that is not applicable/does not exist, used for converting between que...
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 getCigarCharOp(int32_t expandedCigarIndex)
Return the character code of the cigar operator associated with the specified expanded CIGAR index...
Hard clip on the read (clipped sequence not present in the query sequence or reference). Associated with CIGAR Operation "H".
static bool foundInQuery(Operation op)
Return true if the specified operation is found in the query sequence, false if not.
void getCigarString(String &cigarString) const
Set the passed in String to the string reprentation of the Cigar operations in this object...
int32_t getRefOffset(int32_t queryIndex)
Return the reference offset associated with the specified query index or INDEX_NA based on this cigar...
char getCigarCharOpFromRefPos(int32_t refPosition, int32_t queryStartPos)
Return the character code of the cigar operator associated with the specified reference position...
mismatch operation. Associated with CIGAR Operation "M"
Soft clip on the read (clipped sequence present in the query sequence, but not in reference)...
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...
match/mismatch operation. Associated with CIGAR Operation "M"
int32_t getQueryIndex(int32_t refOffset)
Return the query index associated with the specified reference offset or INDEX_NA based on this cigar...
deletion from the reference (the reference contains bases that have no corresponding base in the quer...
char getCigarCharOpFromQueryIndex(int32_t queryIndex)
Return the character code of the cigar operator associated with the specified queryIndex.
char getCigarCharOpFromRefOffset(int32_t refOffset)
Return the character code of the cigar operator associated with the specified reference offset...
The purpose of this class is to provide accessors for setting, updating, modifying the CIGAR object...
int32_t getExpandedCigarIndexFromRefOffset(int32_t refOffset)
Returns the index into the expanded cigar for the cigar associated with the specified reference offse...