Imported Debian patch 0.12.7-3
[bowtie.git] / search_23mm_phase2.c
1 /*
2  * This is a fragment, included from multiple places in ebwt_search.cpp.
3  * It implements the logic of the second phase of the 2/3-mismatch
4  * search routine.  It is implemented as a code fragment so that it can
5  * be reused in both the half-index-in-memory and full-index-in-memory
6  * situations.
7  */
8 {
9         bt2.setReportExacts(false);
10
11         if(!nofw) {
12                 // Set up the revisitability of the halves
13                 params.setFw(true);
14                 bt2.setQuery(patsrc->bufa());
15                 bt2.setOffs(0, 0, s5, s5, two? s : s5, s);
16                 if(bt2.backtrack()) {
17                         DONEMASK_SET(patid);
18                         continue;
19                 }
20                 // if nofw is true, then we already did this
21                 if(sink->finishedWithStratum(0)) { // no more exact hits are possible
22                         DONEMASK_SET(patid);
23                         continue;
24                 }
25         }
26
27         if(!norc) {
28                 // Try 2/3 backtracks in the 3' half of the reverse complement read
29                 params.setFw(false);  // looking at reverse complement
30                 // Set up the revisitability of the halves
31                 bt2.setQuery(patsrc->bufa());
32                 bt2.setOffs(0, 0, s3, s3, two? s : s3, s);
33                 if(bt2.backtrack()) {
34                         DONEMASK_SET(patid);
35                         continue;
36                 }
37         }
38
39         if(nofw && sink->finishedWithStratum(1)) {
40                 DONEMASK_SET(patid);
41                 continue;
42         }
43 }