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