Commit patch to not break on spaces.
[bowtie.git] / search_23mm_phase3.c
1 /*
2  * This is a fragment, included from multiple places in ebwt_search.cpp.
3  * It implements the logic of the third 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         if(!nofw) {
10                 // Try 2/3 backtracks in the 3' half of the forward read
11                 params.setFw(true);
12                 bt3.setReportExacts(false);
13                 bt3.setQuery(patsrc->bufa());
14                 bt3.setOffs(0, 0,
15                                         s3,
16                                         s3,
17                                         two? s : s3,
18                                         s);
19                 bool done = bt3.backtrack();
20                 if(done) continue;
21                 // no more 1-mismatch hits are possible after this point
22                 if(sink->finishedWithStratum(1)) {
23                         continue;
24                 }
25
26                 // Try a half-and-half on the forward read
27                 bool gaveUp = false;
28                 bthh3.setQuery(patsrc->bufa());
29                 // Processing the forward pattern with the forward index;
30                 // s3 ("lo") half is on the right
31                 bthh3.setOffs(s3, s,
32                               0,
33                               two ? s3 : 0,
34                               two ? s  : s3,
35                               s);
36                 done = bthh3.backtrack();
37                 if(bthh3.numBacktracks() == bthh3.maxBacktracks()) {
38                         gaveUp = true;
39                 }
40                 bthh3.resetNumBacktracks();
41                 if(done) {
42                         continue;
43                 }
44         }
45
46         if(!norc) {
47                 // Try a half-and-half on the reverse complement read
48                 bool gaveUp = false;
49                 params.setFw(false);
50                 bthh3.setQuery(patsrc->bufa());
51                 // Processing the forward pattern with the forward index;
52                 // s5 ("hi") half is on the right
53                 bthh3.setOffs(s5, s,
54                                           0,
55                                           two ? s5 : 0,
56                                           two ? s  : s5,
57                                           s);
58                 bool done = bthh3.backtrack();
59                 if(bthh3.numBacktracks() == bthh3.maxBacktracks()) {
60                         gaveUp = true;
61                 }
62                 bthh3.resetNumBacktracks();
63                 if(done) {
64                         continue;
65                 }
66         }
67 }