Main Page | Class Hierarchy | Class List | File List | Class Members

RegionPrediction.h

00001 
00002 // Copyright (c) 2003, The Institute for Genomic Research (TIGR), Rockville,
00003 // Maryland, U.S.A.  All rights reserved.
00005 #ifndef REGIONPREDICTION_H
00006 #define REGIONPREDICTION_H
00007 
00008 #include "DataSetAbstractProduct.h"
00009 #include "AnnotationScore.h"
00010 #include "DataSetAbstractFactory.h"
00011 #include "InputData.h"
00012 #include "EvScores.h"
00013 #include <pair.h>
00014 
00015 class PlaceHolder;
00016 class SpliceSite;
00017 class DnaStr;
00018 class CustomScore;
00019 
00028 class RegionPrediction : public DataSetAbstractProduct {
00029 public:
00030 #if 0
00031 
00034   class GenePredDataSetConcreteFactory : public DataSetAbstractFactory {
00035   public:
00036 
00037       virtual DataSetAbstractProduct * createDataSetAbstractProduct(const string&);
00038 
00039   private:
00040 
00047       /*# GenePredDataSet _genePredDataSet; */
00048   };
00049 #endif
00050 
00051   RegionPrediction(const SeqLoc&, const string&);
00052   ~RegionPrediction();
00053 
00054   // accessors
00055   static bool
00056     is_igr(const RegionPrediction&, const RegionPrediction&,dsu::Strand_t,int);
00057   static bool
00058     is_intron(const RegionPrediction&, const RegionPrediction&,dsu::Strand_t);
00059 
00060   const string& getSeq() const { return _seq; }
00061   bool noData()const;
00062   bool noStrndData(dsu::Strand_t) const;
00063   virtual void print(std::ostream&, const CustomScore&) const;
00064   const string& getTypeStr() const;
00065   bool isValid(EvScores::Bnd_t, dsu::Strand_t) const; 
00066 
00071   bool isAccpBndry(dsu::Strand_t strnd) const { return _accpBndry[strnd]; }
00076   bool isDonrBndry(dsu::Strand_t strnd) const { return _donrBndry[strnd]; }
00077 
00078   bool isValidAcceptorSignals(dsu::Strand_t strnd) const { return isAccpBndry(strnd) || hasStart(strnd); }
00079   bool isValidDonorSignals(dsu::Strand_t strnd) const { return isDonrBndry(strnd) || hasStop(strnd); }
00080 
00094   void score(const CustomScore&,const string&);
00095 
00101   void virtual insert(const PlaceHolder*);
00102   void storeRelaventData(InputData::const_iterator&, const InputData::const_iterator&);
00103    
00104   void setScores(dsu::Strand_t, const EvScores&);
00108   bool hasStart(dsu::Strand_t strnd) const { 
00109     return _hasStart[strnd]; 
00110   }
00111 
00115   bool hasStop(dsu::Strand_t strnd) const { 
00116     return _hasStop[strnd]; 
00117   }
00118 
00122   bool isEndOfSeq() const {
00123     //note "getEnd" starts at index 1
00124     return getEnd3()==(signed)_seq.length();
00125   }
00126 
00127   void scoreHelp(const string&, dsu::Strand_t);
00128   inline const EvScores& getScores(dsu::Strand_t strnd) const; 
00129   inline const AnnotationScore& getScore(unsigned,dsu::Strand_t strnd) const; 
00130 
00131 private:
00132   AnnotationScore getProbStore(EvScores::Bnd_t,dsu::Strand_t) const;
00133   void setProbHelp(dsu::Strand_t);
00134   inline EvScores& getScores(dsu::Strand_t strnd); 
00135   void doubleCheck();
00136   void setDonorEvidenceBoundary(const string&,dsu::Strand_t);
00137   void setAcceptorEvidenceBoundary(const string&,dsu::Strand_t);
00138   void setDonorEvidenceBoundaryFromString(const DnaStr&,dsu::Strand_t);
00139   void setAcceptorEvidenceBoundaryFromString(const DnaStr&,dsu::Strand_t);
00140   void checkProteinStops(const string& str, dsu::Strand_t strnd);
00141   inline int getIdx(dsu::Strand_t) const;
00142 
00143   void setProbVal(unsigned,const AnnotationScore&);
00144 private:
00145   vector<EvScores> _score;
00146 
00147   // caching these results
00148   bool _donrBndry[2], _accpBndry[2];
00149   bool _hasStart[2], _hasStop[2];
00150 
00151   int _negCnt, _posCnt;
00152   const string& _seq;
00153 };
00154 
00155 #include "RegionPrediction.hpp" // inlines
00156 
00157 #endif // REGIONPREDICTION_H