-
Notifications
You must be signed in to change notification settings - Fork 19
/
aligner_driver.cpp
80 lines (77 loc) · 2.25 KB
/
aligner_driver.cpp
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
68
69
70
71
72
73
74
75
76
77
78
79
/*
* Copyright 2012, Ben Langmead <[email protected]>
*
* This file is part of Bowtie 2.
*
* Bowtie 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Bowtie 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Bowtie 2. If not, see <http://www.gnu.org/licenses/>.
*/
#include "aligner_driver.h"
void AlignerDriverRootSelector::select(
const Read& q,
const Read* qo,
bool nofw,
bool norc,
EList<DescentConfig>& confs,
EList<DescentRoot>& roots)
{
// Calculate interval length for both mates
int interval = rootIval_.f<int>((double)q.length());
if(qo != NULL) {
// Boost interval length by 20% for paired-end reads
interval = (int)(interval * 1.2 + 0.5);
}
float pri = 0.0f;
for(int fwi = 0; fwi < 2; fwi++) {
bool fw = (fwi == 0);
if((fw && nofw) || (!fw && norc)) {
continue;
}
// Put down left-to-right roots w/r/t forward and reverse-complement reads
{
bool first = true;
size_t i = 0;
while(first || (i + landing_ <= q.length())) {
confs.expand();
confs.back().cons.init(landing_, consExp_);
roots.expand();
roots.back().init(
i, // offset from 5' end
true, // left-to-right?
fw, // fw?
q.length(), // query length
pri); // root priority
i += interval;
first = false;
}
}
// Put down right-to-left roots w/r/t forward and reverse-complement reads
{
bool first = true;
size_t i = 0;
while(first || (i + landing_ <= q.length())) {
confs.expand();
confs.back().cons.init(landing_, consExp_);
roots.expand();
roots.back().init(
q.length() - i - 1, // offset from 5' end
false, // left-to-right?
fw, // fw?
q.length(), // query length
pri); // root priority
i += interval;
first = false;
}
}
}
}