2 * This is a fragment, included from multiple places in ebwt_search.cpp.
3 * It implements the logic of the fourth phase of the seeded, quality-
4 * aware search routine. It is implemented as a code fragment so that
5 * it can be reused in both the half-index-in-memory and full-index-in-
11 btf4.setReportExacts(true);
12 btf4.setQuery(patsrc->bufa());
13 // Get all partial alignments for this read's reverse
16 if(pamFw != NULL && pamFw->size() > 0) {
17 // We can get away with an unsynchronized call because there
18 // are no writers for pamFw in this phase
19 pamFw->getPartialsUnsync(patid, pals);
21 assert_eq(0, pamFw->size());
25 // Partial alignments exist - extend them
28 btf4.setOffs(0, 0, qs, qs, qs, qs);
30 btf4.setOffs(0, 0, s, s, s, s);
32 for(size_t i = 0; i < pals.size(); i++) {
35 PartialAlignmentManager::toMutsString(
36 pals[i], patFwRev, qualRev, muts, !noMaqRound);
37 assert_leq(oldQuals, qualThresh);
38 // Set the backtracking thresholds appropriately
39 // Now begin the backtracking, treating the first
40 // 24 bases as unrevisitable
41 ASSERT_ONLY(String<Dna5> tmp = patFwRev);
43 done = btf4.backtrack(oldQuals);
45 assert_eq(tmp, patFwRev); // assert mutations were undone
47 // Got a hit; stop processing partial
51 } // Loop over partial alignments
55 // Case 4F yielded a hit; continue to next pattern
58 if(sink->finishedWithStratum(1)) { // no more exact hits are possible
62 // If we're in two-mismatch mode, then now is the time to
63 // try the final case that might apply to the forward
64 // pattern: 1 mismatch in each of the 3' and 5' halves of
68 btf24.setQuery(patsrc->bufa());
71 btf24.setOffs(qs5, qs,
73 (seedMms <= 2)? qs5 : 0, // 1revOff
74 (seedMms < 3)? qs : qs5, // 2revOff
79 (seedMms <= 2)? s5 : 0, // 1revOff
80 (seedMms < 3)? s : s5, // 2revOff
83 done = btf24.backtrack();
84 if(btf24.numBacktracks() == btf24.maxBacktracks()) {
88 btf24.resetNumBacktracks();
91 btf24.resetNumBacktracks();