BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
scoringFunction.h
Go to the documentation of this file.
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4 
5 #ifndef BALL_SCORING_COMMON_SCORINGFUNCTION_H
6 #define BALL_SCORING_COMMON_SCORINGFUNCTION_H
7 
8 #include <set>
9 
10 #include <BALL/KERNEL/system.h>
11 #include <BALL/DATATYPE/options.h>
12 #include <BALL/DATATYPE/string.h>
13 #include <BALL/DATATYPE/hashGrid.h>
20 
21 namespace BALL
22 {
23  typedef std::list<std::pair<Atom*, Atom*> > AtomPairList;
24  typedef std::vector<std::pair<Atom*, Atom*> > AtomPairVector;
25 
26  class ScoringComponent;
27 
29  {
30 
32  friend class SideChainOptimizer;
33 
34  public:
35  struct Option
36  {
39  static const char* VERBOSITY;
40 
43  static const char* BASE_FUNCTION_TYPE;
44 
47  static const char* HASHGRID_RESOLUTION;
48 
51  static const char* HASHGRID_SIZE;
52 
55  static const char* NONBONDED_CUTOFF;
56 
59  static const char* CONFORMATION_SCALE;
60 
63  static const char* ALL_LIG_NONB_PAIRS;
64 
67  static const char* USE_STATIC_LIG_FRAGMENTS;
68 
71  static const char* IGNORE_H_CLASHES;
72 
75  static const char* ALLOWED_INTERMOL_OVERLAP;
76 
79  static const char* ALLOWED_INTRAMOL_OVERLAP;
80 
83  static const char* BURIAL_DEPTH_SCALE;
84  };
85 
86 
87  struct Default
88  {
91  static const Size VERBOSITY;
92 
95  static const Size BASE_FUNCTION_TYPE;
96 
98  static double HASHGRID_RESOLUTION;
99 
101  static int HASHGRID_SIZE;
102 
103  static double NONBONDED_CUTOFF;
104 
106  static double CONFORMATION_SCALE;
107 
109  static bool ALL_LIG_NONB_PAIRS;
110 
113 
115  static bool IGNORE_H_CLASHES;
116 
119 
122 
123  static int BURIAL_DEPTH_SCALE;
124  };
125 
127  ScoringFunction();
128 
130  ScoringFunction(const ScoringFunction& sf);
131 
133  ScoringFunction(AtomContainer& receptor, AtomContainer& ligand);
134 
136  ScoringFunction(AtomContainer& receptor, AtomContainer& ligand,
137  const Options& options);
138 
139  ScoringFunction(AtomContainer& receptor,
140  AtomContainer& ligand, Options& options);
141 
146  ScoringFunction(AtomContainer& receptor, Vector3& hashgrid_origin, Options& options);
147 
149  virtual ~ScoringFunction();
150 
152  virtual void clear();
153 
155  ScoringFunction& operator = (const ScoringFunction& sf);
156 
158  bool setup();
159 
161  bool setup(AtomContainer& receptor, AtomContainer& ligand);
162 
164  bool setup(AtomContainer& receptor, AtomContainer& ligand, const Options& options);
165 
167  void setMaximumNumberOfErrors(Size nr);
168 
170  Size getMaximumNumberOfErrors() const;
171 
173  void setFirstMolecule(AtomContainer& molecule1);
174 
176  AtomContainer* getFirstMolecule() const;
177 
179  void setSecondMolecule(AtomContainer& molecule2);
180 
182  AtomContainer* getSecondMolecule() const;
183 
187  void setReceptor(AtomContainer& receptor);
188 
192  AtomContainer* getReceptor() const;
193 
197  void setLigand(AtomContainer& ligand);
198 
202  AtomContainer* getLigand() const;
203 
205  void setIntercept(double intercept);
206 
208  double getIntercept() const;
209 
211  void setBaseFunction(ScoringBaseFunction& base_function);
212 
216  ScoringBaseFunction* getBaseFunction() const;
217 
222  void insertComponent(ScoringComponent* component);
223 
229  void insertComponent(ScoringComponent* component, float coefficient);
230 
236  void removeComponent(const ScoringComponent* component);
237 
244  void removeComponent(const String& name);
245 
250  void setCoefficient(const ScoringComponent* component, float coefficient);
251 
257  void setCoefficient(const String& name, float coefficient);
258 
263  bool getCoefficient(const ScoringComponent* component,
264  float& coefficient) const;
265 
270  bool getCoefficient(const String& name, float& coefficient) const;
271 
275  ScoringComponent* getComponent(const String& name) const;
276 
280  ScoringComponent* getComponent(const Size index) const;
281 
283  double calculateScore();
284 
286  const HashSet<const Atom*>& getUnassignedAtoms() const;
287 
289  HashSet<const Atom*>& getUnassignedAtoms();
290 
292  static HashGrid3<Atom*>* initializeHashGrid(AtomContainer* sys,
293  Vector3& center,
294  double& resolution,
295  int hashgrid_size);
296 
301  double getExpEnergyStddev();
302 
303  void enableStoreInteractionsOnlyForPhContraints();
304 
308  String convertTime(double seconds);
309 
313  virtual void update();
314 
318  virtual double updateScore();
319 
324  virtual void printResult(bool detail = 0);
325 
326  void getScoreContributions(vector<double>& score_contributions, vector<String>& names);
327 
331  static void getDefaultOptions(Options& options);
332 
336  String getEquation();
337 
342  void enableStoreInteractions(bool b = true);
343 
347  String getName();
348 
349  int getBurialDepthScale();
350 
351  String valueToString(double value);
352 
357  void unsetTrainingParameters();
358 
363  void setNormalizationParameters(double stddev, double mean);
364 
365  const HashGrid3<Atom*>* getHashGrid();
366 
370  const Vector3& getLigandCenter() const;
371 
372  double getLigandRadius() const;
373 
378  bool storeInteractionsEnabled();
379 
384  virtual int getNoNeighboringReceptorAtoms();
385 
389  int getNoLigandAtoms();
390 
394  Options getOptions();
395 
399  Options* getOptionsToModify();
400 
407  void createStaticLigandFragments();
408 
409  const vector<Bond*>* getRotatableLigandBonds() const;
410 
411  const vector<StaticLigandFragment*>* getStaticLigandFragments() const;
412 
413  bool hasFlexibleResidues();
414 
415  void setFlexibleResidues(const std::set<Residue*>& flexible_residues);
416 
424  bool assignRotamer(Residue* residue, ResidueRotamerSet* rotamer_set, const Rotamer* rotamer);
425 
431  void resetFlexibleResidues();
432 
438  Size countNeighboringReceptorAtoms(const Atom* atom,
439  double distance_threshold,
440  bool onePerCell = 0,
441  int* number_of_overlaps = 0) const;
442 
443  void resetResiduePositions(Residue* residue, list<Vector3>& old_positions);
444 
448  double getScore();
449 
450  const std::map<Atom*, int>* getAtomFragmentMap();
451 
457  list<Constraint*> constraints;
458 
459  protected:
460  /* @name Protected structs */
461  struct Result
462  {
467 
472 
476  vector<double> refArea_penalties;
477  };
478 
482  void setName(String name);
483 
484  void updateComponent(int id, AtomPairList*);
485 
490  Vector3 calculateGeometricalCenter(AtomContainer* s, int* no_ligand_atoms = NULL);
491 
495  double calculateMoleculeRadius(AtomContainer* sys, Vector3& center);
496 
497  void setupFlexibleResidues_();
498 
504  virtual void setupReferenceLigand();
505 
509  int checkForAtomOverlaps(const AtomPairVector* pair_vector);
510 
522  AtomPairVector* createNonbondedPairVector(HashGrid3<Atom*>* hashgrid, int& overlaps, bool rec_lig, bool check_fragments = 0, bool intra_fragment = 0);
523 
532  AtomPairVector* createLigandNonbondedPairVector(bool intra_fragment, int& overlaps);
533 
534  bool hasPharmacophoreConstraints_();
535 
539  void clearStoredInteractions_();
540 
544  double calculateConstraintsScore();
545 
550  void enableInteractionComponents_(const list<String>& type_names);
551 
552  virtual double getES();
553 
557  void enableAllComponents_();
558 
564  void fetchStaticLigandFragment(Atom* a1, int index);
565 
570  int countCovalentBonds(const Atom* atom, int threshold = -1);
571 
577  virtual void createAllLigandNonBondedPairs();
578 
583  virtual double calculateStaticLigandFragmentEnergy();
584 
588  bool isPeptideBond(const Bond* bond) const;
589 
594 
599 
604 
609 
613  double score_;
614 
618  double intercept_;
619 
624 
628  vector<ScoringComponent*> scoring_components_;
629 
634 
639 
644 
649 
655 
660 
665 
669 
673  double resolution_;
674 
678  std::map<Atom*, int> atoms_to_fragments_;
679 
685 
691 
697 
702 
707 
712 
717 
722 
727 
733 
739 
745 
753  vector<StaticLigandFragment*> static_ligand_fragments_;
754 
761 
763 
768 
773 
778 
783 
785 
790 
795 
796  std::set<Residue*> flexible_residues_;
797 
802 
807 
812  vector<Bond*> rotatable_ligand_bonds_;
813 
818  list<list<Vector3> > flexres_org_positions_;
819 
820  };
821 
822 } // namespace BALL
823 
824 #endif // BALL_SCORING_COMMON_SCORINGFUNCTION_H
list< Constraint * > constraints
vector< StaticLigandFragment * > static_ligand_fragments_
static const char * ALLOWED_INTERMOL_OVERLAP
vector< double > refArea_penalties
AtomContainer * receptor_
static const char * CONFORMATION_SCALE
double allowed_intramolecular_overlap_
double allowed_intermolecular_overlap_
static const char * USE_STATIC_LIG_FRAGMENTS
static const char * VERBOSITY
static const char * ALL_LIG_NONB_PAIRS
static const char * HASHGRID_SIZE
AtomPairVector * all_ligand_nonbonded_
HashGrid3< Atom * > * all_residues_hashgrid_
static const char * IGNORE_H_CLASHES
static const char * BURIAL_DEPTH_SCALE
static const Size BASE_FUNCTION_TYPE
std::set< Residue * > flexible_residues_
const char * getName()
Definition: rtti.h:97
vector< Bond * > rotatable_ligand_bonds_
static const char * NONBONDED_CUTOFF
HashGrid3< Atom * > * static_residues_hashgrid_
list< list< Vector3 > > flexres_org_positions_
AtomContainer * ligand_
static const char * ALLOWED_INTRAMOL_OVERLAP
static const char * HASHGRID_RESOLUTION
std::list< std::pair< Atom *, Atom * > > AtomPairList
vector< ScoringComponent * > scoring_components_
static const char * BASE_FUNCTION_TYPE
std::map< Atom *, int > atoms_to_fragments_
ScoringBaseFunction * base_function_
HashGrid3< Atom * > * hashgrid_
HashGrid3< Atom * > * flexible_residues_hashgrid_
#define BALL_EXPORT
Definition: COMMON/global.h:50
std::vector< std::pair< Atom *, Atom * > > AtomPairVector
HashSet< const Atom * > unassigned_atoms_