00001 #ifndef BALL_STRUCTURE_PASSPROCESSOR_H
00002 #define BALL_STRUCTURE_PASSPROCESSOR_H
00003
00004 #ifndef BALL_CONCEPT_PROCESSOR_H
00005 # include <BALL/CONCEPT/processor.h>
00006 #endif
00007
00008 #ifndef BALL_KERNEL_RESIDUE_H
00009 # include <BALL/KERNEL/residue.h>
00010 #endif
00011
00012 #ifndef BALL_MATHS_VECTOR3_H
00013 # include <BALL/MATHS/vector3.h>
00014 #endif
00015
00016 #ifndef BALL_KERNEL_SYSTEM_H
00017 # include <BALL/KERNEL/system.h>
00018 #endif
00019
00020 #ifndef BALL_DATATYPE_HASHGRID_H
00021 # include <BALL/DATATYPE/hashGrid.h>
00022 #endif
00023
00024 #ifndef BALL_DATATYPE_OPTIONS_H
00025 # include <BALL/DATATYPE/options.h>
00026 #endif
00027
00028 #include <vector>
00029 #include <string>
00030
00031 #include <fstream>
00032
00033 namespace BALL
00034 {
00035
00040 class BALL_EXPORT BindingPocketProcessor
00041 : public UnaryProcessor<Composite>
00042 {
00043
00044 public:
00045
00048 struct Option
00049 {
00051 static const String HEAVY_ONLY;
00053 static const String PARSE_INI_FILE;
00055 static const String INI_FILE_NAME;
00056
00058 static const String RADIUS_HYDROGEN;
00059 static const String RADIUS_OXYGEN;
00060 static const String RADIUS_NITROGEN;
00061 static const String RADIUS_CARBON;
00062 static const String RADIUS_SULFUR;
00063
00065 static const String PROBE_SPHERE_RADIUS;
00067 static const String PROBE_SPHERE_RADIUS_HYDROGEN_FREE;
00069 static const String PROBE_LAYER_RADIUS;
00071 static const String BURIAL_COUNT_THRESHOLD;
00073 static const String BURIAL_COUNT_THRESHOLD_HYDROGEN_FREE;
00075 static const String BURIAL_COUNT_RADIUS;
00077 static const String PW_SQUARE_WELL;
00078 static const String PW_GAUSSIAN_WIDTH;
00079 static const String PW_MAX_DISTANCE;
00081 static const String MAX_ASPS;
00082
00083 static const String CLASH_FACTOR;
00085 static const String ASP_SEPERATION;
00086 };
00087
00090 struct Default
00091 {
00092 static const bool HEAVY_ONLY;
00093 static const bool PARSE_INI_FILE;
00094 static const String INI_FILE_NAME;
00095
00096 static const double RADIUS_HYDROGEN;
00097 static const double RADIUS_OXYGEN;
00098 static const double RADIUS_NITROGEN;
00099 static const double RADIUS_CARBON;
00100 static const double RADIUS_SULFUR;
00101
00102 static const double PROBE_SPHERE_RADIUS;
00103 static const double PROBE_SPHERE_RADIUS_HYDROGEN_FREE;
00104 static const double PROBE_LAYER_RADIUS;
00105 static const Position BURIAL_COUNT_THRESHOLD;
00106 static const Position BURIAL_COUNT_THRESHOLD_HYDROGEN_FREE;
00107 static const double BURIAL_COUNT_RADIUS;
00108 static const double PW_SQUARE_WELL;
00109 static const double PW_GAUSSIAN_WIDTH;
00110 static const double PW_MAX_DISTANCE;
00111 static const Position MAX_ASPS;
00112 static const double CLASH_FACTOR;
00113 static const double ASP_SEPERATION;
00114 };
00115
00118 BindingPocketProcessor();
00119
00122 BindingPocketProcessor(Options& new_options);
00123
00126 BindingPocketProcessor(const BindingPocketProcessor& pp);
00127
00130 virtual ~BindingPocketProcessor();
00131
00134 const BindingPocketProcessor& operator=(const BindingPocketProcessor& pp);
00135
00137 virtual bool finish();
00138
00139 virtual Processor::Result operator() (Composite &composite);
00140
00143 const vector<std::pair<Vector3,double> >& getActiveSitePoints() const;
00144
00147 const vector<vector<std::pair<Vector3,double> > >& getLayers() const;
00148
00151 Options options;
00152
00153 private:
00154
00158 class Sphere_
00159 {
00160 public:
00162 Sphere_();
00163
00166 BALL::Vector3 position;
00167
00170 float radius;
00171
00174 Position b_count;
00175
00178 float probe_weight;
00179
00182 Position layer;
00183
00186 inline bool operator<(const Sphere_& sp) const {return probe_weight > sp.probe_weight;};
00187
00190 int id;
00191 static int global_id;
00192 Position a,b,c,d;
00193
00196 inline bool operator==(const Sphere_& sp) const {return a == sp.a && b == sp.b && c == sp.c && d == sp.d;};
00197 };
00198
00201 class SphereComparator_
00202 {
00203 public:
00204 int operator()(const Sphere_& sp1, const Sphere_& sp2) const
00205 {
00206 if (sp1.a != sp2.a)
00207 return sp1.a < sp2.a;
00208 if (sp1.b != sp2.b)
00209 return sp1.b < sp2.b;
00210 if (sp1.c != sp2.c)
00211 return sp1.c < sp2.c;
00212 if (sp1.d != sp2.d)
00213 return sp1.d < sp2.d;
00214 return 0;
00215 };
00216 };
00217
00220 Position layer_;
00221
00224 friend std::ostream& operator<<(std::ostream& os, const BindingPocketProcessor::Sphere_& sp) {return os;};
00225
00228 HashGrid3<Sphere_> sphere_grid_;
00229
00232 HashGrid3<Sphere_> protein_grid_;
00233
00236 HashGrid3<Sphere_> layer_grid_;
00237
00240 HashGrid3<Sphere_> clayer_grid_;
00241
00244 HashGrid3<Sphere_> BC_grid_;
00245
00248 HashGrid3<Sphere_> pw_grid_;
00249
00252 HashGrid3<Sphere_> candidates_grid_;
00253
00254 std::vector<Sphere_> sorted_spheres_;
00255
00258 double sphere_rad_;
00259
00262 double second_layer_rad_;
00263
00266 double protein_clash_rad_;
00267
00270 double BC_threshold_;
00271
00274 Position found_new_;
00275
00276 double c_factor_;
00277
00280 std::vector<Sphere_> candidates;
00281
00282 std::vector<std::pair<Vector3,double> > asps_;
00283
00284 std::vector<std::vector<std::pair<Vector3,double> > > layers_;
00285
00292 double radius_(const String& element);
00293
00296 void trySphere__(HashGridBox3<Sphere_>::DataIterator data_it,
00297 HashGridBox3<Sphere_>::DataIterator data_it2,
00298 HashGridBox3<Sphere_>::DataIterator data_it3);
00299
00302 void addSphere_s_();
00303
00306 Vector3 calculateT_(HashGridBox3<Sphere_>::DataIterator data_it,
00307 HashGridBox3<Sphere_>::DataIterator data_it2);
00308
00311 void testFirst_(HashGrid3<Sphere_>& hg,HashGridBox3<Sphere_>::DataIterator data_it,
00312 Position x, Position y, Position z);
00313
00314 void testSecond_(HashGrid3<Sphere_>& hg,HashGridBox3<Sphere_>::DataIterator data_it,
00315 HashGridBox3<Sphere_>::DataIterator data_it2,
00316 Position x, Position y, Position z,Position step);
00317
00320 bool testSphereClash_(Vector3& v);
00321
00324 bool testProteinClash_(Vector3& v);
00325
00328 bool testBC_(Sphere_& sp);
00329
00332 void weedCandidates_();
00333
00336 bool parse_();
00337
00338
00339 bool second_it_;
00340
00341 };
00342
00343 }
00344
00345 #endif // BALL_STRUCTURE_BALLProcessor_H