diff --git a/modules/mol/alg/doc/molalg.rst b/modules/mol/alg/doc/molalg.rst index 66b14294022870a6dfe967ce407994388ef6679d..5a3e5e7c9ac93646263e05e18b45e198bcb734b3 100644 --- a/modules/mol/alg/doc/molalg.rst +++ b/modules/mol/alg/doc/molalg.rst @@ -276,7 +276,7 @@ The following function detects steric clashes in atomic structures. Two atoms ar :param clash_distance: minimum clashing distance (in Angstroms) :param tolerance: tolerance threshold (in Angstroms) - .. method GetClashingDistance() + .. method:: GetClashingDistance() Recovers a reference distance and a tolerance threshold from the list @@ -285,6 +285,15 @@ The following function detects steric clashes in atomic structures. Two atoms ar :returns: a tuple containing the minimum clashing distance and the tolerance threshold + .. method:: GetAdjustedClashingDistance() + + Recovers a reference distance from the list, already adjusted by the tolerance threshold + + :param ele1: string containing the first element's name + :param ele2: string containing the second element's name + + :returns: the adjusted minimum clashing distance + .. method:: GetMaxAdjustedDistance() Returns the longest clashing distance in the list, after adjustment with tolerance threshold diff --git a/modules/mol/alg/pymod/__init__.py b/modules/mol/alg/pymod/__init__.py index 126d0196f2d6ff25148a6724df5dd63a1e764d6a..36d93a7203cd76b7c38e619d2981895277db564b 100644 --- a/modules/mol/alg/pymod/__init__.py +++ b/modules/mol/alg/pymod/__init__.py @@ -6,11 +6,11 @@ import ost.mol.alg.structure_analysis import ost.mol.alg.helix_kinks # Fills a list of reference clashing distances from a file (requires a path to the file) -def FillClashingDistancesFromFile(filename,default_clashing_distance,default_tolerance): +def FillClashingDistancesFromFile(filename): fh=open(filename,'r') lines=fh.readlines() fh.close() - return FillClashingDistances(lines,default_clashing_distance,default_tolerance) + return FillClashingDistances(lines) # Fills a list of bond stereo-chemical statistics from a file (requires a path to the file) def FillBondStereoChemicalParamsFromFile(filename): diff --git a/modules/mol/alg/pymod/wrap_mol_alg.cc b/modules/mol/alg/pymod/wrap_mol_alg.cc index 08ad6631efe89ce483e9cc653c2baec321db6927..bdf141aa55b89e2a3a28235f8432c87b21702045 100644 --- a/modules/mol/alg/pymod/wrap_mol_alg.cc +++ b/modules/mol/alg/pymod/wrap_mol_alg.cc @@ -24,6 +24,7 @@ #include <ost/mol/alg/superpose_frames.hh> #include <ost/mol/alg/filter_clashes.hh> #include <ost/mol/alg/consistency_checks.hh> +#include <ost/export_helper/pair_to_tuple_conv.hh> using namespace boost::python; using namespace ost; @@ -60,7 +61,7 @@ ost::mol::alg::StereoChemicalParams fill_stereochemical_params_wrapper (const St return ost::mol::alg::FillStereoChemicalParams(header,stereo_chemical_props_file_vector); } -ost::mol::alg::ClashingDistances fill_clashing_distances_wrapper (const list& stereo_chemical_props_file, Real min_default_distance, Real min_distance_tolerance) +ost::mol::alg::ClashingDistances fill_clashing_distances_wrapper (const list& stereo_chemical_props_file) { int stereo_chemical_props_file_length = boost::python::extract<int>(stereo_chemical_props_file.attr("__len__")()); std::vector<String> stereo_chemical_props_file_vector(stereo_chemical_props_file_length); @@ -103,6 +104,9 @@ BOOST_PYTHON_MODULE(_ost_mol_alg) export_entity_to_density(); #endif + to_python_converter<std::pair<Real,Real>, + PairToTupleConverter<Real, Real> >(); + def("LocalDistDiffTest", lddt_a, (arg("sequence_separation")=0,arg("local_lddt_property_string")="")); def("LocalDistDiffTest", lddt_c, (arg("local_lddt_property_string")="")); def("LocalDistDiffTest", lddt_b, (arg("ref_index")=0, arg("mdl_index")=1)); @@ -124,6 +128,7 @@ BOOST_PYTHON_MODULE(_ost_mol_alg) class_<mol::alg::ClashingDistances> ("ClashingDistances",init<>()) .def("SetClashingDistance",&mol::alg::ClashingDistances::SetClashingDistance) .def("GetClashingDistance",&mol::alg::ClashingDistances::GetClashingDistance) + .def("GetAdjustedClashingDistance",&mol::alg::ClashingDistances::GetAdjustedClashingDistance) .def("GetMaxAdjustedDistance",&mol::alg::ClashingDistances::GetMaxAdjustedDistance) .def("IsEmpty",&mol::alg::ClashingDistances::IsEmpty) diff --git a/modules/mol/alg/src/filter_clashes.cc b/modules/mol/alg/src/filter_clashes.cc index 235464544cfd4ac359629257874cf051663b13bb..dc450498e2c2301d70127111ee2796e13f9b15a3 100644 --- a/modules/mol/alg/src/filter_clashes.cc +++ b/modules/mol/alg/src/filter_clashes.cc @@ -108,6 +108,12 @@ std::pair<Real,Real> ClashingDistances::GetClashingDistance(const String& ele1,c return find_ci->second; } +Real ClashingDistances::GetAdjustedClashingDistance(const String& ele1,const String& ele2) const +{ + std::pair <Real,Real> clash_dist = GetClashingDistance(ele1,ele2); + return clash_dist.first-clash_dist.second; +} + void ClashingDistances::PrintAllDistances() const { for (std::map <String,std::pair<float,float> >::const_iterator index = min_distance_.begin();index != min_distance_.end();++index) { diff --git a/modules/mol/alg/src/filter_clashes.hh b/modules/mol/alg/src/filter_clashes.hh index f9d7473b6ce1eb0d5044c6f46a4bebadc86bff83..e294cd4895ad9790a3b001a73873f8b7b4812cc8 100644 --- a/modules/mol/alg/src/filter_clashes.hh +++ b/modules/mol/alg/src/filter_clashes.hh @@ -40,6 +40,9 @@ public: /// \brief Recovers a reference distance and a tolerance threshold (respectively) from the list std::pair<Real,Real> GetClashingDistance(const String& ele1,const String& ele2) const; + /// \brief Recovers a reference distance already adjusted by the tolerance threshold from the list + Real GetAdjustedClashingDistance(const String& ele1,const String& ele2) const; + /// \brief Recovers the longest distance in the list, corrected by tolerance Real GetMaxAdjustedDistance() const;