source: branches/0.12-stable/test/cigar2.cc @ 3339

Last change on this file since 3339 was 3339, checked in by Peter, 7 years ago

Fix problem that Aligner::member_ is not cleared to 'none' before
aligning, which means that the beginning of alignment could be
incorrect. Fixes #820.

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