source: trunk/yat/utility/Alignment.h @ 867

Last change on this file since 867 was 867, checked in by Peter, 15 years ago

adding function doing a SSEARCH between two strings

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
Line 
1#ifndef _theplu_yat_utility_alignment_
2#define _theplu_yat_utility_alignment_
3
4// $Id: Alignment.h 867 2007-09-13 19:36:50Z peter $
5
6/*
7  Copyright (C) 2004 Jari Häkkinen, Peter Johansson
8  Copyright (C) 2005 Peter Johansson
9  Copyright (C) 2006 Jari Häkkinen
10
11  This file is part of the yat library, http://trac.thep.lu.se/trac/yat
12
13  The yat library is free software; you can redistribute it and/or
14  modify it under the terms of the GNU General Public License as
15  published by the Free Software Foundation; either version 2 of the
16  License, or (at your option) any later version.
17
18  The yat library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21  General Public License for more details.
22
23  You should have received a copy of the GNU General Public License
24  along with this program; if not, write to the Free Software
25  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26  02111-1307, USA.
27*/
28
29#include <utility>
30#include <vector>
31
32namespace theplu {
33namespace yat {
34namespace utility {
35
36  class matrix;
37
38  ///
39  /// Function performing alignment following the Needleman-Wunch
40  /// algorithm. The algorithm starts from the dot-matrix, \a s, where
41  /// \f$ s_{ij} \f$ describes how well element \f$ i \f$ in the first
42  /// sequence match to element \f$ j \f$ in the second sequence. A
43  /// path through this matrix corresponds to an alignment of the two
44  /// sequences, in which a diagonal step over a matrix element
45  /// corresponds to a match between the corresponding sequnce
46  /// elements and a vertical or a horizontal step corresponds to
47  /// inserting a gap in one of the sequnces. The function maximizes
48  /// \f$ \sum s_{ij}-n \f$ \a gap, where the first sum goes over all
49  /// matches and the second term is a penalty term for inserting \f$
50  /// n \f$ gaps. Default is to have the \a gap cost set to zero. The
51  /// vector \a path contains information about which elements that
52  /// were matched. If the first element in the first sequence was
53  /// matched to the first element in the second sequence, the last
54  /// element in \a path is pair(0,0).
55  ///
56  /// @return the global maximum alignment score.
57  ///
58  double NeedlemanWunsch(const utility::matrix& s,
59                         std::vector<std::pair<size_t, size_t> >& path,
60                         const double gap);
61
62  /**
63     SSearch does a rigorous Smith-Waterman (Needleman-Wunsch with no gap
64     cost) search for similarity between a sequnces. For long sequences this
65     may be very expensive (both in time and space) and BLAST or FASTA is
66     preferable.
67
68     @return number of matches
69   */
70  unsigned int ssearch(std::string first, std::string second);
71
72}}} // of namespace utility, yat, and theplu
73
74#endif
Note: See TracBrowser for help on using the repository browser.