Skip to content
Snippets Groups Projects
Commit 8a18bea2 authored by Valerio Mariani's avatar Valerio Mariani
Browse files

Refactored iinterface and export of ClashingDistance class

parent ecc3593c
Branches
Tags
No related merge requests found
......@@ -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
......
......@@ -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):
......
......@@ -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)
......
......@@ -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) {
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment