BALL
1.4.1
|
00001 /* 00002 * File: BALL/STRUCTURE/DNAMutator.h 00003 * Created: 23.10.2008 00004 * 00005 * Author: Daniel Stoeckel 00006 */ 00007 00008 #ifndef DNAMUTATOR_H 00009 #define DNAMUTATOR_H 00010 00011 #include <BALL/COMMON/exception.h> 00012 #include <BALL/MATHS/vector3.h> 00013 00014 namespace BALL 00015 { 00016 class FragmentDB; 00017 class EnergyMinimizer; 00018 class ForceField; 00019 class Fragment; 00020 class AtomContainer; 00021 class Atom; 00022 00023 class BALL_EXPORT DNAMutator 00024 { 00025 public: 00029 enum Base { ADENINE = 0, THYMINE = 1, GUANINE = 2, CYTOSINE = 3, URACILE = 4 }; 00030 00051 DNAMutator(EnergyMinimizer* mini = NULL, ForceField* ff = NULL, FragmentDB* frag = NULL); 00052 00057 ~DNAMutator(); 00058 00067 void setup(); 00068 00081 void mutate(Fragment* res, Base base) throw(Exception::InvalidOption); 00082 00083 /* 00084 * Set the current minimizer to mini. Passing NULL will disable 00085 * minimization. 00086 */ 00087 void setMinimizer(EnergyMinimizer* mini); 00088 00089 /* 00090 * Set a new FragmentDB instance that shall be used to obtain 00091 * the new bases. If NULL is passed, a default instance will be automatically 00092 * created when calling DNAMutator::mutate(). 00093 */ 00094 void setFragmentDB(FragmentDB* frag); 00095 00096 /* 00097 * Set a new ForceField instance that is used in conjunction with the minimizer to 00098 * refine the structure. Even if no minimizer has been passed this force field will 00099 * be used to calculate the most favourable rotation of the base using a simple heuristic. 00100 * If you do not want this behaviour pass NULL. 00101 */ 00102 void setForceField(ForceField* ff); 00103 00104 /* 00105 * Controlls maximum number of steps to be used when 00106 * refining the generated structure via a minimizer. 00107 */ 00108 void setMaxOptimizationSteps(Size steps); 00109 00110 /* 00111 * The DNAMutator internally uses the unnamed property mechanism of the Atoms. 00112 * This defaults to property Atom::NUMBER_OF_PROPERTIES. If you already use this 00113 * property in your code you can set another property by passing it to this function. 00114 */ 00115 void setUsedProperty(Property p); 00116 00117 private: 00118 bool keep_db_; 00119 bool keep_ff_; 00120 00121 FragmentDB* db_; 00122 ForceField* ff_; 00123 EnergyMinimizer* minimizer_; 00124 00125 Size num_steps_; 00126 Property prop_; 00127 00128 void freeDB_(); 00129 void freeFF_(); 00130 00131 void mark_(AtomContainer* atoms); 00132 void unmark_(AtomContainer* atoms); 00133 00134 void tryFlip_(Fragment* res, const Vector3& connect_atom, const Vector3& axis) const; 00135 00141 bool optimize_(Fragment* frag); 00142 00147 Atom* getAttachmentAtom(AtomContainer* res); 00148 00153 Atom* markBaseAtoms(AtomContainer* res); 00154 00155 void rotateBases(AtomContainer* from, const Atom* from_at, const Atom* to_at, 00156 const Vector3& from_connection, const Vector3& to_connection); 00157 void rotateSameBases(AtomContainer* from, AtomContainer* to); 00158 00159 const Atom* getSecondNitro(const std::vector<const Atom*>& ring_atoms, const Atom* base); 00160 00161 Vector3 getNormalVector(const Atom* at); 00162 Atom* getConnectionAtom(Atom* at); 00163 Vector3 getOrthogonalVector(const Vector3& n, const Atom* base, const Atom* at); 00164 00170 bool isPurine(const Atom& baseNitrogen) const; 00171 bool isPyrimidine(const Atom& baseNitrogen) const; 00172 00173 static const char* bases_[]; 00174 static const Size default_num_steps_; 00175 }; 00176 } 00177 00178 #endif 00179