blast.h
Go to the documentation of this file.00001 #ifndef ALNSUMMARY_H
00002 #define ALNSUMMARY_H
00003 #include <string>
00004 #include <cstring>
00005 #include <iostream>
00006
00007 #ifndef LINE
00008 #define LINE 90
00009 #endif
00010
00011
00012
00013
00014
00015
00016
00017
00018 #define MATRIX BLOSUM62
00019 #define Mexp -0.945
00020
00021 using namespace std;
00022
00023 extern const int PAM120[24][24];
00024 extern const int BLOSUM62[24][24];
00025 extern const int BLOSUM62_12[24][24];
00026 extern const double aafq[20];
00027
00028
00029 class alnsummary
00030 {
00031 public:
00032 int score() const {return s;}
00033 bool scoreHigherThan(double ss) const {return s>ss;}
00034 bool scoreLessThan(double ss) const {return s<ss;}
00035 void read(const char ln[], int ss);
00036 bool eLessThan(double ee) const {return e < ee;}
00037 bool eMoreThan(double ee) const {return e > ee;}
00038 string subjName() const ;
00039
00040 private:
00041 string subj;
00042 int s;
00043 double e;
00044 int n;
00045 };
00046
00047 void split(char ln[], int &s, string &seq, int &e);
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 class region;
00074
00075 private:
00076
00077
00078 float sco;
00079 double exp;
00080 int iden;
00081 int simil;
00082 int len;
00083 string qseq;
00084 string sbjseq;
00085 int qs;
00086 int qe;
00087 int ss;
00088 int se;
00089 };
00090
00091 class region
00092 {
00093 public:
00094 region(const alignment &al);
00095 void assign(int be, int en, float sc, double ex);
00096 int cover(region &r) const;
00097
00098
00099 int add(const alignment &r, bool &accept, double scut,
00100 double ecut, int cl);
00101
00102
00103
00104 bool isup() const {return f>s;}
00105 bool iscompl() const {return s>f;}
00106 bool sameDirection(alignment &r) const;
00107 int distance(const alignment &aa) const;
00108
00109
00110
00111 private:
00112 int s, f;
00113 float hs;
00114 double exp;
00115 int tc;
00116 };
00117
00118 #endif