BALL
1.4.1
|
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 // additional factor for the computation of the collision of two spheres 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 00225 friend std::ostream& operator<<(std::ostream& os, const BindingPocketProcessor::Sphere_& /*sp*/) {return os;}; 00226 00229 HashGrid3<Sphere_> sphere_grid_; 00230 00233 HashGrid3<Sphere_> protein_grid_; 00234 00237 HashGrid3<Sphere_> layer_grid_; 00238 00241 HashGrid3<Sphere_> clayer_grid_; 00242 00245 HashGrid3<Sphere_> BC_grid_; 00246 00249 HashGrid3<Sphere_> pw_grid_; 00250 00253 HashGrid3<Sphere_> candidates_grid_; 00254 00255 std::vector<Sphere_> sorted_spheres_; 00256 00259 double sphere_rad_; 00260 00263 double second_layer_rad_; 00264 00267 double protein_clash_rad_; 00268 00271 double BC_threshold_; 00272 00275 Position found_new_; 00276 00277 double c_factor_; 00278 00281 std::vector<Sphere_> candidates; 00282 00283 std::vector<std::pair<Vector3,double> > asps_; 00284 00285 std::vector<std::vector<std::pair<Vector3,double> > > layers_; 00286 00293 double radius_(const String& element); 00294 00297 void trySphere__(HashGridBox3<Sphere_>::DataIterator data_it, 00298 HashGridBox3<Sphere_>::DataIterator data_it2, 00299 HashGridBox3<Sphere_>::DataIterator data_it3); 00300 00303 void addSphere_s_(); 00304 00307 Vector3 calculateT_(HashGridBox3<Sphere_>::DataIterator data_it, 00308 HashGridBox3<Sphere_>::DataIterator data_it2); 00309 00312 void testFirst_(HashGrid3<Sphere_>& hg,HashGridBox3<Sphere_>::DataIterator data_it, 00313 Position x, Position y, Position z); 00314 00315 void testSecond_(HashGrid3<Sphere_>& hg,HashGridBox3<Sphere_>::DataIterator data_it, 00316 HashGridBox3<Sphere_>::DataIterator data_it2, 00317 Position x, Position y, Position z,Position step); 00318 00321 bool testSphereClash_(Vector3& v); 00322 00325 bool testProteinClash_(Vector3& v); 00326 00329 bool testBC_(Sphere_& sp); 00330 00333 void weedCandidates_(); 00334 00337 bool parse_(); 00338 00339 00340 bool second_it_; 00341 00342 }; 00343 00344 } //namesspace BALL 00345 00346 #endif // BALL_STRUCTURE_BALLProcessor_H