00001
00002
00003 #ifndef NUSSINOVALGORITHM_NUSSINOVALGORITHM_H_
00004 #define NUSSINOVALGORITHM_NUSSINOVALGORITHM_H_
00005
00006 #include <gtest/gtest.h>
00007 #include <string>
00008 #include <vector>
00009 #include <utility>
00010 using std::string;
00011 using std::vector;
00012
00013 class NussinovAlgorithm
00014 {
00015 public:
00016
00017
00018
00019 FRIEND_TEST(NussinovAlgorithmTest, computeStructure);
00020 void computeStructure(const std::string& input,
00021 std::vector<std::pair<int, int> >* result);
00022
00023
00024
00025 void printMatrix() const;
00026 FRIEND_TEST(NussinovAlgorithmTest, printMatrix);
00027
00028
00029 FRIEND_TEST(NussinovAlgorithmTest, printStructure);
00030 void printStructure(const std::vector<std::pair<int, int> >&
00031 result) const;
00032
00033 private:
00034
00035
00036 string _sequence;
00037
00038
00039
00040 vector< vector<int> > _maxNumPairs;
00041
00042
00043
00044 vector< vector<int> > _traceBack;
00045
00046
00047
00048
00049 void initNussinov(const std::string& input);
00050 FRIEND_TEST(NussinovAlgorithmTest, initNussinov);
00051
00052
00053 void findMaxPairs();
00054 FRIEND_TEST(NussinovAlgorithmTest, findMaxPairs);
00055
00056
00057
00058 void traceBack(int i, int j,
00059 std::vector<std::pair<int, int> >* result);
00060 FRIEND_TEST(NussinovAlgorithmTest, traceBack);
00061
00062
00063
00064 bool isPaired(char xi, char xj);
00065 FRIEND_TEST(NussinovAlgorithmTest, isPaired);
00066 };
00067
00068 #endif // NUSSINOVALGORITHM_NUSSINOVALGORITHM_H_