-
Notifications
You must be signed in to change notification settings - Fork 78
/
search_1mm_phase1.c
67 lines (60 loc) · 1.63 KB
/
search_1mm_phase1.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* This is a fragment, included from multiple places in ebwt_search.cpp.
* It implements the logic of the first phase of the 1-mismatch search
* routine. It is implemented as a code fragment so that it can be
* reused in both the half-index-in-memory and full-index-in-memory
* situations.
*/
{
bt.setEbwt(&ebwtFw);
bt.setReportExacts(true);
if(plen < 2) {
cerr << "Error: Reads must be at least 2 characters long in 1-mismatch mode" << endl;
throw 1;
}
if(!nofw) {
// First, try exact hits for the forward-oriented read
params.setFw(true);
bt.setQuery(patsrc->bufa());
bt.setOffs(0, 0, s, s, s, s);
if(bt.backtrack()) {
DONEMASK_SET(patid);
continue;
}
}
if(!norc) {
params.setFw(false);
// Next, try exact hits for the reverse-complement read
bt.setQuery(patsrc->bufa());
bt.setOffs(0, 0, s, s, s, s);
if(bt.backtrack()) {
DONEMASK_SET(patid);
continue;
}
}
if(sink->finishedWithStratum(0)) { // no more exact hits are possible
// the sink tells us we needn't try 1-mismatch alignments
DONEMASK_SET(patid);
continue;
}
bt.setReportExacts(false);
if(!norc) {
// Next, try hits with one mismatch on the 3' end for the reverse-complement read
bt.setQuery(patsrc->bufa());
bt.setOffs(0, 0, s5, s, s, s); // 1 mismatch allowed in 3' half
if(bt.backtrack()) {
DONEMASK_SET(patid);
continue;
}
}
if(!nofw) {
params.setFw(true);
// Next, try hits with one mismatch on the 3' end for the reverse-complement read
bt.setQuery(patsrc->bufa());
bt.setOffs(0, 0, s5, s, s, s); // 1 mismatch allowed in 3' half
if(bt.backtrack()) {
DONEMASK_SET(patid);
continue;
}
}
}