blast.h
Go to the documentation of this file.00001 #ifndef ALNSUMMARY_H
00002 #define ALNSUMMARY_H
00003 #include <string>
00004 #include <iostream>
00005
00006 #ifndef LINE
00007 #define LINE 90
00008 #endif
00009
00010
00011
00012
00013
00014
00015
00016
00017 #define MATRIX BLOSUM62
00018 #define Mexp -0.945
00019
00020 extern const int PAM120[24][24];
00021 extern const int BLOSUM62[24][24];
00022 extern const int BLOSUM62_12[24][24];
00023 extern const double aafq[20];
00024
00025 using namespace std;
00026
00027 void split(char ln[], int &s, string &seq, int &e);
00028
00029
00030 class alnsummary
00031 {
00032 public:
00033 int score() const {return s;}
00034 bool scoreHigherThan(double ss) const {return s>ss;}
00035 bool scoreLessThan(double ss) const {return s<ss;}
00036 void read(const char ln[], int ss);
00037 bool eLessThan(double ee) const {return e < ee;}
00038 bool eMoreThan(double ee) const {return e > ee;}
00039 string subjName() const ;
00040
00041 private:
00042 string subj;
00043 int s;
00044 double e;
00045 int n;
00046 };
00047
00048
00049
00050 class alignment
00051 {
00052 public:
00053 int read(istream &ins, char ln[], string &bf);
00054
00055
00056
00057 int begin() const {return qs;}
00058 int end() const {return qe;}
00059 int sbjbegin() const {return ss;}
00060 int sbjend() const {return se;}
00061 float score() const {return sco;}
00062 double eValue() const {return exp;}
00063 int length() const {return len;}
00064 int identical_residue() const {return iden;}
00065 double calBias(double &efflen, int psw = 6) const;
00066
00067 string querySeq() const {return qseq;}
00068 string matchSeq() const {return sbjseq;}
00069 float identity() const {return (float)iden/len;}
00070 bool isup() const {return qe>qs;}
00071 bool iscompl() const {return qs>qe;}
00072
00073 friend void split(char ln[], int &s, string &seq, int &e);
00074
00075 friend class region;
00076
00077 private:
00078
00079 float sco;
00080 double exp;
00081 int iden;
00082 int simil;
00083 int len;
00084 string qseq;
00085 string sbjseq;
00086 int qs;
00087 int qe;
00088 int ss;
00089 int se;
00090 };
00091
00092 class region
00093 {
00094 public:
00095 region(const alignment &al);
00096 void assign(int be, int en, float sc, double ex);
00097 int cover(region &r) const;
00098
00099
00100 int add(const alignment &r, bool &accept, double scut,
00101 double ecut, int cl);
00102
00103
00104
00105 bool isup() const {return f>s;}
00106 bool iscompl() const {return s>f;}
00107 bool sameDirection(alignment &r) const;
00108 int distance(const alignment &aa) const;
00109
00110
00111
00112 private:
00113 int s, f;
00114 float hs;
00115 double exp;
00116 int tc;
00117 };
00118
00119 #endif