00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_QA_AMINO_ACIDS_HH
00020 #define OST_QA_AMINO_ACIDS_HH
00021
00022
00023
00024 #include <set>
00025 #include <ost/dllexport.hh>
00026 #include <ost/mol/residue_handle.hh>
00027 #include <ost/mol/torsion_handle.hh>
00028
00029 #include <ost/qa/module_config.hh>
00030 namespace ost { namespace qa {
00031
00032
00033
00034 typedef enum {
00035 Ala, Arg, Asn,
00036 Asp, Gln, Glu,
00037 Lys, Ser, Cys,
00038 Met, Trp, Tyr,
00039 Thr, Val, Ile,
00040 Leu, Gly, Pro,
00041 His, Phe, Xxx,
00042
00043 } AminoAcid;
00044
00048 DLLEXPORT_OST_QA AminoAcid ResidueToAminoAcid(const mol::ResidueHandle& r);
00049
00050
00051 DLLEXPORT_OST_QA String AminoAcidToResidueName(AminoAcid aa);
00052
00053 class AminoAcidSetIterator : public std::iterator<std::forward_iterator_tag,
00054 AminoAcid> {
00055 public:
00056 AminoAcidSetIterator(unsigned int bits, int start):
00057 bits_(bits), curr_(start)
00058 {
00059 }
00060 AminoAcidSetIterator& operator++()
00061 {
00062 this->Advance();
00063 return *this;
00064 }
00065
00066 AminoAcid operator*() const
00067 {
00068 return AminoAcid(curr_);
00069 }
00070
00071 bool operator==(const AminoAcidSetIterator& rhs) const
00072 {
00073 return curr_==rhs.curr_;
00074 }
00075 bool operator!=(const AminoAcidSetIterator& rhs) const
00076 {
00077 return !this->operator==(rhs);
00078 }
00079 private:
00080 void Advance()
00081 {
00082 ++curr_;
00083 while (curr_<=Xxx && !(bits_ & (1 << curr_))) { ++curr_; }
00084 }
00085 unsigned int bits_;
00086 int curr_;
00087 };
00088
00089
00090
00092 class DLLEXPORT_OST_QA AminoAcidSet {
00093 public:
00094 typedef AminoAcidSetIterator Iterator;
00095
00096 static AminoAcidSet CreatePolarSet();
00097
00098 static AminoAcidSet CreateAromaticSet();
00099
00100 static AminoAcidSet CreateApolarSet();
00101
00102 static AminoAcidSet CreateSet(AminoAcid aa);
00103
00104 static std::vector<AminoAcidSet> CreateCompleteSet();
00105
00106 static std::vector<AminoAcidSet> CreateThreeStateSet();
00107
00108 static std::vector<AminoAcidSet> CreatePseudoSet();
00109
00110 AminoAcidSet();
00111
00113 void Add(AminoAcid amino_acid);
00114
00116 void Remove(AminoAcid amino_acid);
00117
00119 bool Contains(AminoAcid amino_acid) const;
00120
00122 bool Empty() const;
00123
00131 Iterator Begin() const;
00132
00134 Iterator End() const;
00135
00136 bool operator==(const AminoAcidSet& rhs) const;
00137
00138 bool operator!=(const AminoAcidSet& rhs) const;
00139
00140 template <typename DS>
00141 void Serialize(DS& ds)
00142 {
00143 ds & bits_;
00144 }
00145 private:
00146 unsigned int bits_;
00147 };
00148
00149 DLLEXPORT_OST_QA std::ostream& operator<<(std::ostream& os,
00150 const AminoAcidSet& aa_set);
00151
00152 }}
00153
00154 #endif