3209 |
04 May 14 |
peter |
// $Id$ |
3209 |
04 May 14 |
peter |
2 |
|
3209 |
04 May 14 |
peter |
3 |
/* |
3209 |
04 May 14 |
peter |
Copyright (C) 2014 Peter Johansson |
3209 |
04 May 14 |
peter |
5 |
|
3209 |
04 May 14 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
3209 |
04 May 14 |
peter |
7 |
|
3209 |
04 May 14 |
peter |
The yat library is free software; you can redistribute it and/or |
3209 |
04 May 14 |
peter |
modify it under the terms of the GNU General Public License as |
3209 |
04 May 14 |
peter |
published by the Free Software Foundation; either version 3 of the |
3209 |
04 May 14 |
peter |
License, or (at your option) any later version. |
3209 |
04 May 14 |
peter |
12 |
|
3209 |
04 May 14 |
peter |
The yat library is distributed in the hope that it will be useful, |
3209 |
04 May 14 |
peter |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
3209 |
04 May 14 |
peter |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
3209 |
04 May 14 |
peter |
General Public License for more details. |
3209 |
04 May 14 |
peter |
17 |
|
3209 |
04 May 14 |
peter |
You should have received a copy of the GNU General Public License |
3209 |
04 May 14 |
peter |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
3209 |
04 May 14 |
peter |
20 |
*/ |
3209 |
04 May 14 |
peter |
21 |
|
3209 |
04 May 14 |
peter |
22 |
#include <config.h> |
3209 |
04 May 14 |
peter |
23 |
|
3209 |
04 May 14 |
peter |
24 |
#include "Suite.h" |
3209 |
04 May 14 |
peter |
25 |
|
3209 |
04 May 14 |
peter |
26 |
#include "yat/utility/Matrix.h" |
3209 |
04 May 14 |
peter |
27 |
#include "yat/utility/SmithWaterman.h" |
3209 |
04 May 14 |
peter |
28 |
|
3209 |
04 May 14 |
peter |
29 |
using namespace theplu::yat; |
3209 |
04 May 14 |
peter |
30 |
|
3209 |
04 May 14 |
peter |
31 |
int main(int argc, char* argv[]) |
3209 |
04 May 14 |
peter |
32 |
{ |
3209 |
04 May 14 |
peter |
33 |
test::Suite suite(argc, argv); |
3209 |
04 May 14 |
peter |
34 |
|
3209 |
04 May 14 |
peter |
35 |
std::string ref = "XXXXXABCDEFGHIJDKLMNOPQRSTUVWXYZABCDEFGHXXXXXXXXXXXXXXX"; |
3209 |
04 May 14 |
peter |
36 |
std::string seq = "SSABCDEFGHIJKLMNOPQRSTUIVWXYZxBCDEFGHS"; |
3209 |
04 May 14 |
peter |
37 |
|
3209 |
04 May 14 |
peter |
38 |
suite.out() << "ref: " << ref << "\n"; |
3209 |
04 May 14 |
peter |
39 |
suite.out() << "seq: " << seq << "\n"; |
3209 |
04 May 14 |
peter |
40 |
|
3209 |
04 May 14 |
peter |
41 |
utility::SmithWaterman sw(2,3); |
3209 |
04 May 14 |
peter |
42 |
double score = sw(ref.begin(), ref.end(), seq.begin(), seq.end(), 3); |
3209 |
04 May 14 |
peter |
43 |
suite.out() << "sw score: " << score << "\n"; |
3209 |
04 May 14 |
peter |
44 |
|
3209 |
04 May 14 |
peter |
45 |
utility::Aligner::Cigar cig = sw.cigar(); |
3209 |
04 May 14 |
peter |
46 |
std::ostringstream os; |
3209 |
04 May 14 |
peter |
47 |
os << cig; |
3209 |
04 May 14 |
peter |
48 |
suite.out() << os.str() << "\n"; |
3209 |
04 May 14 |
peter |
49 |
std::string str = "2S10=1D11=1I5=1X7=1S"; |
3209 |
04 May 14 |
peter |
50 |
if (os.str()!=str) { |
3209 |
04 May 14 |
peter |
51 |
suite.add(false); |
3209 |
04 May 14 |
peter |
52 |
suite.err() << "error: incorrect CIGAR string, expected\n" << str << "\n"; |
3209 |
04 May 14 |
peter |
53 |
} |
3209 |
04 May 14 |
peter |
54 |
|
3209 |
04 May 14 |
peter |
55 |
suite.out() << "pos: " << sw.position() << "\n"; |
3209 |
04 May 14 |
peter |
56 |
if (sw.position()!=5) |
3209 |
04 May 14 |
peter |
57 |
suite.err() << "error: wrong position: " << sw.position() |
3209 |
04 May 14 |
peter |
58 |
<< " expected 4\n"; |
3209 |
04 May 14 |
peter |
59 |
|
3209 |
04 May 14 |
peter |
60 |
utility::Matrix x = sw.score(); |
3209 |
04 May 14 |
peter |
61 |
return suite.return_value(); |
3209 |
04 May 14 |
peter |
62 |
} |