Gmapres.h

Go to the documentation of this file.
00001 #ifndef GMAPRES_H
00002 #define GMAPRES_H
00003 
00004 #include "GenModel.h"
00005 #include <iostream>
00006 #include <fstream>
00007 #include "Range.h"
00008 #include <set>
00009 
00010 using namespace std;
00011 
00014 //vector<int> getNumbers(const string &str);
00015 //string deleteChr(const string &str, char c);
00016 //int getInt(const string &str);
00017 //getInt and getNumbers moved to strforamt.h
00018 
00022 //pair<string,string> breakString(const string &str, const string &sep);
00023 //void trimLeadingSpace(string &str);
00024 
00025 class Gmapalnseg {
00026    public: 
00027       Gmapalnseg() { }
00031       Gmapalnseg(const string &ln);
00032       Gmapalnseg(const Gmapalnseg &ga) : cr(ga.cr), gr(ga.gr), iden(ga.iden) { }
00033       Gmapalnseg(const vector<int> &row);
00034       ~Gmapalnseg() { }
00036       friend ostream& operator<<(ostream &ous, const Gmapalnseg &as);
00037       const Range& grange() const { return gr; }
00042       int length() const { return min(cr.length(), gr.length()); }
00043       int identity() const { return iden; }
00044       int idenxlen() const { return length() * iden; }
00045       const Range& cDNARange() const { return cr; }
00046       const Range& genomicRange() const { return gr; }
00047 
00048    private:
00049       Range cr, gr;
00053       int iden;
00054 };
00055 
00058 class Gmapath {
00059    public:
00060       Gmapath() { }
00061       Gmapath(const string &pathstr, const string &dircstr, 
00062             const string &covstr, const string &tcovstr, const string &idenstr);
00063       ~Gmapath();
00064       void addAlnSeg(Gmapalnseg *as) { align.push_back(as); }
00066       void assignAln(vector<Gmapalnseg*> &as);
00076       friend ostream& operator<<(ostream &ous, const Gmapath &pa);
00082       Noschain makeNoschain();
00088       Alnchain makeAlnchain();
00091       Alnchainid makeAlnchainid(const string &estid);
00092 
00094       Alnchainid* makeAlnchainidPtr(const string &estid);
00100       int modelDirection() const { return modirect; }
00101       void setDirection(int d) { modirect=d; }
00102       char genomicDirection() const { return grange.direction(); }
00103       string genomicId() const { return gid; }
00105       double getIdentity() const { return iden; }
00106       double getCoverage() const { return cov; }
00107       int numberOfSegments() const { return align.size(); }
00108       bool emptyAlignment() const { return align.empty(); }
00110       bool isGood() const;
00114       int alnLength() const;
00124       void trimEnds();
00125 
00126       static void setTrimCutoff(float ct) { trimcutoff=ct; }
00127       static void setMinimumLength(int min) { minLEN=min; }
00128       static void setMinimumCoverage(float min) { minCOV=min; }
00129       static void setMinimumIdentity(float min) { minIDEN=min; }
00130       static void setTrimShortIntronlen(int min) { trimShortIntronlen=min; }
00131 
00132 
00133    private:
00134       // should use the index of the array in holding class
00135       //int pathid;
00145       int modirect; // +1 for +, -1 for -, 0 for ?
00147       string gid;
00151       double cov, trimcov, iden;
00155       int match, mismatch, indel, unknown;
00158       Range crange, grange;
00159       int estlen;
00160       vector<Gmapalnseg*> align;
00161 
00162       static float trimcutoff;
00165       static int alnlenL;
00176       static int minLEN;
00177       static float minCOV;
00178       static float minIDEN;
00185       static int trimShortIntronlen;
00186 };
00187 
00222 class Gmapres {
00223    public:
00224       Gmapres() { }
00225       Gmapres(const string &id, int np) : cid(id), numpath(np), paths() { }
00226       ~Gmapres();
00227       void addPath(Gmapath &gp) { paths.push_back(&gp); }
00228       void addPath(Gmapath *gp) { paths.push_back(gp); }
00233       void addAlignment(vector<Gmapalnseg*> &aln, int idx);
00238       friend ostream& operator<<(ostream &ous, const Gmapres &res);
00248       void storeChain(map<string, set<Noschain> > &chainstore, float idencut);
00259       void storeChain(map<string, map<Alnchain,int> > &chainstore);
00261       void storeChain(map<string, set<Alnchainid> > &chainstore);
00265       void storeChain(map<string, set<Alnchainid*, lessChainPtr> > &chainstore);
00266       int strandByESTName() const;
00267       void guessDirection();
00269       const string& ESTId() const { return cid; }
00270 
00271       /*
00272       static void setMinimumLength(int lc) { minpathlength=lc; }
00273       static void setMinimumCoverage(double mc) { mincoverage=mc; }
00274       static void setMinimumIdentity(double mi) { minidentity=mi; }
00275       */
00276       static void setMaximumIntron(int maxil) { maxintron=maxil; }
00279       static void setMinimumIntron(int minil);
00280       static void setDangleExon(const pair<int,int> &dang) { dangleinlen=dang.first; danglexlen=dang.second; }
00281 
00282 
00283    private:
00287       int numpath;
00289       vector<Gmapath*> paths;
00290       string cid; // cDNA identifer string
00291 
00295       //static int minpathlength;
00296       //static double mincoverage;
00297       //static double minidentity;
00298 
00299       static int maxintron;
00309       static int minintron;
00310       static int dangleinlen;
00311       static int danglexlen;
00312 };
00313 
00314 #endif

Generated on Wed Aug 10 11:56:52 2011 for Softwares from Orpara by  doxygen 1.5.6