Skip to content
Snippets Groups Projects
Commit c6ff3211 authored by Studer Gabriel's avatar Studer Gabriel
Browse files

Python export for extracting secondary structure segments from ChainHandle/ChainView

parent bd3682cb
Branches
Tags
No related merge requests found
......@@ -19,8 +19,10 @@
#include <boost/python.hpp>
#include <boost/python/suite/indexing/vector_indexing_suite.hpp>
#include <ost/mol/alg/sec_struct.hh>
#include <ost/mol/alg/sec_structure_segments.hh>
using namespace boost::python;
......@@ -34,6 +36,31 @@ void AssignSecStructHandle(ost::mol::EntityHandle& handle) {
ost::mol::alg::AssignSecStruct(handle);
}
ost::mol::alg::SecStructureSegments
ExtractHelicalSegments_handle(const ost::mol::ChainHandle& chain) {
return ost::mol::alg::ExtractHelicalSegments(chain);
}
ost::mol::alg::SecStructureSegments
ExtractHelicalSegments_view(const ost::mol::ChainView& chain) {
return ost::mol::alg::ExtractHelicalSegments(chain);
}
ost::mol::alg::SecStructureSegments
ExtractExtendedSegments_handle(const ost::mol::ChainHandle& chain) {
return ost::mol::alg::ExtractExtendedSegments(chain);
}
ost::mol::alg::SecStructureSegments
ExtractExtendedSegments_view(const ost::mol::ChainView& chain) {
return ost::mol::alg::ExtractExtendedSegments(chain);
}
ost::mol::alg::SecStructureSegments
ExtractSecStructureSegments_handle(const ost::mol::ChainHandle& chain) {
return ost::mol::alg::ExtractSecStructureSegments(chain);
}
ost::mol::alg::SecStructureSegments
ExtractSecStructureSegments_view(const ost::mol::ChainView& chain) {
return ost::mol::alg::ExtractSecStructureSegments(chain);
}
} // ns
void export_sec_struct() {
......@@ -41,3 +68,23 @@ void export_sec_struct() {
def("AssignSecStruct", &AssignSecStructHandle, (arg("ent")));
}
void export_sec_struct_segments() {
class_<ost::mol::alg::SecStructureSegment>("SecStructureSegment", init<int,int,ost::mol::SecStructure>())
.def_readwrite("first", &ost::mol::alg::SecStructureSegment::first)
.def_readwrite("last", &ost::mol::alg::SecStructureSegment::last)
.def_readwrite("ss_type", &ost::mol::alg::SecStructureSegment::ss_type)
;
class_<ost::mol::alg::SecStructureSegments>("SecStructureSegments", init<>())
.def(vector_indexing_suite<ost::mol::alg::SecStructureSegments>())
;
def("ExtractHelicalSegments", &ExtractHelicalSegments_handle, (arg("chain")));
def("ExtractHelicalSegments", &ExtractHelicalSegments_view, (arg("chain")));
def("ExtractExtendedSegments", &ExtractExtendedSegments_handle, (arg("chain")));
def("ExtractExtendedSegments", &ExtractExtendedSegments_view, (arg("chain")));
def("ExtractSecStructureSegments", &ExtractSecStructureSegments_handle, (arg("chain")));
def("ExtractSecStructureSegments", &ExtractSecStructureSegments_view, (arg("chain")));
}
......@@ -47,6 +47,7 @@ void export_Molck();
void export_contact_overlap();
void export_accessibility();
void export_sec_struct();
void export_sec_struct_segments();
void export_find_membrane();
#if OST_IMG_ENABLED
void export_entity_to_density();
......@@ -319,6 +320,7 @@ BOOST_PYTHON_MODULE(_ost_mol_alg)
export_contact_overlap();
export_accessibility();
export_sec_struct();
export_sec_struct_segments();
export_find_membrane();
#if OST_IMG_ENABLED
export_entity_to_density();
......
......@@ -35,6 +35,15 @@ struct DLLEXPORT_OST_MOL_ALG SecStructureSegment {
SecStructureSegment():
first(0), last(0), ss_type(SecStructure::COIL)
{ }
bool operator==(const SecStructureSegment& rhs) const
{
return first==rhs.first && last==rhs.last && ss_type==rhs.ss_type;
}
bool operator!=(const SecStructureSegment& rhs) const
{
return !(*this==rhs);
}
/// \brief index of first residue part of the segment
int first;
/// \brief index of last residue part of the segment
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment