/* * gapped_extension.h * * Created on: 2016/8/31 * Author: Tsukasa Fukunaga */ #ifndef GAPPED_EXTENSION_H #define GAPPED_EXTENSION_H #include "hit.h" #include using namespace std; #define MAX_EXTENSION 100000 class Stem{ public: Stem(int a, int b, int c){ first = a; second = b; type = c; } void set(int a, int b, int c){ first = a; second = b; type = c; } int first; int second; int type; }; class Cell{ public: Cell(int a, int b, double c, double d){ first = a; second = b; interaction_energy = c; hybrid_energy = d; } void set(int a, int b, double c, double d){ first = a; second = b; interaction_energy = c; hybrid_energy = d; } int first; int second; double hybrid_energy; double interaction_energy; }; class CheckStemCandidate{ public: CheckStemCandidate(int a){ loop_size = a; } bool operator()(const Stem &x) const { return(length-x.first-x.second-2 > loop_size);} void SetLength(int a){length = a;} private: int loop_size; int length; }; class GappedExtension { public: GappedExtension(int a, int x){ _min_accessible_length = a; _drop_out_score = x; } void Run(vector &candidate, vector &query_seq, vector &db_seq, vector &query_accessibility, vector &query_conditional_accessibility, vector > &db_accessibility,vector > &db_conditional_accessibility, vector &db_seq_length); private: int _min_accessible_length; int _drop_out_score; int GetChar(vector &seq, int i); void traceback(Hit &candidate, vector > &matrix_c, int i,int i_start, int j, int j_start, bool flag); void extension(Hit &candidate, vector &query_seq, vector &db_seq, vector &query_accessibility, vector &query_conditional_accessibility, vector > &db_accessibility,vector > &db_conditional_accessibility, bool flag); double LoopEnergy(int type, int type2,int i,int j,int p,int q, vector &query_seq, vector &db_seq); double CalcDangleEnergy(int q_pos, int db_pos, int flag, vector &query_seq, vector &db_seq, int dbseq_length); }; #endif