00001 #ifndef ALGO___MM_ALIGNER__HPP
00002 #define ALGO___MM_ALIGNER__HPP
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044 #include "nw_aligner.hpp"
00045 #include <list>
00046 #include <corelib/ncbithr.hpp>
00047
00048
00049
00050
00051
00052
00053
00054
00055 BEGIN_NCBI_SCOPE
00056
00057 struct SCoordRect;
00058
00059
00060 class CMMAligner: public CNWAligner
00061 {
00062 public:
00063
00064 CMMAligner();
00065
00066 CMMAligner(const char* seq1, size_t len1,
00067 const char* seq2, size_t len2,
00068 const SNCBIPackedScoreMatrix* scoremat = 0);
00069
00070 CMMAligner(const string& seq1,
00071 const string& seq2,
00072 const SNCBIPackedScoreMatrix* scoremat = 0);
00073
00074 virtual ~CMMAligner() {}
00075
00076 protected:
00077
00078 list<ETranscriptSymbol> m_TransList;
00079
00080 virtual TScore x_Run();
00081
00082 void x_DoSubmatrix(const SCoordRect& submatr,
00083 list<ETranscriptSymbol>::iterator translist_pos,
00084 bool left_top, bool right_bottom);
00085
00086 void x_RunTop(const SCoordRect& rect,
00087 vector<TScore>& vE, vector<TScore>& vF, vector<TScore>& vG,
00088 vector<unsigned char>& trace, bool lt) const;
00089
00090 void x_RunBtm(const SCoordRect& rect,
00091 vector<TScore>& vE, vector<TScore>& vF, vector<TScore>& vG,
00092 vector<unsigned char>& trace, bool rb) const;
00093
00094 TScore x_RunTerm(const SCoordRect& rect,
00095 bool left_top, bool right_bottom,
00096 list<ETranscriptSymbol>& subpath);
00097
00098 enum ETransitionType {
00099 eII = 0, eDI, eGI,
00100 eID, eDD, eGD,
00101 eIG, eDG, eGG
00102 };
00103 TScore x_FindBestJ( const vector<TScore>& vEtop,
00104 const vector<TScore>& vFtop,
00105 const vector<TScore>& vGtop,
00106 const vector<TScore>& vEbtm,
00107 const vector<TScore>& vFbtm,
00108 const vector<TScore>& vGbtm,
00109 size_t& pos,
00110 ETransitionType& trans_type ) const;
00111
00112 size_t x_ExtendSubpath(vector<unsigned char>::const_iterator trace_it,
00113 bool direction,
00114 list<ETranscriptSymbol>& subpath) const;
00115
00116 virtual bool x_CheckMemoryLimit();
00117
00118 friend class CThreadRunOnTop;
00119 friend class CThreadDoSM;
00120
00121 };
00122
00123
00124
00125 struct SCoordRect {
00126 size_t i1, j1, i2, j2;
00127 SCoordRect() {};
00128 SCoordRect(size_t l, size_t t, size_t r, size_t b):
00129 i1(l), j1(t), i2(r), j2(b) {}
00130 unsigned int GetArea() {
00131 return (i2 - i1 + 1)*(j2 - j1 + 1);
00132 }
00133 };
00134
00135
00136 END_NCBI_SCOPE
00137
00138
00139
00140
00141 #endif
00142
00143