diff --git a/modules/io/pymod/export_omf_io.cc b/modules/io/pymod/export_omf_io.cc index 1c52809be6271890cefea06d2d0e7d9ace5c94f7..cfb1977a819ca9d82c1b305cd0a86cc639440cae 100644 --- a/modules/io/pymod/export_omf_io.cc +++ b/modules/io/pymod/export_omf_io.cc @@ -67,6 +67,10 @@ namespace{ return boost::python::make_tuple(VecToList(rnums), pos); } + boost::python::list wrap_get_rnums(OMFPtr omf, const String& cname) { + const std::vector<int>& rnums = omf->GetRNums(cname); + return VecToList<int>(rnums); + } } void export_omf_io() { @@ -97,6 +101,7 @@ void export_omf_io() { .def("GetAvgBFactors", &OMF::GetAvgBFactors,(arg("cname"))) .def("GetOccupancies", &OMF::GetOccupancies, return_value_policy<reference_existing_object>(),(arg("cname"))) .def("GetSequence", &OMF::GetSequence, (arg("cname"))) + .def("GetRNums", &wrap_get_rnums, (arg("cname"))) .def("ToAssembly", &wrap_to_assembly, (arg("bu_info"))) .def("Trace", &wrap_trace, (arg("cname"), arg("aname"))) ; diff --git a/modules/io/src/mol/omf.cc b/modules/io/src/mol/omf.cc index b4fd31c8619cf47397778110a3120aaa4f784293..a00acc67eb04e25e023fd2f95f33442e87226ef2 100644 --- a/modules/io/src/mol/omf.cc +++ b/modules/io/src/mol/omf.cc @@ -5677,4 +5677,12 @@ String OMF::GetSequence(const String& cname) const { return sequence; } +const std::vector<int>& OMF::GetRNums(const String& cname) const { + auto it = chain_data_.find(cname); + if(it == chain_data_.end()) { + throw ost::Error("Provided chain name not in OMF structure"); + } + return it->second->rnums; +} + }} //ns diff --git a/modules/io/src/mol/omf.hh b/modules/io/src/mol/omf.hh index ce0850e3774988e1e9694c171877bee369921322..2fd9c05952f8045cf849e10860e809eb3b0dee10 100644 --- a/modules/io/src/mol/omf.hh +++ b/modules/io/src/mol/omf.hh @@ -242,6 +242,8 @@ public: String GetSequence(const String& cname) const; + const std::vector<int>& GetRNums(const String& cname) const; + // raw data access - pros only... const std::vector<ResidueDefinition>& GetResidueDefinitions() const { return residue_definitions_;