BALL  1.4.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
DNAMutator.h
Go to the documentation of this file.
1 /*
2  * File: BALL/STRUCTURE/DNAMutator.h
3  * Created: 23.10.2008
4  *
5  * Author: Daniel Stoeckel
6  */
7 
8 #ifndef DNAMUTATOR_H
9 #define DNAMUTATOR_H
10 
11 #include <BALL/COMMON/exception.h>
12 #include <BALL/MATHS/vector3.h>
13 
14 namespace BALL
15 {
16  class FragmentDB;
17  class EnergyMinimizer;
18  class ForceField;
19  class Fragment;
20  class AtomContainer;
21  class Atom;
22 
24  {
25  public:
29  enum Base { ADENINE = 0, THYMINE = 1, GUANINE = 2, CYTOSINE = 3, URACILE = 4 };
30 
51  DNAMutator(EnergyMinimizer* mini = NULL, ForceField* ff = NULL, FragmentDB* frag = NULL);
52 
57  ~DNAMutator();
58 
67  void setup();
68 
81  void mutate(Fragment* res, Base base) throw(Exception::InvalidOption);
82 
83  /*
84  * Set the current minimizer to mini. Passing NULL will disable
85  * minimization.
86  */
87  void setMinimizer(EnergyMinimizer* mini);
88 
89  /*
90  * Set a new FragmentDB instance that shall be used to obtain
91  * the new bases. If NULL is passed, a default instance will be automatically
92  * created when calling DNAMutator::mutate().
93  */
94  void setFragmentDB(FragmentDB* frag);
95 
96  /*
97  * Set a new ForceField instance that is used in conjunction with the minimizer to
98  * refine the structure. Even if no minimizer has been passed this force field will
99  * be used to calculate the most favourable rotation of the base using a simple heuristic.
100  * If you do not want this behaviour pass NULL.
101  */
102  void setForceField(ForceField* ff);
103 
104  /*
105  * Controlls maximum number of steps to be used when
106  * refining the generated structure via a minimizer.
107  */
108  void setMaxOptimizationSteps(Size steps);
109 
110  /*
111  * The DNAMutator internally uses the unnamed property mechanism of the Atoms.
112  * This defaults to property Atom::NUMBER_OF_PROPERTIES. If you already use this
113  * property in your code you can set another property by passing it to this function.
114  */
115  void setUsedProperty(Property p);
116 
117  private:
118  bool keep_db_;
119  bool keep_ff_;
120 
124 
127 
128  void freeDB_();
129  void freeFF_();
130 
131  void mark_(AtomContainer* atoms);
132  void unmark_(AtomContainer* atoms);
133 
134  void tryFlip_(Fragment* res, const Vector3& connect_atom, const Vector3& axis) const;
135 
141  bool optimize_(Fragment* frag);
142 
147  Atom* getAttachmentAtom(AtomContainer* res);
148 
153  Atom* markBaseAtoms(AtomContainer* res);
154 
155  void rotateBases(AtomContainer* from, const Atom* from_at, const Atom* to_at,
156  const Vector3& from_connection, const Vector3& to_connection);
157  void rotateSameBases(AtomContainer* from, AtomContainer* to);
158 
159  const Atom* getSecondNitro(const std::vector<const Atom*>& ring_atoms, const Atom* base);
160 
161  Vector3 getNormalVector(const Atom* at);
162  Atom* getConnectionAtom(Atom* at);
163  Vector3 getOrthogonalVector(const Vector3& n, const Atom* base, const Atom* at);
164 
170  bool isPurine(const Atom& baseNitrogen) const;
171  bool isPyrimidine(const Atom& baseNitrogen) const;
172 
173  static const char* bases_[];
174  static const Size default_num_steps_;
175  };
176 }
177 
178 #endif
179