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 "mSmithWaterman.h" |
4340 |
16 Apr 23 |
peter |
25 |
|
4353 |
23 Aug 23 |
peter |
26 |
#include <cassert> |
4353 |
23 Aug 23 |
peter |
27 |
|
4340 |
16 Apr 23 |
peter |
28 |
namespace theplu { |
4340 |
16 Apr 23 |
peter |
29 |
namespace yat { |
4340 |
16 Apr 23 |
peter |
30 |
namespace utility { |
4340 |
16 Apr 23 |
peter |
31 |
|
4340 |
16 Apr 23 |
peter |
32 |
mSmithWaterman::mSmithWaterman(double gap, double open_gap) |
4340 |
16 Apr 23 |
peter |
33 |
: mSmithWaterman(gap, open_gap, gap, open_gap) |
4340 |
16 Apr 23 |
peter |
34 |
{} |
4340 |
16 Apr 23 |
peter |
35 |
|
4340 |
16 Apr 23 |
peter |
36 |
|
4340 |
16 Apr 23 |
peter |
37 |
mSmithWaterman::mSmithWaterman(double insertion_penalty, |
4340 |
16 Apr 23 |
peter |
38 |
double open_insertion_penalty, |
4340 |
16 Apr 23 |
peter |
39 |
double deletion_penalty, |
4340 |
16 Apr 23 |
peter |
40 |
double open_deletion_penalty) |
4353 |
23 Aug 23 |
peter |
41 |
: mAligner<mSmithWaterman>(Affine(insertion_penalty, |
4353 |
23 Aug 23 |
peter |
42 |
open_insertion_penalty), |
4353 |
23 Aug 23 |
peter |
43 |
Affine(deletion_penalty, |
4353 |
23 Aug 23 |
peter |
44 |
open_deletion_penalty)) |
4340 |
16 Apr 23 |
peter |
45 |
{} |
4340 |
16 Apr 23 |
peter |
46 |
|
4340 |
16 Apr 23 |
peter |
47 |
|
4353 |
23 Aug 23 |
peter |
48 |
double mSmithWaterman::init_row(size_t q) const |
4340 |
16 Apr 23 |
peter |
49 |
{ |
4353 |
23 Aug 23 |
peter |
50 |
return 0; |
4340 |
16 Apr 23 |
peter |
51 |
} |
4340 |
16 Apr 23 |
peter |
52 |
|
4340 |
16 Apr 23 |
peter |
53 |
|
4353 |
23 Aug 23 |
peter |
54 |
double mSmithWaterman::init_col(size_t r) const |
4340 |
16 Apr 23 |
peter |
55 |
{ |
4353 |
23 Aug 23 |
peter |
56 |
return 0; |
4340 |
16 Apr 23 |
peter |
57 |
} |
4340 |
16 Apr 23 |
peter |
58 |
|
4340 |
16 Apr 23 |
peter |
59 |
|
4353 |
23 Aug 23 |
peter |
60 |
double mSmithWaterman::init(size_t r, size_t q) const |
4340 |
16 Apr 23 |
peter |
61 |
{ |
4353 |
23 Aug 23 |
peter |
62 |
return 0; |
4340 |
16 Apr 23 |
peter |
63 |
} |
4340 |
16 Apr 23 |
peter |
64 |
|
4340 |
16 Apr 23 |
peter |
65 |
|
4353 |
23 Aug 23 |
peter |
66 |
void mSmithWaterman::update(const std::vector<Alignment>& alignments, |
4353 |
23 Aug 23 |
peter |
67 |
size_t r, size_t rsize) |
4340 |
16 Apr 23 |
peter |
68 |
{ |
4353 |
23 Aug 23 |
peter |
69 |
auto best = std::max_element(alignments.begin(), alignments.end()); |
4353 |
23 Aug 23 |
peter |
70 |
|
4353 |
23 Aug 23 |
peter |
71 |
if (best_ < *best) { |
4353 |
23 Aug 23 |
peter |
72 |
best_ = *best; |
4353 |
23 Aug 23 |
peter |
73 |
best_.cigar().push_back(BAM_CSOFT_CLIP, (alignments.end() - best) - 1); |
4353 |
23 Aug 23 |
peter |
74 |
} |
4340 |
16 Apr 23 |
peter |
75 |
} |
4340 |
16 Apr 23 |
peter |
76 |
|
4340 |
16 Apr 23 |
peter |
77 |
}}} |