1 | #ifndef _theplu_yat_utility_alignment_ |
---|
2 | #define _theplu_yat_utility_alignment_ |
---|
3 | |
---|
4 | // $Id: Alignment.h 687 2006-10-16 23:51:10Z jari $ |
---|
5 | |
---|
6 | /* |
---|
7 | Copyright (C) The authors contributing to this file. |
---|
8 | |
---|
9 | This file is part of the yat library, http://lev.thep.lu.se/trac/yat |
---|
10 | |
---|
11 | The yat library is free software; you can redistribute it and/or |
---|
12 | modify it under the terms of the GNU General Public License as |
---|
13 | published by the Free Software Foundation; either version 2 of the |
---|
14 | License, or (at your option) any later version. |
---|
15 | |
---|
16 | The yat library is distributed in the hope that it will be useful, |
---|
17 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
18 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
---|
19 | General Public License for more details. |
---|
20 | |
---|
21 | You should have received a copy of the GNU General Public License |
---|
22 | along with this program; if not, write to the Free Software |
---|
23 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
---|
24 | 02111-1307, USA. |
---|
25 | */ |
---|
26 | |
---|
27 | #include <utility> |
---|
28 | #include <vector> |
---|
29 | |
---|
30 | namespace theplu { |
---|
31 | namespace yat { |
---|
32 | namespace utility { |
---|
33 | |
---|
34 | class matrix; |
---|
35 | |
---|
36 | /// |
---|
37 | /// Function performing alignment following the Needleman-Wunch |
---|
38 | /// algorithm. The algorithm starts from the dot-matrix, \a s, where |
---|
39 | /// \f$ s_{ij} \f$ describes how well element \f$ i \f$ in the first |
---|
40 | /// sequence match to element \f$ j \f$ in the second sequence. A |
---|
41 | /// path through this matrix corresponds to an alignment of the two |
---|
42 | /// sequences, in which a diagonal step over a matrix element |
---|
43 | /// corresponds to a match between the corresponding sequnce |
---|
44 | /// elements and a vertical or a horizontal step corresponds to |
---|
45 | /// inserting a gap in one of the sequnces. The function maximizes |
---|
46 | /// \f$ \sum s_{ij}-n \f$ \a gap, where the first sum goes over all |
---|
47 | /// matches and the second term is a penalty term for inserting \f$ |
---|
48 | /// n \f$ gaps. Default is to have the \a gap cost set to zero. The |
---|
49 | /// vector \a path contains information about which elements that |
---|
50 | /// were matched. If the first element in the first sequence was |
---|
51 | /// matched to the first element in the second sequence, the last |
---|
52 | /// element in \a path is pair(0,0). |
---|
53 | /// |
---|
54 | /// @return the global maximum alignment score. |
---|
55 | /// |
---|
56 | double NeedlemanWunsch(const utility::matrix& s, |
---|
57 | std::vector<std::pair<size_t, size_t> >& path, |
---|
58 | const double gap); |
---|
59 | |
---|
60 | }}} // of namespace utility, yat, and theplu |
---|
61 | |
---|
62 | #endif |
---|