BALL  1.4.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
bindingPocketProcessor.h
Go to the documentation of this file.
1 #ifndef BALL_STRUCTURE_BINDINGPOCKETPROCESSOR_H
2 #define BALL_STRUCTURE_BINDINGPOCKETPROCESSOR_H
3 
4 #ifndef BALL_CONCEPT_PROCESSOR_H
5 # include <BALL/CONCEPT/processor.h>
6 #endif
7 
8 #ifndef BALL_KERNEL_RESIDUE_H
9 # include <BALL/KERNEL/residue.h>
10 #endif
11 
12 #ifndef BALL_MATHS_VECTOR3_H
13 # include <BALL/MATHS/vector3.h>
14 #endif
15 
16 #ifndef BALL_KERNEL_SYSTEM_H
17 # include <BALL/KERNEL/system.h>
18 #endif
19 
20 #ifndef BALL_DATATYPE_HASHGRID_H
21 # include <BALL/DATATYPE/hashGrid.h>
22 #endif
23 
24 #ifndef BALL_DATATYPE_OPTIONS_H
25 # include <BALL/DATATYPE/options.h>
26 #endif
27 
28 #include <vector>
29 #include <string>
30 
31 #include <fstream>
32 
33 namespace BALL
34 {
35 
41  : public UnaryProcessor<Composite>
42  {
43 
44  public:
45 
48  struct Option
49  {
51  static const String HEAVY_ONLY;
53  static const String PARSE_INI_FILE;
55  static const String INI_FILE_NAME;
56 
58  static const String RADIUS_HYDROGEN;
59  static const String RADIUS_OXYGEN;
60  static const String RADIUS_NITROGEN;
61  static const String RADIUS_CARBON;
62  static const String RADIUS_SULFUR;
63 
69  static const String PROBE_LAYER_RADIUS;
77  static const String PW_SQUARE_WELL;
78  static const String PW_GAUSSIAN_WIDTH;
79  static const String PW_MAX_DISTANCE;
81  static const String MAX_ASPS;
82  // additional factor for the computation of the collision of two spheres
83  static const String CLASH_FACTOR;
85  static const String ASP_SEPERATION;
86  };
87 
90  struct Default
91  {
92  static const bool HEAVY_ONLY;
93  static const bool PARSE_INI_FILE;
94  static const String INI_FILE_NAME;
95 
96  static const double RADIUS_HYDROGEN;
97  static const double RADIUS_OXYGEN;
98  static const double RADIUS_NITROGEN;
99  static const double RADIUS_CARBON;
100  static const double RADIUS_SULFUR;
101 
102  static const double PROBE_SPHERE_RADIUS;
104  static const double PROBE_LAYER_RADIUS;
107  static const double BURIAL_COUNT_RADIUS;
108  static const double PW_SQUARE_WELL;
109  static const double PW_GAUSSIAN_WIDTH;
110  static const double PW_MAX_DISTANCE;
111  static const Position MAX_ASPS;
112  static const double CLASH_FACTOR;
113  static const double ASP_SEPERATION;
114  };
115 
119 
122  BindingPocketProcessor(Options& new_options);
123 
127 
130  virtual ~BindingPocketProcessor();
131 
134  const BindingPocketProcessor& operator=(const BindingPocketProcessor& pp);
135 
137  virtual bool finish();
138 
139  virtual Processor::Result operator() (Composite &composite);
140 
143  const vector<std::pair<Vector3,double> >& getActiveSitePoints() const;
144 
147  const vector<vector<std::pair<Vector3,double> > >& getLayers() const;
148 
152 
153  private:
154 
158  class Sphere_
159  {
160  public:
162  Sphere_();
163 
167 
170  float radius;
171 
175 
178  float probe_weight;
179 
183 
186  inline bool operator<(const Sphere_& sp) const {return probe_weight > sp.probe_weight;};
187 
190  int id;
191  static int global_id;
192  Position a,b,c,d;
193 
196  inline bool operator==(const Sphere_& sp) const {return a == sp.a && b == sp.b && c == sp.c && d == sp.d;};
197  };
198 
202  {
203  public:
204  int operator()(const Sphere_& sp1, const Sphere_& sp2) const
205  {
206  if (sp1.a != sp2.a)
207  return sp1.a < sp2.a;
208  if (sp1.b != sp2.b)
209  return sp1.b < sp2.b;
210  if (sp1.c != sp2.c)
211  return sp1.c < sp2.c;
212  if (sp1.d != sp2.d)
213  return sp1.d < sp2.d;
214  return 0;
215  };
216  };
217 
221 
225  friend std::ostream& operator<<(std::ostream& os, const BindingPocketProcessor::Sphere_& /*sp*/) {return os;};
226 
229  HashGrid3<Sphere_> sphere_grid_;
230 
234 
238 
242 
246 
250 
254 
255  std::vector<Sphere_> sorted_spheres_;
256 
259  double sphere_rad_;
260 
264 
268 
272 
276 
277  double c_factor_;
278 
281  std::vector<Sphere_> candidates;
282 
283  std::vector<std::pair<Vector3,double> > asps_;
284 
285  std::vector<std::vector<std::pair<Vector3,double> > > layers_;
286 
293  double radius_(const String& element);
294 
297  void trySphere__(HashGridBox3<Sphere_>::DataIterator data_it,
300 
303  void addSphere_s_();
304 
307  Vector3 calculateT_(HashGridBox3<Sphere_>::DataIterator data_it,
309 
312  void testFirst_(HashGrid3<Sphere_>& hg,HashGridBox3<Sphere_>::DataIterator data_it,
313  Position x, Position y, Position z);
314 
315  void testSecond_(HashGrid3<Sphere_>& hg,HashGridBox3<Sphere_>::DataIterator data_it,
317  Position x, Position y, Position z,Position step);
318 
321  bool testSphereClash_(Vector3& v);
322 
325  bool testProteinClash_(Vector3& v);
326 
329  bool testBC_(Sphere_& sp);
330 
333  void weedCandidates_();
334 
337  bool parse_();
338 
339 
341 
342  };
343 
344 } //namesspace BALL
345 
346 #endif // BALL_STRUCTURE_BINDINGPOCKETPROCESSOR_H