Debian Codegraph @

include/BALL/DOCKING/COMMON/constraints.h

raw symbols SCIP
1 // -*- Mode: C++; tab-width: 2; -*-
2 // vi: set ts=2:
3 //
4
5 #ifndef BALL_DOCKING_COMMON_CONSTRAINTS
6 #define BALL_DOCKING_COMMON_CONSTRAINTS
7
8
9 #ifndef BALL_MATHS_VECTOR3_H
10 #include <BALL/MATHS/vector3.h>
11 #endif
12
13 #ifndef BALL_MATHS_MATRIX44_H
14 #include <BALL/MATHS/matrix44.h>
15 #endif
16
17 #ifndef BALL_MATHS_PLANE3_H
18 #include <BALL/MATHS/plane3.h>
19 #endif
20
21 #ifndef BALL_KERNEL_SYSTEM_H
22 #include <BALL/KERNEL/system.h>
23 #endif
24
25 #ifndef BALL_DATATYPE_HASHGRID_H
26 #include <BALL/DATATYPE/hashGrid.h>
27 #endif
28
29
30 namespace BALL
31 {
32 class DockingAlgorithm;
33
34 namespace VIEW
35 {
36 class DockRLDialog;
37 }
38
39 class ScoringFunction;
40
41 class BALL_EXPORT Constraint
42 {
43 public:
44 Constraint();
45
46 virtual ~Constraint();
47
48 virtual double calculateScore(AtomContainer* mol) = 0;
49
50 /** Set a name for this ReferenceArea. This way, the score summary printed by the ScoringFunction can be analyzed more easily */
51 virtual void setName(String name);
52
53 String getName();
54
55 String getType();
56
57 virtual void setScoringFunction(ScoringFunction* sf);
58
59 protected:
60 String name_;
61
62 /** Stores the type - 'ReferenceArea' or 'PharmacophoreConstraint' - of this Constraint for text output purposes. */
63 String type_;
64
65 /** penalty value that is to be added to the calculated energy if the desired constraints are not fullfilled. */
66 double penalty_;
67 ScoringFunction* scoring_function_;
68 };
69
70 /** ReferenceAreas are cuboids specified by the user for the examined target structure. A given number of ligand atoms or a given fraction of the ligand atoms should be located within these areas, so that docking is optimized in this way. */
71 class BALL_EXPORT ReferenceArea
72 : public Constraint
73 {
74 public:
75 ReferenceArea();
76
77 ~ReferenceArea();
78 /** Constructor. Creates a ReferenceArea from 4 given points, that describe a cuboid.\n
79 Of those four given points, p1 should be located on the same edge as p2, p3 on the same egde as p2 and p4 on the same edge as p3. */
80 ReferenceArea(Vector3& p1, Vector3& p2, Vector3& p3, Vector3& p4, bool atom_fraction, double atoms, double penalty);
81
82 /** Constructor. Creates a ReferenceArea from 2 points that describe one side of the cuboid and the the desired expansion of the cubiod along the x- and y-axes of a right handed coordinate system (after transformation) */
83 ReferenceArea(Vector3& p1, Vector3& p2, int y_expansion, int z_expansion, bool atom_fraction, double atoms, double penalty);
84
85 /** Constructor that creates a ReferenceArea describing the area occupied by a given AtomContainer */
86 ReferenceArea(const AtomContainer* sys, bool atom_fraction, double atoms, double penalty);
87
88 ReferenceArea(list<const AtomContainer*>& container_list, const list<String>& interaction_types, double desired_interaction_score, double penalt);
89
90 /** calculates a penalty for the given AtomContainer */
91 double calculateScore(AtomContainer* mol);
92
93 /** returns the number of atoms located within this ReferenceAreas as calculated by the last call of getScore() (respectively ScoringFunction::updateScore() ) */
94 double getContainedAtoms();
95
96 /** Creates a molecule with four atoms located on the bonders of the cube that this ReferenceArea describes.\n
97 This can be used for visualization purposes.\n
98 @return the created System if this ReferenceArea contains a valid ref-area description; else NULL is returned. */
99 System* createBoundaryMolecule();
100
101 /** Enlarge this ReferenceArea by the given amount in all directions */
102 void enlarge(double angstroem);
103
104 /** Sets the number resp. fraction of atoms of a ligand that should be contained in this ReferenceArea */
105 void setNumberDesiredAtoms(double d);
106
107 void setName(String name);
108
109 void setScoringFunction(ScoringFunction* sf);
110
111 private:
112 double countContainedAtoms(AtomContainer* sys);
113
114 /** transformation matrix. It is used to rotate the specified cuboid in such a way that it is aligned with the global coordinate system */
115 Matrix4x4 T_;
116
117 double min_x_, max_x_, min_y_, max_y_, min_z_, max_z_;
118
119 /** the number of atoms of a reference ligand within this ReferenceArea respectively the fractions of atoms of a reference ligand within this ReferenceArea */
120 double ref_atoms_;
121
122 /** if == 1, ReferenceArea.atoms indicates the desired fraction of ligand atoms that should be located within this area */
123 bool atom_fraction_;
124
125 /** the number of atoms located within this ReferenceAreas as calculated by the last call of getScore() (respectively ScoringFunction::updateScore() ) */
126 double contained_atoms_;
127
128 vector<Vector3> input_points_;
129
130 /** the number of atoms of the reference ligand */
131 Size number_reflig_atoms_;
132
133 /** If set to true, the fraction of ligand-atoms contained within this ReferenceArea is calculated with respect to the number of atoms of the reference-ligand, if the current ligand has more atoms than the reference ligand.
134 This is useful, because a much larger ligand obviously needs more space and might therefore not fit completely into the binding pocket (as the reference ligand did). */
135 bool scale_by_size_;
136
137 friend class BALL::DockingAlgorithm;
138 friend class BALL::VIEW::DockRLDialog;
139 };
140
141 /** PharmacophoreConstraint allow to define specific intermolecular interactions that should exist between receptor and ligand.\n
142 If those interactions do not exist or are too weak (i.e. have a score that is not good enough), a penalty score is calculated and used by ScoringFunction::updateScore() if this PharmacophoreConstraint has been added to ScoringFunction::constraints.\n
143 In order to be able to evaluate the ligand's interactions with the specified atoms, the pairwise interactions have to be stored. Use ScoringFunction::enableStoreInteractions() to allow this. */
144 class BALL_EXPORT PharmacophoreConstraint
145 : public Constraint
146 {
147 public:
148 PharmacophoreConstraint(list<const AtomContainer*>& container_list, const list<String>& interaction_types, double desired_interaction_score, double penalty);
149
150 PharmacophoreConstraint(const AtomContainer* container, const list<String>& interaction_types, double desired_interaction_score, double penalty);
151
152 PharmacophoreConstraint(const PharmacophoreConstraint& phC);
153
154 ~PharmacophoreConstraint();
155
156 /** Constructor for initializing a PharmacophoreConstraint with a list of residue-IDs. \n
157 If using this constructor, the ScoringFunction for this object must be set by setScoringFunction() _before_ calling calculateScore() for the first time. If the receptor that is used by this ScoringFunction is not a Protein or does not have residues for all the specified IDs, setScoringFunction() will throw an exception. */
158 PharmacophoreConstraint(vector<String>& residue_IDs, const list<String>& interaction_types, double desired_interaction_score, double penalty);
159
160 void setScoringFunction(ScoringFunction* sf);
161
162 /** calculates a penalty for the given AtomContainer */
163 double calculateScore(AtomContainer* mol);
164
165 /** returns the interaction-score between the ligand and the desired receptor-atoms as calculated during the last call of calculateScore() */
166 double getInteractionScore();
167
168 bool usesReceptorResidues();
169
170 AtomContainer* getGridContainer();
171
172 const list<String>* getInteractionTypes();
173
174 const list<const AtomContainer*>* getInteractionPartners();
175
176 private:
177 /** only used in case of creation of an object of this class by constructor PharmacophoreConstraint(vector<String>& residue_IDs ...) */
178 vector<String> residue_IDs_;
179 vector<String> chain_IDs_;
180
181 list<const AtomContainer*> interaction_partners_;
182 list<String> interaction_types_;
183 double desired_interaction_score_;
184 double interaction_score_;
185 bool uses_receptor_residues_;
186
187 /** Contains copies of all relevant receptor-atoms in case of grid-based ScoringFunctions */
188 AtomContainer grid_container_;
189
190 /** Saves the ID of the relevant ScoreGridSet in case of grid-based ScoringFunctions */
191 unsigned int gridSetID_;
192
193 friend class BALL::DockingAlgorithm;
194 friend class BALL::VIEW::DockRLDialog;
195 };
196 }
197
198 #endif // BALL_DOCKING_COMMON_CONSTRAINTS