Generated on Tue Dec 16 12:49:16 2008 for BIU-2.2.0 by doxygen 1.5.1

src/biu/RNAStructure.hh

Go to the documentation of this file.
00001 #ifndef RNASTRUCTURE_HH_
00002 #define RNASTRUCTURE_HH_
00003 
00004 
00005 #include "BioMolecule.hh"
00006 #include "AllowedBasePairs.hh"
00007 
00008 namespace biu
00009 {
00018     class RNAStructure : public BioMolecule
00019     {
00020     protected:
00021         
00023         Sequence*       rnaSeq;
00024         
00026         const bool      seqShared;
00027         
00029         static const size_t MIN_LOOP_LENGTH;
00030 
00034         static const Alphabet           STRUCT_ALPH;
00035 
00037         Structure*      rnaStructBracketDot;
00038         
00044         std::vector<size_t> rnaBonds;
00045         
00049         const AllowedBasePairs*     bPair;
00050         
00051     public:
00052     
00054         static const Alphabet::AlphElem STRUCT_BND_OPEN;
00056         static const Alphabet::AlphElem STRUCT_BND_CLOSE;
00058         static const Alphabet::AlphElem STRUCT_UNBOUND;
00059         
00061         static const size_t INVALID_INDEX;
00062 
00076         RNAStructure(   const std::string& rnaSeqStr, 
00077                         const std::string& rnaStructBracketDotStr, 
00078                         const AllowedBasePairs* const bPair);
00079                  
00094         RNAStructure(   Sequence* rnaSeq, 
00095                         const Structure* const rnaStructBracketDot, 
00096                         const AllowedBasePairs* const bPair,
00097                         const bool seqIsShared);
00098                  
00099         RNAStructure(const RNAStructure& rnaStruct);
00100         
00101         virtual ~RNAStructure();
00102         
00103         RNAStructure&   operator= (const RNAStructure& rnaStruct2);
00104         bool            operator== (const RNAStructure& rnaStruct2) const;
00105         bool            operator!= (const RNAStructure& rnaStruct2) const;
00106 
00110         bool            hasValidStructure() const;
00111         
00115         bool            hasValidBasePairs() const;
00116         
00120         bool            hasMinLoopLength() const;
00121         
00125         bool isAllowedBasePair(size_t first, size_t second) const;
00126 
00132         size_t getClosingBond(size_t openingBond) const { 
00133             return rnaBonds[openingBond]; 
00134         }
00135         
00136         size_t getMinLoopLength() const {
00137             return MIN_LOOP_LENGTH; 
00138         }
00139 
00140         std::string getSequenceString() const {
00141             return bPair->getAlphabet()->getString(*rnaSeq);
00142         }
00143 
00144         std::string getStructureString() const {
00145             return STRUCT_ALPH.getString(*rnaStructBracketDot);
00146         }
00147 
00148         static const Alphabet* getStructureAlphabet() {
00149             return &STRUCT_ALPH;
00150         }
00151         
00152     // abstract functions (BioMolecule)
00153     
00154         Sequence getSequence() const {
00155             assertbiu(rnaSeq != NULL, "no sequence available");
00156             return *rnaSeq;
00157         }
00158 
00161         size_t  getLength() const {
00162             assertbiu(rnaSeq != NULL, "no sequence available");
00163             return rnaSeq->size();
00164         }
00165     
00167         Structure getStructure() const {
00168             assertbiu(rnaStructBracketDot != NULL, "no structure available");
00169             return *rnaStructBracketDot;
00170         }
00171         
00175         virtual void setStructure(const Structure& str) {
00176             assertbiu(rnaSeq->size() == str.size(), "structure has wrong length");
00177             delete rnaStructBracketDot;
00178             rnaStructBracketDot = new Structure(str);
00179         }
00180         
00181         const Structure & getStructureRef() const {
00182             assertbiu(rnaStructBracketDot != NULL, "no structure available");
00183             return *rnaStructBracketDot;
00184         }
00185         
00186         
00191         virtual bool        isValid() const;
00192         
00197         virtual std::string getStringRepresentation() const;
00198         
00199     protected:
00200         
00202         void initBonds();
00203         
00204     };
00205     
00206 } // namespace biu
00207 
00208 #endif /*RNASTRUCTURE_HH_*/