File: search_23mm_phase1.c

package info (click to toggle)
bowtie 1.2.3+dfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 16,888 kB
  • sloc: cpp: 35,784; perl: 5,903; ansic: 1,247; sh: 1,180; python: 487; makefile: 426
file content (47 lines) | stat: -rw-r--r-- 1,340 bytes parent folder | download | duplicates (5)
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
/*
 * This is a fragment, included from multiple places in ebwt_search.cpp.
 * It implements the logic of the first phase of the 2/3-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.
 */
{
	// If requested, check that this read has the same length
	// as all the previous ones
	btr1.setReportExacts(true);

	if(plen < 3 && two) {
		cerr << "Error: Read (" << name << ") is less than 3 characters long" << endl;
		throw 1;
	}
	else if(plen < 4) {
		cerr << "Error: Read (" << name << ") is less than 4 characters long" << endl;
		throw 1;
	}
	if(!nofw) {
		// Do an exact-match search on the forward pattern, just in
		// case we can pick it off early here
		params.setFw(true);
		btr1.setQuery(patsrc->bufa());
		btr1.setOffs(0, 0, plen, plen, plen, plen);
		if(btr1.backtrack()) {
			DONEMASK_SET(patid);
			continue;
		}
	}
	if(!norc) {
		// Set up backtracker with reverse complement
		params.setFw(false);
		// Set up the revisitability of the halves
		btr1.setQuery(patsrc->bufa());
		btr1.setOffs(0, 0, s5, s5, two ? s : s5, s);
		if(btr1.backtrack()) {
			DONEMASK_SET(patid);
			continue;
		}
	}
	if(nofw && sink->finishedWithStratum(0)) { // no more exact hits are possible
		DONEMASK_SET(patid);
		continue;
	}
}