BALL  1.4.2
 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 #include <BALL/STRUCTURE/mutator.h>
15 
16 #include <deque>
17 #include <map>
18 
19 namespace BALL
20 {
21  class Chain;
22  class Residue;
23  class FragmentDB;
24  class EnergyMinimizer;
25  class ForceField;
26  class Fragment;
27  class AtomContainer;
28  class Atom;
29 
31  : public Mutator
32  {
33  public:
37  {
42  MATCH_TORSION
43  };
64  DNAMutator(EnergyMinimizer* mini = NULL, ForceField* ff = NULL, FragmentDB* frag = NULL);
65 
70  ~DNAMutator();
71 
80  virtual void setup();
81 
86  void setMinimizer(EnergyMinimizer* mini);
87 
94  void setForceField(ForceField* ff);
95 
100  void setMaxOptimizationSteps(Size steps);
101 
107  void setUsedProperty(Property p);
108 
115  bool optimize();
116 
123  void setStrands(Chain* s1, Chain* s2);
124 
131  void setFirstStrand(Chain* s1);
132 
139  void setSecondStrand(Chain* s2);
140 
144  void setNucleotideMapping(const NucleotideMapping& bij);
145 
156  void addMutation(Index i, const String& new_frag_name);
157 
161  void clearMutations();
162 
167  void setMatchingMode(MatchingMode mmode);
168 
169  protected:
170  virtual void mutate_impl_(MutatorOptions opt);
171 
172  private:
173  typedef std::map<Residue*, String> Mutations;
174  typedef Mutations::iterator MutIterator;
175 
176  bool keep_ff_;
177 
180 
183 
186 
189 
190  void mutateSingleBase_(Residue* res, const String& basename) const;
191 
192  void freeFF_();
193 
194  void mark_(AtomContainer* atoms) const;
195  void unmark_(AtomContainer* atoms) const;
196 
202  bool optimize_(Fragment* frag);
203 
208  Atom* getAttachmentAtom(AtomContainer* res) const;
209 
214  Atom* markBaseAtoms_(AtomContainer* res) const;
215 
216  void alignBases_(AtomContainer* from, const Vector3& from_connection, const Vector3& to_connection, Atom* from_at) const;
217 
218  Atom* getTorsionDefiningAtom_(Atom* atom) const;
219  const Atom* getTorsionDefiningAtom_(const Atom* atom) const;
220 
221  void rotateBasesMatchTorsion_(AtomContainer* from, const Atom* to_connection_at, Atom* from_at, const Atom* to_at) const;
222  void rotateBasesMinAngle_ (AtomContainer* from, const Vector3& to_connection, Atom* from_at, const Atom* to_at) const;
223  void rotateSameBases_(AtomContainer* from, AtomContainer* to) const;
224 
225  Vector3 getNormalVector_(const Atom* at) const;
226  Atom* getConnectionAtom_(Atom* at) const;
227 
228  String canonizeName_(const String& frag_name) const;
229 
235  bool isPurine_(const Atom& baseNitrogen) const;
236  bool isPyrimidine_(const Atom& baseNitrogen) const;
237 
238  static const char* bases_[];
239  static const Size default_num_steps_;
240 
241  String getComplement_(const String& s) const;
242 
243  std::map<Residue*, String> mutations_;
244  std::deque<Atom*> to_optimize_;
245  };
246 }
247 
248 #endif
249