-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAGEAlignerAdapter.cpp
executable file
·39 lines (26 loc) · 1.28 KB
/
AGEAlignerAdapter.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
#include "AGEAlignerAdapter.h"
#include "age/AGEaligner.hh"
#include "error.h"
#include "DoubleFragsAlnResult.h"
IAlignmentResult *AGEAlignerAdapter::Align(const std::string &v, const std::string &w, const ScoreParam &sParam)
{
int flag = AGEaligner::INDEL_FLAG;
Scorer scr(sParam.GetMatch(), sParam.GetMismatch(), sParam.GetGapStart(), sParam.GetGap());
Sequence seq1(v.c_str());
Sequence seq2(w.c_str());
AGEaligner aligner(seq1, seq2);
if(!aligner.align(scr,flag)) error("AGE alignment error");
AliFragment *f = aligner.GetAliFragments();
assert(f->start1() <= f->end1() && f->start2() <= f->end2());
AlignmentFragment aFragment1(f->ali1(),
f->ali2(),
Interval(f->start1() - 1, f->end1() - 1),
Interval(f->start2() - 1, f->end2() - 1));
if (!(f=f->next())) return NULL;
assert(f->start1() <= f->end1() && f->start2() <= f->end2());
AlignmentFragment aFragment2(f->ali1(),
f->ali2(),
Interval(f->start1() - 1, f->end1() - 1),
Interval(f->start2() - 1, f->end2() - 1));
return new DoubleFragsAlnResult(v, w, aligner.score(), aFragment1, aFragment2);
}