4340 |
16 Apr 23 |
peter |
// $Id$ |
4340 |
16 Apr 23 |
peter |
2 |
|
4340 |
16 Apr 23 |
peter |
3 |
/* |
4340 |
16 Apr 23 |
peter |
Copyright (C) 2023 Peter Johansson |
4340 |
16 Apr 23 |
peter |
5 |
|
4340 |
16 Apr 23 |
peter |
This file is part of the yat library, https://dev.thep.lu.se/yat |
4340 |
16 Apr 23 |
peter |
7 |
|
4340 |
16 Apr 23 |
peter |
The yat library is free software; you can redistribute it and/or |
4340 |
16 Apr 23 |
peter |
modify it under the terms of the GNU General Public License as |
4340 |
16 Apr 23 |
peter |
published by the Free Software Foundation; either version 3 of the |
4340 |
16 Apr 23 |
peter |
License, or (at your option) any later version. |
4340 |
16 Apr 23 |
peter |
12 |
|
4340 |
16 Apr 23 |
peter |
The yat library is distributed in the hope that it will be useful, |
4340 |
16 Apr 23 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
4340 |
16 Apr 23 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4340 |
16 Apr 23 |
peter |
General Public License for more details. |
4340 |
16 Apr 23 |
peter |
17 |
|
4340 |
16 Apr 23 |
peter |
You should have received a copy of the GNU General Public License |
4340 |
16 Apr 23 |
peter |
along with yat. If not, see <https://www.gnu.org/licenses/>. |
4340 |
16 Apr 23 |
peter |
20 |
*/ |
4340 |
16 Apr 23 |
peter |
21 |
|
4340 |
16 Apr 23 |
peter |
22 |
#include <config.h> |
4340 |
16 Apr 23 |
peter |
23 |
|
4340 |
16 Apr 23 |
peter |
24 |
#include "mAligner.h" |
4340 |
16 Apr 23 |
peter |
25 |
|
4340 |
16 Apr 23 |
peter |
26 |
namespace theplu { |
4340 |
16 Apr 23 |
peter |
27 |
namespace yat { |
4340 |
16 Apr 23 |
peter |
28 |
namespace utility { |
4340 |
16 Apr 23 |
peter |
29 |
|
4353 |
23 Aug 23 |
peter |
30 |
namespace maligner { |
4353 |
23 Aug 23 |
peter |
31 |
|
4353 |
23 Aug 23 |
peter |
32 |
Affine::Affine(double pen, double open) |
4353 |
23 Aug 23 |
peter |
33 |
: pen_(pen), open_(open) |
4340 |
16 Apr 23 |
peter |
34 |
{} |
4340 |
16 Apr 23 |
peter |
35 |
|
4340 |
16 Apr 23 |
peter |
36 |
|
4353 |
23 Aug 23 |
peter |
37 |
double Affine::operator()(size_t k) const |
4340 |
16 Apr 23 |
peter |
38 |
{ |
4353 |
23 Aug 23 |
peter |
39 |
return k ? open_ + k*pen_ : 0; |
4340 |
16 Apr 23 |
peter |
40 |
} |
4340 |
16 Apr 23 |
peter |
41 |
|
4340 |
16 Apr 23 |
peter |
42 |
|
4353 |
23 Aug 23 |
peter |
43 |
double Affine::penalty(void) const |
4340 |
16 Apr 23 |
peter |
44 |
{ |
4353 |
23 Aug 23 |
peter |
45 |
return pen_; |
4340 |
16 Apr 23 |
peter |
46 |
} |
4340 |
16 Apr 23 |
peter |
47 |
|
4340 |
16 Apr 23 |
peter |
48 |
|
4353 |
23 Aug 23 |
peter |
49 |
double Affine::open_penalty(void) const |
4340 |
16 Apr 23 |
peter |
50 |
{ |
4353 |
23 Aug 23 |
peter |
51 |
return open_; |
4340 |
16 Apr 23 |
peter |
52 |
} |
4340 |
16 Apr 23 |
peter |
53 |
|
4340 |
16 Apr 23 |
peter |
54 |
|
4353 |
23 Aug 23 |
peter |
55 |
Alignment::Alignment(void) |
4353 |
23 Aug 23 |
peter |
56 |
: position_(0), score_(-std::numeric_limits<double>::infinity()) |
4353 |
23 Aug 23 |
peter |
57 |
{} |
4353 |
23 Aug 23 |
peter |
58 |
|
4353 |
23 Aug 23 |
peter |
59 |
|
4353 |
23 Aug 23 |
peter |
60 |
Aligner::Cigar& Alignment::cigar(void) |
4340 |
16 Apr 23 |
peter |
61 |
{ |
4353 |
23 Aug 23 |
peter |
62 |
return cigar_; |
4340 |
16 Apr 23 |
peter |
63 |
} |
4340 |
16 Apr 23 |
peter |
64 |
|
4340 |
16 Apr 23 |
peter |
65 |
|
4353 |
23 Aug 23 |
peter |
66 |
const Aligner::Cigar& Alignment::cigar(void) const |
4353 |
23 Aug 23 |
peter |
67 |
{ |
4353 |
23 Aug 23 |
peter |
68 |
return cigar_; |
4353 |
23 Aug 23 |
peter |
69 |
} |
4340 |
16 Apr 23 |
peter |
70 |
|
4340 |
16 Apr 23 |
peter |
71 |
|
4353 |
23 Aug 23 |
peter |
72 |
size_t& Alignment::position(void) |
4353 |
23 Aug 23 |
peter |
73 |
{ |
4353 |
23 Aug 23 |
peter |
74 |
return position_; |
4353 |
23 Aug 23 |
peter |
75 |
} |
4340 |
16 Apr 23 |
peter |
76 |
|
4353 |
23 Aug 23 |
peter |
77 |
|
4353 |
23 Aug 23 |
peter |
78 |
const size_t& Alignment::position(void) const |
4340 |
16 Apr 23 |
peter |
79 |
{ |
4353 |
23 Aug 23 |
peter |
80 |
return position_; |
4340 |
16 Apr 23 |
peter |
81 |
} |
4340 |
16 Apr 23 |
peter |
82 |
|
4340 |
16 Apr 23 |
peter |
83 |
|
4353 |
23 Aug 23 |
peter |
84 |
double& Alignment::score(void) |
4340 |
16 Apr 23 |
peter |
85 |
{ |
4353 |
23 Aug 23 |
peter |
86 |
return score_; |
4340 |
16 Apr 23 |
peter |
87 |
} |
4340 |
16 Apr 23 |
peter |
88 |
|
4340 |
16 Apr 23 |
peter |
89 |
|
4353 |
23 Aug 23 |
peter |
90 |
const double& Alignment::score(void) const |
4340 |
16 Apr 23 |
peter |
91 |
{ |
4353 |
23 Aug 23 |
peter |
92 |
return score_; |
4340 |
16 Apr 23 |
peter |
93 |
} |
4340 |
16 Apr 23 |
peter |
94 |
|
4340 |
16 Apr 23 |
peter |
95 |
|
4353 |
23 Aug 23 |
peter |
96 |
bool Alignment::operator<(const Alignment& other) const |
4340 |
16 Apr 23 |
peter |
97 |
{ |
4353 |
23 Aug 23 |
peter |
98 |
return score_ < other.score_; |
4340 |
16 Apr 23 |
peter |
99 |
} |
4340 |
16 Apr 23 |
peter |
100 |
|
4340 |
16 Apr 23 |
peter |
101 |
|
4353 |
23 Aug 23 |
peter |
// MatchKernel |
4353 |
23 Aug 23 |
peter |
103 |
MatchKernel::MatchKernel(int mismatch_pen) |
4353 |
23 Aug 23 |
peter |
104 |
: mismatch_(mismatch_pen) |
4340 |
16 Apr 23 |
peter |
105 |
{} |
4340 |
16 Apr 23 |
peter |
106 |
|
4340 |
16 Apr 23 |
peter |
107 |
|
4353 |
23 Aug 23 |
peter |
// Affine class |
4340 |
16 Apr 23 |
peter |
109 |
|
4353 |
23 Aug 23 |
peter |
110 |
}}}} |