diff --git a/modules/mol/alg/pymod/wrap_mol_alg.cc b/modules/mol/alg/pymod/wrap_mol_alg.cc index 687692f5f6c32baad7159b5bf8cfa6d9617d26d8..fa04f27d223da4a9e7aa02ff073e68db5f9a890f 100644 --- a/modules/mol/alg/pymod/wrap_mol_alg.cc +++ b/modules/mol/alg/pymod/wrap_mol_alg.cc @@ -18,6 +18,7 @@ //------------------------------------------------------------------------------ #include <boost/python.hpp> +#include <boost/python/suite/indexing/vector_indexing_suite.hpp> #include <ost/config.hh> #include <ost/mol/alg/local_dist_test.hh> #include <ost/mol/alg/superpose_frames.hh> @@ -86,6 +87,7 @@ BOOST_PYTHON_MODULE(_ost_mol_alg) def("CheckStereoChemistry", csc_a, (arg("ent"), arg("bonds"), arg("angles"), arg("bond_tolerance"), arg("angle_tolerance"), arg("always_remove_bb")=false)); def("CheckStereoChemistry", csc_b, (arg("ent"), arg("bonds"), arg("angles"), arg("bond_tolerance"), arg("angle_tolerance"), arg("always_remove_bb")=false)); def("LDTHA",&mol::alg::LDTHA); + def("CreateDistanceList",&mol::alg::CreateDistanceList); def("SuperposeFrames", superpose_frames1, (arg("source"), arg("sel")=ost::mol::EntityView(), arg("begin")=0, @@ -113,7 +115,30 @@ BOOST_PYTHON_MODULE(_ost_mol_alg) .def("PrintAllParameters",&mol::alg::StereoChemicalParams::PrintAllParameters) ; - + + class_<mol::alg::UniqueAtomIdentifier> ("UniqueAtomIdentifier" ,init <const String&, const mol::ResNum&, const String&, const String&>()) + .def("GetChainName",&mol::alg::UniqueAtomIdentifier::GetChainName) + .def("GetResNum",&mol::alg::UniqueAtomIdentifier::GetResNum) + .def("GetResidueName",&mol::alg::UniqueAtomIdentifier::GetResidueName) + .def("GetAtomName",&mol::alg::UniqueAtomIdentifier::GetAtomName) + ; + + + class_<mol::alg::ReferenceDistance> ("ReferenceDistance", init <const mol::alg::UniqueAtomIdentifier&,const mol::alg::UniqueAtomIdentifier&, Real, Real>()) + .def("GetFirstAtom",&mol::alg::ReferenceDistance::GetFirstAtom) + .def("GetSecondAtom",&mol::alg::ReferenceDistance::GetSecondAtom) + .def("GetMinDistance",&mol::alg::ReferenceDistance::GetMinDistance) + .def("GetMaxDistance",&mol::alg::ReferenceDistance::GetMaxDistance) + ; + + class_<std::vector<mol::alg::ReferenceDistance> >("ResidueDistanceList") + .def(vector_indexing_suite<std::vector<mol::alg::ReferenceDistance > >()) + ; + + class_<std::vector<mol::alg::ResidueDistanceList> >("GlobalDistanceList") + .def(vector_indexing_suite<std::vector<mol::alg::ResidueDistanceList > >()) + ; + def("FillClashingDistances",&fill_clashing_distances_wrapper); def("FillStereoChemicalParams",&fill_stereochemical_params_wrapper); diff --git a/modules/mol/alg/src/local_dist_test.cc b/modules/mol/alg/src/local_dist_test.cc index d652051286d53f01a19acb8ac67b31f937c7d356..ed589a255a99f654bea0f8bf7df9712be365c55f 100644 --- a/modules/mol/alg/src/local_dist_test.cc +++ b/modules/mol/alg/src/local_dist_test.cc @@ -235,6 +235,17 @@ std::pair<Real, Real> calc_overlap2(const seq::ConstSequenceHandle& ref_seq, } +bool UniqueAtomIdentifier::operator==(const UniqueAtomIdentifier& rhs) const +{ + if (chain_ == rhs.GetChainName() && + residue_ == rhs.GetResNum() && + residue_name_ == rhs.GetResidueName() && + atom_ == rhs.GetAtomName() ) { + return true; + } + return false; +} + bool ReferenceDistance::IsValid() const { if (mind_ == -1.0 and maxd_ == -1.0) { @@ -254,6 +265,20 @@ void ReferenceDistance::Print() const } } +bool ReferenceDistance::operator==(const ReferenceDistance& rhs) const +{ + if (first_atom_ == rhs.GetFirstAtom() && + second_atom_ == rhs.GetSecondAtom() && + mind_ == rhs.GetMinDistance() && + maxd_ == rhs.GetMaxDistance() ) { + return true; + } + return false; +} + + + + GlobalDistanceList CreateDistanceList(const EntityView& ref,Real max_dist) { GlobalDistanceList dist_list; diff --git a/modules/mol/alg/src/local_dist_test.hh b/modules/mol/alg/src/local_dist_test.hh index 872a974f6868d2a84658cb1685c58e1c39f810bd..8c757badd9c9e367c3ae3badea2733af47d1b7a9 100644 --- a/modules/mol/alg/src/local_dist_test.hh +++ b/modules/mol/alg/src/local_dist_test.hh @@ -36,7 +36,8 @@ public: ResNum GetResNum() const { return residue_; } String GetResidueName() const { return residue_name_; } String GetAtomName() const { return atom_; } - + bool operator==(const UniqueAtomIdentifier& rhs) const; + private: String chain_; @@ -50,7 +51,7 @@ class ReferenceDistance public: - ReferenceDistance(UniqueAtomIdentifier first_atom, UniqueAtomIdentifier second_atom, Real mind, Real maxd): + ReferenceDistance(const UniqueAtomIdentifier& first_atom, const UniqueAtomIdentifier& second_atom, Real mind, Real maxd): first_atom_(first_atom),second_atom_(second_atom),mind_(mind),maxd_(maxd) {} UniqueAtomIdentifier GetFirstAtom() const {return first_atom_;} UniqueAtomIdentifier GetSecondAtom() const {return second_atom_;} @@ -58,6 +59,7 @@ public: Real GetMaxDistance() const {return maxd_ ;} bool IsValid() const; void Print() const; + bool operator==(const ReferenceDistance& rhs) const; private: @@ -65,8 +67,6 @@ private: UniqueAtomIdentifier second_atom_; Real mind_; Real maxd_; - bool valid; - }; typedef std::vector<ReferenceDistance> ResidueDistanceList;