00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_MOL_ALG_FILTER_CLASHES_HH
00020 #define OST_MOL_ALG_FILTER_CLASHES_HH
00021
00022 #include <ost/mol/entity_view.hh>
00023 #include <ost/mol/alg/module_config.hh>
00024 #include <ost/mol/alg/distance_test_common.hh>
00025 namespace ost { namespace mol { namespace alg {
00026
00027 class DLLEXPORT_OST_MOL_ALG BondLengthInfo
00028 {
00029 public:
00030 BondLengthInfo(): avg_length_(0),avg_zscore_(0),count_(0) {}
00031 BondLengthInfo(Real avg_length,Real avg_zscore, int count):
00032 avg_length_(avg_length),
00033 avg_zscore_(avg_zscore),
00034 count_(count){}
00035 Real GetAvgLength() {return avg_length_;}
00036 Real GetAvgZscore() {return avg_zscore_;}
00037 int GetCount() {return count_;}
00038
00039 private:
00040 Real avg_length_;
00041 Real avg_zscore_;
00042 int count_;
00043 };
00044
00045 class DLLEXPORT_OST_MOL_ALG ClashEvent
00046 {
00047 public:
00048 ClashEvent(): atom1_(UniqueAtomIdentifier()),atom2_(UniqueAtomIdentifier()),mdl_dist_(0.0),adjusted_ref_dist_(0.0) {}
00049 ClashEvent(const UniqueAtomIdentifier& atom1,const UniqueAtomIdentifier& atom2, Real mdl_dist, Real adjusted_ref_dist ):
00050 atom1_(atom1),atom2_(atom2),mdl_dist_(mdl_dist),adjusted_ref_dist_(adjusted_ref_dist) {}
00051 UniqueAtomIdentifier GetFirstAtom() const { return atom1_; }
00052 UniqueAtomIdentifier GetSecondAtom() const { return atom2_; }
00053 Real GetModelDistance() const { return mdl_dist_; }
00054 Real GetAdjustedReferenceDistance() const { return adjusted_ref_dist_; }
00055 private:
00056 UniqueAtomIdentifier atom1_;
00057 UniqueAtomIdentifier atom2_;
00058 Real mdl_dist_;
00059 Real adjusted_ref_dist_;
00060 };
00061
00062 class DLLEXPORT_OST_MOL_ALG ClashingInfo
00063 {
00064
00065 public:
00066 ClashingInfo(): clash_count_(0), average_offset_ (0), clash_list_(std::vector<ClashEvent>()) {}
00067 ClashingInfo (int clash_count, Real average_offset, const std::vector<ClashEvent>& clash_list):
00068 clash_count_(clash_count), average_offset_ (average_offset),clash_list_(clash_list) {}
00069 int GetClashCount() const {return clash_count_/2.0;}
00070 Real GetAverageOffset() const {return average_offset_;}
00071 std::vector<ClashEvent> GetClashList() const;
00072
00073 private:
00074 int clash_count_;
00075 Real average_offset_;
00076 std::vector<ClashEvent> clash_list_;
00077 };
00078
00079 class DLLEXPORT_OST_MOL_ALG StereoChemicalBondViolation
00080 {
00081 public:
00082 StereoChemicalBondViolation():
00083 atom1_(UniqueAtomIdentifier()),atom2_(UniqueAtomIdentifier()),mdl_value_(0.0),allowed_range_(std::pair<Real,Real>(0.0,0.0)) {}
00084 StereoChemicalBondViolation(const UniqueAtomIdentifier& atom1,
00085 const UniqueAtomIdentifier& atom2,
00086 Real mdl_value, std::pair<Real,Real> allowed_range ):
00087 atom1_(atom1),atom2_(atom2),mdl_value_(mdl_value),allowed_range_(allowed_range) {}
00088 UniqueAtomIdentifier GetFirstAtom() const { return atom1_; }
00089 UniqueAtomIdentifier GetSecondAtom() const { return atom2_; }
00090 Real GetBondLength() const { return mdl_value_; }
00091 std::pair<Real,Real> GetAllowedRange() const { return allowed_range_; }
00092 private:
00093 UniqueAtomIdentifier atom1_;
00094 UniqueAtomIdentifier atom2_;
00095 Real mdl_value_;
00096 std::pair<Real,Real> allowed_range_;
00097 };
00098
00099 class DLLEXPORT_OST_MOL_ALG StereoChemicalAngleViolation
00100 {
00101 public:
00102 StereoChemicalAngleViolation():
00103 atom1_(UniqueAtomIdentifier()),atom2_(UniqueAtomIdentifier()),atom3_(UniqueAtomIdentifier()),mdl_value_(0.0),allowed_range_(std::pair<Real,Real>(0.0,0.0)) {}
00104 StereoChemicalAngleViolation(const UniqueAtomIdentifier& atom1,
00105 const UniqueAtomIdentifier& atom2,
00106 const UniqueAtomIdentifier& atom3,
00107 Real mdl_value, std::pair<Real,Real> allowed_range ):
00108 atom1_(atom1),atom2_(atom2),atom3_(atom3),mdl_value_(mdl_value),allowed_range_(allowed_range) {}
00109 UniqueAtomIdentifier GetFirstAtom() const { return atom1_; }
00110 UniqueAtomIdentifier GetSecondAtom() const { return atom2_; }
00111 UniqueAtomIdentifier GetThirdAtom() const { return atom3_; }
00112 Real GetAngleWidth() const { return mdl_value_; }
00113 std::pair<Real,Real> GetAllowedRange() const { return allowed_range_; }
00114 private:
00115 UniqueAtomIdentifier atom1_;
00116 UniqueAtomIdentifier atom2_;
00117 UniqueAtomIdentifier atom3_;
00118 Real mdl_value_;
00119 std::pair<Real,Real> allowed_range_;
00120 };
00121
00122 class DLLEXPORT_OST_MOL_ALG StereoChemistryInfo
00123 {
00124 public:
00125 StereoChemistryInfo():
00126 avg_zscore_bonds_(0),
00127 bad_bond_count_(0),
00128 bond_count_(0),
00129 avg_zscore_angles_(0),
00130 bad_angle_count_(0),
00131 angle_count_(0),
00132 avg_bond_length_info_(std::map<String,BondLengthInfo>()),
00133 bond_violation_list_(std::vector<StereoChemicalBondViolation>()),
00134 angle_violation_list_(std::vector<StereoChemicalAngleViolation>()) {}
00135 StereoChemistryInfo(Real avg_zscore_bonds, int bad_bond_count, int bond_count,
00136 Real avg_zscore_angles, int bad_angle_count, int angle_count,
00137 const std::map<String,BondLengthInfo>& avg_bond_length_info,
00138 const std::vector<StereoChemicalBondViolation>& bond_violation_list,
00139 const std::vector<StereoChemicalAngleViolation>& angle_violation_list):
00140 avg_zscore_bonds_(avg_zscore_bonds),
00141 bad_bond_count_(bad_bond_count),
00142 bond_count_(bond_count),
00143 avg_zscore_angles_(avg_zscore_angles),
00144 bad_angle_count_(bad_angle_count),
00145 angle_count_(angle_count),
00146 avg_bond_length_info_(avg_bond_length_info),
00147 bond_violation_list_(bond_violation_list),
00148 angle_violation_list_(angle_violation_list) {}
00149 Real GetAvgZscoreBonds() const {return avg_zscore_bonds_;}
00150 int GetBadBondCount() const {return bad_bond_count_;}
00151 int GetBondCount() const {return bond_count_;}
00152 Real GetAvgZscoreAngles() const {return avg_zscore_angles_;}
00153 int GetBadAngleCount() const {return bad_angle_count_;}
00154 int GetAngleCount() const {return angle_count_;}
00155 std::map<String,BondLengthInfo> GetAvgBondLengthInfo() {return avg_bond_length_info_;}
00156 std::vector<StereoChemicalBondViolation> GetBondViolationList() { return bond_violation_list_; }
00157 std::vector<StereoChemicalAngleViolation> GetAngleViolationList() { return angle_violation_list_; }
00158
00159
00160 private:
00161 Real avg_zscore_bonds_;
00162 int bad_bond_count_;
00163 int bond_count_;
00164 Real avg_zscore_angles_;
00165 int bad_angle_count_;
00166 int angle_count_;
00167 std::map<String,BondLengthInfo> avg_bond_length_info_;
00168 std::vector<StereoChemicalBondViolation> bond_violation_list_;
00169 std::vector<StereoChemicalAngleViolation> angle_violation_list_;
00170 };
00171
00172
00174 class DLLEXPORT_OST_MOL_ALG ClashingDistances
00175 {
00176
00177 public:
00179 ClashingDistances(): valid_flag_(true) {}
00180
00184 void SetClashingDistance(const String& ele1,const String& ele2, Real min_distance, Real tolerance);
00185
00187 std::pair<Real,Real> GetClashingDistance(const String& ele1,const String& ele2) const;
00188
00190 Real GetAdjustedClashingDistance(const String& ele1,const String& ele2) const;
00191
00193 Real GetMaxAdjustedDistance() const;
00194
00196 bool IsEmpty() const;
00197
00199 void PrintAllDistances() const;
00200
00201 private:
00202
00203 std::map <String,std::pair<Real,Real> > min_distance_;
00204 Real default_min_distance_;
00205 Real default_min_distance_tolerance_;
00206 bool valid_flag_;
00207
00208 };
00209
00213 class DLLEXPORT_OST_MOL_ALG StereoChemicalParams
00214 {
00215
00216 public:
00218 void SetParam(const String& param, const String& residue, Real value, Real st_dev);
00219
00223 std::pair<Real,Real> GetParam(const String& element,const String& residue) const;
00224
00228 bool ContainsParam(const String& param,const String& residue) const;
00229
00233 bool IsEmpty() const;
00234
00236 void PrintAllParameters() const;
00237
00238 private:
00239
00240 std::map<std::pair<String,String>,std::pair<Real,Real> > params_;
00241
00242 };
00243
00247 ClashingDistances DLLEXPORT_OST_MOL_ALG FillClashingDistances(std::vector<String>& stereo_chemical_props_file);
00248
00253 StereoChemicalParams DLLEXPORT_OST_MOL_ALG FillStereoChemicalParams(const String& header, std::vector<String>& stereo_chemical_props_file);
00254
00262 std::pair<EntityView,ClashingInfo> DLLEXPORT_OST_MOL_ALG FilterClashes(const EntityView& ent,
00263 const ClashingDistances& min_distances, bool always_remove_bb=false);
00264
00272 std::pair<EntityView,ClashingInfo> DLLEXPORT_OST_MOL_ALG FilterClashes(const EntityHandle& ent,
00273 const ClashingDistances& min_distances, bool always_remove_bb=false);
00274
00282 std::pair<EntityView,StereoChemistryInfo> DLLEXPORT_OST_MOL_ALG CheckStereoChemistry(const EntityView& ent,
00283 const StereoChemicalParams& bond_table,
00284 const StereoChemicalParams& angle_table,
00285 Real bond_tolerance,
00286 Real angle_tolerance,
00287 bool always_remove_bb=false);
00288
00296 std::pair<EntityView,StereoChemistryInfo> DLLEXPORT_OST_MOL_ALG CheckStereoChemistry(const EntityHandle& ent,
00297 const StereoChemicalParams& bond_table,
00298 const StereoChemicalParams& angle_table,
00299 Real bond_tolerance,
00300 Real angle_tolerance,
00301 bool always_remove_bb=false);
00302
00303
00304 }}}
00305
00306
00307 #endif