4334 |
25 Mar 23 |
peter |
// $Id$ |
4334 |
25 Mar 23 |
peter |
2 |
|
4334 |
25 Mar 23 |
peter |
3 |
/* |
4334 |
25 Mar 23 |
peter |
Copyright (C) 2023 Peter Johansson |
4334 |
25 Mar 23 |
peter |
5 |
|
4334 |
25 Mar 23 |
peter |
This file is part of the yat library, https://dev.thep.lu.se/yat |
4334 |
25 Mar 23 |
peter |
7 |
|
4334 |
25 Mar 23 |
peter |
The yat library is free software; you can redistribute it and/or |
4334 |
25 Mar 23 |
peter |
modify it under the terms of the GNU General Public License as |
4334 |
25 Mar 23 |
peter |
published by the Free Software Foundation; either version 3 of the |
4334 |
25 Mar 23 |
peter |
License, or (at your option) any later version. |
4334 |
25 Mar 23 |
peter |
12 |
|
4334 |
25 Mar 23 |
peter |
The yat library is distributed in the hope that it will be useful, |
4334 |
25 Mar 23 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
4334 |
25 Mar 23 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
4334 |
25 Mar 23 |
peter |
General Public License for more details. |
4334 |
25 Mar 23 |
peter |
17 |
|
4334 |
25 Mar 23 |
peter |
You should have received a copy of the GNU General Public License |
4334 |
25 Mar 23 |
peter |
along with yat. If not, see <https://www.gnu.org/licenses/>. |
4334 |
25 Mar 23 |
peter |
20 |
*/ |
4334 |
25 Mar 23 |
peter |
21 |
|
4334 |
25 Mar 23 |
peter |
22 |
#include <config.h> |
4334 |
25 Mar 23 |
peter |
23 |
|
4334 |
25 Mar 23 |
peter |
24 |
#include "Suite.h" |
4334 |
25 Mar 23 |
peter |
25 |
|
4334 |
25 Mar 23 |
peter |
26 |
#include "yat/utility/Matrix.h" |
4334 |
25 Mar 23 |
peter |
27 |
#include "yat/utility/NeedlemanWunsch.h" |
4334 |
25 Mar 23 |
peter |
28 |
|
4334 |
25 Mar 23 |
peter |
29 |
using namespace theplu::yat; |
4334 |
25 Mar 23 |
peter |
30 |
|
4334 |
25 Mar 23 |
peter |
31 |
int main(int argc, char* argv[]) |
4334 |
25 Mar 23 |
peter |
32 |
{ |
4334 |
25 Mar 23 |
peter |
33 |
test::Suite suite(argc, argv); |
4334 |
25 Mar 23 |
peter |
34 |
|
4334 |
25 Mar 23 |
peter |
35 |
utility::NeedlemanWunsch aligner(2,3); |
4334 |
25 Mar 23 |
peter |
36 |
|
4334 |
25 Mar 23 |
peter |
37 |
std::string ref = "abcdefghijklmnopqrstuvxyz"; |
4334 |
25 Mar 23 |
peter |
38 |
std::string seq = "fghijklmnoqrstuvahaxyz!"; |
4334 |
25 Mar 23 |
peter |
// The expected 5D10=1D6=3I3=1I => -13 + 10 - 5 + 6 - 9 + 3 - 5 |
4334 |
25 Mar 23 |
peter |
40 |
double score = aligner(ref.begin(), ref.end(), seq.begin(), seq.end(), 5); |
4334 |
25 Mar 23 |
peter |
41 |
suite.out() << "score: " << score << "\n"; |
4334 |
25 Mar 23 |
peter |
42 |
if (!suite.equal(score, -13)) { |
4334 |
25 Mar 23 |
peter |
43 |
suite.add(false); |
4334 |
25 Mar 23 |
peter |
44 |
suite.err() << "incorrect score\n"; |
4334 |
25 Mar 23 |
peter |
45 |
} |
4334 |
25 Mar 23 |
peter |
46 |
utility::Aligner::Cigar cigar("5D10=1D6=3I3=1I"); |
4334 |
25 Mar 23 |
peter |
47 |
if (aligner.cigar() != cigar) { |
4334 |
25 Mar 23 |
peter |
48 |
suite.add(false); |
4334 |
25 Mar 23 |
peter |
49 |
suite.err() << "CIGAR: " << aligner.cigar() << "\n"; |
4334 |
25 Mar 23 |
peter |
50 |
suite.err() << "expected:" << cigar << "\n"; |
4334 |
25 Mar 23 |
peter |
51 |
} |
4334 |
25 Mar 23 |
peter |
52 |
|
4334 |
25 Mar 23 |
peter |
53 |
return suite.return_value(); |
4334 |
25 Mar 23 |
peter |
54 |
} |