?? rna_algebra.h
字號:
private: Score m_s; public: double empty() const {return 0.0;}; double replace(RNA_Alphabet_Profile a,double down, RNA_Alphabet_Profile b, double over) const { if(a.p[ALPHA_PRO_BASEPAIR]>0 && b.p[ALPHA_PRO_BASEPAIR]>0) { // pair replacement return a.p[ALPHA_PRO_BASEPAIR]*b.p[ALPHA_PRO_BASEPAIR]*m_s.m_bp_rep_score + down+over; } else { if(a.p[ALPHA_PRO_BASE]>0 && b.p[ALPHA_PRO_BASE]>0) { double s=0; // base replacement for(int i=ALPHA_PRO_BASE_A;i<=ALPHA_PRO_BASE_U;i++) for(int j=ALPHA_PRO_BASE_A;j<=ALPHA_PRO_BASE_U;j++) s+= i==j ? a.p[i]*b.p[j]*m_s.m_b_match_score : a.p[i]*b.p[j]*m_s.m_b_rep_score; if(s==0) // no sequence information s=a.p[ALPHA_PRO_BASE]*b.p[ALPHA_PRO_BASE]*m_s.m_b_rep_score; return s+down+over; } else { // undefined operation (replace base by basepair ??) return DBL_NEG/4; } } }; double del(RNA_Alphabet_Profile a,double down, double over) const { if(a.p[ALPHA_PRO_BASEPAIR]>0) return a.p[ALPHA_PRO_BASEPAIR]*m_s.m_bp_del_score+down+over; else return a.p[ALPHA_PRO_BASE]*m_s.m_b_del_score+down+over; }; double insert(double down,RNA_Alphabet_Profile b,double over) const { if(b.p[ALPHA_PRO_BASEPAIR]>0) return b.p[ALPHA_PRO_BASEPAIR]*m_s.m_bp_del_score+down+over; else return b.p[ALPHA_PRO_BASE]*m_s.m_b_del_score+down+over; }; double choice(double a, double b) const { return max(a,b); }; double worst_score() const { return DBL_NEG; }; DoubleSimiProfileAlgebra(const Score &s) : m_s(s) {};};/** Distance algebra for RNA profile forests */class DoubleDistProfileAlgebra : public DoubleScoreProfileAlgebraType{ private: Score m_s; public: double empty() const {return 0.0;}; double replace(RNA_Alphabet_Profile a,double down, RNA_Alphabet_Profile b, double over) const { TRACE(DBG_ALGEBRA,"rep","inside!!!"); if(a.p[ALPHA_PRO_BASEPAIR]>0 && b.p[ALPHA_PRO_BASEPAIR]>0) { // pair replacement return a.p[ALPHA_PRO_BASEPAIR]*b.p[ALPHA_PRO_BASEPAIR]*m_s.m_bp_rep_score + down+over; } else { if(a.p[ALPHA_PRO_BASE]>0 && b.p[ALPHA_PRO_BASE]>0) { double s=0; // base replacement for(int i=ALPHA_PRO_BASE_A;i<=ALPHA_PRO_BASE_U;i++) for(int j=ALPHA_PRO_BASE_A;j<=ALPHA_PRO_BASE_U;j++) s+= i==j ? a.p[i]*b.p[j]*m_s.m_b_match_score : a.p[i]*b.p[j]*m_s.m_b_rep_score; if(s==0) // no sequence information s=a.p[ALPHA_PRO_BASE]*b.p[ALPHA_PRO_BASE]*m_s.m_b_rep_score; return s+down+over; } else { // undefined operation (replace base by basepair ??) return DBL_POS/4; } } }; double del(RNA_Alphabet_Profile a,double down, double over) const { if(a.p[ALPHA_PRO_BASEPAIR]>0) return a.p[ALPHA_PRO_BASEPAIR]*m_s.m_bp_del_score+down+over; else return a.p[ALPHA_PRO_BASE]*m_s.m_b_del_score+down+over; }; double insert(double down,RNA_Alphabet_Profile b,double over) const { if(b.p[ALPHA_PRO_BASEPAIR]>0) return b.p[ALPHA_PRO_BASEPAIR]*m_s.m_bp_del_score+down+over; else return b.p[ALPHA_PRO_BASE]*m_s.m_b_del_score+down+over; }; double choice(double a, double b) const {
return min(a,b);
}; double worst_score() const { return DBL_POS; }; DoubleDistProfileAlgebra(const Score &s) : m_s(s) {};};
/* ****************************************** *//* SZAlgebra Classes *//* ****************************************** */class IntSimiSZAlgebra : public IntScoreSZAlgebraType{ private: Score m_s; public: int empty() const {return 0;}; int replace(RNA_Alphabet a,int down, RNA_Alphabet b) const { if(a==ALPHA_BASEPAIR && b == ALPHA_BASEPAIR) return m_s.m_bp_rep_score+down; else { if(a==ALPHA_BASEPAIR || b==ALPHA_BASEPAIR) return INT_MIN/4; else { if(a==b) return m_s.m_b_match_score+down; else return m_s.m_b_rep_score+down; } } }; int del(RNA_Alphabet a,int down) const { if(a==ALPHA_BASEPAIR) return m_s.m_bp_del_score+down; else return m_s.m_b_del_score+down; }; int insert(int down,RNA_Alphabet b) const { if(b==ALPHA_BASEPAIR) return m_s.m_bp_del_score+down; else return m_s.m_b_del_score+down; }; int choice(int a, int b) const {
return max(a,b);
}; int worst_score() const { return INT_MIN; }; IntSimiSZAlgebra(const Score &s) : m_s(s) {};};class IntDistSZAlgebra : public IntScoreSZAlgebraType
{
private:
Score m_s;
public:
int empty() const {return 0;};
int replace(RNA_Alphabet a,int down, RNA_Alphabet b) const
{
if(a==ALPHA_BASEPAIR && b == ALPHA_BASEPAIR)
return m_s.m_bp_rep_score+down;
else
{
if(a==ALPHA_BASEPAIR || b==ALPHA_BASEPAIR)
return INT_MAX/4;
else
{
if(a==b)
return m_s.m_b_match_score+down;
else
return m_s.m_b_rep_score+down;
}
}
};
int del(RNA_Alphabet a,int down) const
{
if(a==ALPHA_BASEPAIR)
return m_s.m_bp_del_score+down;
else
return m_s.m_b_del_score+down;
};
int insert(int down,RNA_Alphabet b) const
{
if(b==ALPHA_BASEPAIR)
return m_s.m_bp_del_score+down;
else
return m_s.m_b_del_score+down;
};
int choice(int a, int b) const
{
return min(a,b);
};
int worst_score() const
{
return INT_MAX;
};
IntDistSZAlgebra(const Score &s)
: m_s(s) {};
};/* ****************************************** *//* General Algebra Classe *//* ****************************************** *//** Distance algebra for forests */class IntDist_Algebra : public IntScore_AlgebraType{ private: Score m_s; public: int empty() const {return 0;}; int replace(RNA_Alphabet a,int down, RNA_Alphabet b, int over) const { if(a==ALPHA_BASEPAIR && b == ALPHA_BASEPAIR) return m_s.m_bp_rep_score+down+over; else { if(a==ALPHA_BASEPAIR || b==ALPHA_BASEPAIR) return INT_MAX/4; else { if(a==b) return m_s.m_b_match_score+down+over; else return m_s.m_b_rep_score+down+over; } } }; int del(RNA_Alphabet a,int down,int over) const { if(a==ALPHA_BASEPAIR) return m_s.m_bp_del_score+down+over; else return m_s.m_b_del_score+down+over; }; int insert(int down,RNA_Alphabet b,int over) const { if(b==ALPHA_BASEPAIR) return m_s.m_bp_del_score+down+over; else return m_s.m_b_del_score+down+over; }; int choice(int a, int b) const {
return min(a,b);
}; int worst_score() const { return INT_MAX; }; IntDist_Algebra(const Score &s) : m_s(s) {};};#endif
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -