OpenMS
Loading...
Searching...
No Matches
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
14namespace OpenMS
15{
33 class OPENMS_DLLAPI NeedlemanWunsch
34 {
35
36 public:
37
39 enum class ScoringMatrix
40 {
41 identity,
42 PAM30MS,
43 SIZE_OF_SCORINGMATRIX
44 };
45
52 NeedlemanWunsch(ScoringMatrix matrix, int penalty);
53
59 NeedlemanWunsch() = default;
60
65
67 static const std::vector<std::string> NamesOfScoringMatrices;
68
80 int align(const std::string& seq1, const std::string& seq2);
81
87 void setMatrix(const ScoringMatrix& matrix);
88
100 void setMatrix(const std::string& matrix);
101
109 void setPenalty(const int penalty);
110
119
126 int getPenalty() const;
127
128 private:
129 int gap_penalty_ = 5;
130 ScoringMatrix my_matrix_ = ScoringMatrix::PAM30MS;
131 std::vector<int> first_row_{};
132 std::vector<int> second_row_{};
133 };
134
135}
Global-alignment similarity score for two amino-acid sequences using the Needleman-Wunsch algorithm.
Definition NeedlemanWunsch.h:34
NeedlemanWunsch(ScoringMatrix matrix, int penalty)
Construct with a chosen scoring matrix and gap penalty.
ScoringMatrix
Substitution matrices bundled with this class.
Definition NeedlemanWunsch.h:40
static const std::vector< std::string > NamesOfScoringMatrices
Lookup table for setMatrix(const std::string&); current entries: "identity", "PAM30MS".
Definition NeedlemanWunsch.h:67
~NeedlemanWunsch()=default
Destructor.
void setMatrix(const std::string &matrix)
Select the scoring matrix by name; the accepted names are listed in NamesOfScoringMatrices.
void setPenalty(const int penalty)
Set the linear gap penalty subtracted per gap step.
int align(const std::string &seq1, const std::string &seq2)
Compute the Needleman-Wunsch similarity score of seq1 vs. seq2.
void setMatrix(const ScoringMatrix &matrix)
Select the scoring matrix used by align.
int getPenalty() const
Currently configured gap penalty.
ScoringMatrix getMatrix() const
Currently selected scoring matrix.
NeedlemanWunsch()=default
Default constructor.
Main OpenMS namespace.
Definition openswathalgo/include/OpenMS/OPENSWATHALGO/DATAACCESS/ISpectrumAccess.h:19