OpenMS
NeedlemanWunsch.h
Go to the documentation of this file.
1 // Copyright (c) 2002-present, OpenMS Inc. -- EKU Tuebingen, ETH Zurich, and FU Berlin
2 // SPDX-License-Identifier: BSD-3-Clause
3 //
4 // --------------------------------------------------------------------------
5 // $Maintainer: Nora Wild $
6 // $Authors: Nora Wild $
7 // --------------------------------------------------------------------------
8 
10 #include <OpenMS/OpenMSConfig.h>
11 
12 #include <vector>
13 
14 namespace OpenMS
15 {
20  class OPENMS_DLLAPI NeedlemanWunsch
21  {
22 
23  public:
24 
26  enum class ScoringMatrix
27  {
28  identity,
29  PAM30MS,
30  SIZE_OF_SCORINGMATRIX
31  };
32 
34  NeedlemanWunsch(ScoringMatrix matrix, int penalty);
35 
37  NeedlemanWunsch() = default;
38 
40  ~NeedlemanWunsch()=default;
41 
43  static const std::vector<std::string> NamesOfScoringMatrices;
44 
49  int align(const String& seq1, const String& seq2);
50 
55  void setMatrix(const ScoringMatrix& matrix);
56  void setMatrix(const std::string& matrix);
57 
59  void setPenalty(const int penalty);
60 
63 
65  int getPenalty() const;
66 
67  private:
68  int gap_penalty_ = 5;
69  ScoringMatrix my_matrix_ = ScoringMatrix::PAM30MS;
70  std::vector<int> first_row_{};
71  std::vector<int> second_row_{};
72  };
73 
74 }
This class contains functions that are used to calculate the global alignment score of two amino acid...
Definition: NeedlemanWunsch.h:21
NeedlemanWunsch(ScoringMatrix matrix, int penalty)
Constructor that sets the scoring matrix and the gap penalty.
ScoringMatrix
contains the valid matrices and the number of them
Definition: NeedlemanWunsch.h:27
static const std::vector< std::string > NamesOfScoringMatrices
Names of valid matrices.
Definition: NeedlemanWunsch.h:43
~NeedlemanWunsch()=default
Default destructor.
void setMatrix(const std::string &matrix)
void setPenalty(const int penalty)
sets the cost of gaps
int align(const String &seq1, const String &seq2)
Calculates the similarity score of the global alignment of two amino acid sequences using Needleman-W...
void setMatrix(const ScoringMatrix &matrix)
sets the scoring matrix. Takes either a string or the enum ScoringMatrix.
int getPenalty() const
returns the gap penalty
ScoringMatrix getMatrix() const
returns the scoring matrix
NeedlemanWunsch()=default
Default constructor (scoring matrix PAM30MS and penalty 5)
A more convenient string class.
Definition: String.h:34
Main OpenMS namespace.
Definition: openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19