BALL
1.4.1
|
00001 // -*- Mode: C++; tab-width: 2; -*- 00002 // vi: set ts=2: 00003 // 00004 00005 #ifndef BALL_STRUCTURE_RESIDUEROTAMERSET_H 00006 #define BALL_STRUCTURE_RESIDUEROTAMERSET_H 00007 00008 #ifndef BALL_COMMON_H 00009 #include <BALL/common.h> 00010 #endif 00011 00012 #ifndef BALL_MATHS_ANGLE_H 00013 #include <BALL/MATHS/angle.h> 00014 #endif 00015 00016 #ifndef BALL_DATATYPE_STRING_H 00017 #include <BALL/DATATYPE/string.h> 00018 #endif 00019 00020 #ifndef BALL_MATHS_VECTOR3_H 00021 #include <BALL/MATHS/vector3.h> 00022 #endif 00023 00024 namespace BALL 00025 { 00027 class Residue; 00028 template <typename Key> class HashSet; 00029 template <typename Key> class StringHashMap; 00030 class Atom; 00031 00041 class BALL_EXPORT Rotamer 00042 { 00043 public: 00044 00048 00049 Rotamer(); 00050 00052 Rotamer(const Rotamer& rotamer); 00053 00055 Rotamer(float new_P, float new_chi1, float new_chi2 = 0.0, 00056 float new_chi3 = 0.0, float new_chi4 = 0.0); 00058 00059 00063 00064 float P; 00065 00067 float chi1; 00068 00070 float chi2; 00071 00073 float chi3; 00074 00076 float chi4; 00078 }; 00079 00080 00091 class BALL_EXPORT ResidueRotamerSet 00092 { 00093 public: 00094 00098 00099 typedef std::vector<Rotamer>::const_iterator ConstIterator; 00100 typedef std::vector<Rotamer>::const_iterator const_iterator; 00102 typedef std::vector<Rotamer>::iterator Iterator; 00103 typedef std::vector<Rotamer>::iterator iterator; 00105 00106 00110 BALL_CREATE(ResidueRotamerSet) 00111 00112 00114 ResidueRotamerSet(); 00115 00118 ResidueRotamerSet(const ResidueRotamerSet& rotamer_set); 00119 00122 ResidueRotamerSet(const Residue& residue, Size number_of_torsions); 00123 00126 virtual ~ResidueRotamerSet(); 00128 00129 00133 00136 Iterator begin() 00137 { 00138 return rotamers_.begin(); 00139 } 00140 00143 Iterator end() 00144 { 00145 return rotamers_.end(); 00146 } 00147 00150 ConstIterator begin() const 00151 { 00152 return rotamers_.begin(); 00153 } 00154 00157 ConstIterator end() const 00158 { 00159 return rotamers_.end(); 00160 } 00162 00166 00167 const ResidueRotamerSet& operator = (const ResidueRotamerSet& residue_rotamer_set); 00169 00173 00174 const String& getName() const; 00175 00177 bool isValid() const; 00178 00180 Size getNumberOfRotamers() const; 00181 00185 Size getNumberOfTorsions() const; 00186 00190 void setNumberOfTorsions(Size number_of_torsions) throw(Exception::IndexOverflow); 00191 00193 const Rotamer& operator [] (Position index) const throw(Exception::IndexOverflow); 00194 00196 bool hasTorsionPhi() const; 00197 00199 Angle getTorsionPhi() const; 00200 00202 void setTorsionPhi(const Angle& phi); 00203 00205 bool hasTorsionPsi() const; 00206 00208 Angle getTorsionPsi() const; 00209 00211 void setTorsionPsi(const Angle& psi); 00213 00217 00218 bool setTemplateResidue(const Residue& residue, Size number_of_torsions); 00219 00223 bool setRotamer(Residue& residue, const Rotamer& rotamer); 00224 00228 Rotamer getRotamer(const Residue& residue) const; 00229 00235 const Rotamer& getRotamer(Position index) const; 00236 00238 void setName(const String& name); 00239 00241 void addRotamer(const Rotamer& rotamer); 00242 00244 void deleteRotamer(Iterator loc); 00245 00247 void deleteRotamers(Iterator begin, Iterator end); 00248 00250 void sort(); 00252 00253 00254 00255 protected: 00256 00257 00258 struct RotamerProbabilityGreaterThan_ 00259 : std::binary_function<Rotamer, Rotamer, bool> 00260 { 00261 bool operator () (const Rotamer& r1, const Rotamer& r2) 00262 { 00263 return r1.P > r2.P; 00264 } 00265 }; 00266 00272 void addMovable_(std::vector<String>& movable, const Atom& a, const HashSet<String>& assigned_atoms); 00273 00275 void setTorsionAngle_(Residue& residue, const std::vector<String>& movable, float torsion); 00276 00278 bool valid_; 00279 00281 String name_; 00282 00284 std::vector<Rotamer> rotamers_; 00285 00287 std::vector<String> movable_atoms_chi1_; 00288 std::vector<String> movable_atoms_chi2_; 00289 std::vector<String> movable_atoms_chi3_; 00290 std::vector<String> movable_atoms_chi4_; 00291 00293 Size number_of_torsions_; 00294 00296 StringHashMap<Vector3> original_coordinates_; 00297 00299 bool has_torsion_phi_; 00300 00302 bool has_torsion_psi_; 00303 00305 Angle phi_; 00306 00308 Angle psi_; 00309 }; 00310 00311 } // namespace BALL 00312 00313 #endif // BALL_STRUCTURE_RESIDUEROTAMERSET_H