minimol_seq.h
Go to the documentation of this file.00001 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 
00039 
00040 
00041 
00042 
00043 
00044 
00045 #ifndef CLIPPER_MINIMOL_SEQ
00046 #define CLIPPER_MINIMOL_SEQ
00047 
00048 
00049 #include "minimol.h"
00050 
00051 
00052 namespace clipper {
00053 
00055 
00057   class MPolymerSequence
00058   {
00059   public:
00060     MPolymerSequence() {}  
00061     const String& id() const { return id_; }  
00062     void set_id( const String& s );           
00063     const String& sequence() const { return seq_; }  
00064     void set_sequence( const String& s );            
00065     static String id_tidy( const String& id ) { return id; }  
00066     static bool id_match( const String& id1, const String& id2, const MM::MODE& mode ) { return id1 == id2; }  
00067   private:
00068     String id_;
00069     String seq_;
00070   };
00071 
00072 
00074 
00077   class MMoleculeSequence
00078   {
00079   public:
00081     int size() const { return children.size(); }
00083     const MPolymerSequence& operator[] ( const int& i ) const { return children[i]; }
00085     MPolymerSequence& operator[] ( const int& i ) { return children[i]; }
00087     const MPolymerSequence& find( const String& n, const MM::MODE mode=MM::UNIQUE ) const;
00089     MPolymerSequence& find( const String& n, const MM::MODE mode=MM::UNIQUE );
00091     int lookup( const String& str, const MM::MODE& mode ) const;
00092     void insert( const MPolymerSequence& add, int pos=-1 );  
00093 
00094     bool is_null() const { return (size()==0); }  
00095   private:
00096     typedef MPolymerSequence CHILDTYPE;
00097     std::vector<CHILDTYPE> children;
00098   };
00099 
00100 
00102 
00103   class MSequenceAlign {
00104   public:
00105     enum TYPE { GLOBAL, LOCAL };
00106     MSequenceAlign( TYPE type = GLOBAL, ftype match_score = 1.0, ftype miss_score = -0.5, ftype gap_score = -1.0 ) : type_(type), scrmat(match_score), scrmis(miss_score), scrgap(gap_score) {}
00107     std::pair<std::vector<int>,std::vector<int> > operator() ( const String& seq1, const String& seq2 ) const;
00108   private:
00109     TYPE type_;
00110     ftype32 scrmat, scrmis, scrgap;
00111   };
00112 
00113 } 
00114 
00115 #endif