match.h
Go to the documentation of this file.00001
00002 #include <iostream>
00003 #include <string>
00004 #include <vector>
00005
00006 using namespace std;
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 class inputException {};
00022
00023 class match
00024 {
00025 public:
00026 match(istream &in) throw(inputException);
00027 match(const match &m);
00028 match& operator=(const match &m);
00029 friend ostream& operator<<(ostream &o, const match &m);
00030 bool overlap(const match &m) const;
00031 float getScore() const { return score; }
00032 int getLength() const { return length; }
00033 float getLenxid() const { return length*identity; }
00034 double getE() const { return E; }
00035
00036 private:
00037 float identity;
00038 int length, mismatch, gap, qstart, qend, tstart, tend;
00039 double E;
00040 float score;
00041 };
00042
00043
00044
00045
00046 class hit
00047 {
00048 public:
00049 class end {};
00050
00051 hit() : score(0), matches(), matchCnt(0) {}
00052
00053
00054 hit(string &q, string &t, istream &in) throw(end, inputException);
00055
00056
00057 void getNext(istream &in);
00058 bool sameQuery(const string &nq) const { return query==nq; }
00059 bool sameTarget(const string &nt) const { return target==nt; }
00060 bool sameHit(const string &q, const string &t) const;
00061 bool overlap(const match &m) const;
00062
00063 bool scoreAsBigAs(const hit &h, float r) const { return score > r*h.score; }
00064
00065
00066
00067
00068 friend ostream& operator<<(ostream &o, const hit &h);
00069 int getLength() const { return length; }
00070
00071
00072 int getMatchCount() const { return matches.size(); }
00073 int getTotalMatch() const { return matchCnt; }
00074 void dumpRaw(ostream &o) const;
00075 float getIdentity() const { return identity; }
00076 float getScore() const { return score; }
00077
00078
00079 static char fields[];
00080
00081 private:
00082 string query, target;
00083 vector<match> matches;
00084 float score;
00085 int matchCnt;
00086 int length;
00087 float identity;
00088 double minE;
00089 double prodE;
00090 };
00091