diff --git a/modules/io/pymod/export_mmcif_io.cc b/modules/io/pymod/export_mmcif_io.cc index 325fb24397b2d60c92c31b19409f5bda53634e46..3ca9d9dcd3f19cbb38e2f50f2d24b3f5eeafb0f3 100644 --- a/modules/io/pymod/export_mmcif_io.cc +++ b/modules/io/pymod/export_mmcif_io.cc @@ -550,6 +550,8 @@ void export_mmcif_io() .def("GetEntityBranchChains", &MMCifInfo::GetEntityBranchChains) .def("SetEntityDesc", &MMCifInfo::SetEntityDesc) .def("GetEntityDesc", &MMCifInfo::GetEntityDesc, return_value_policy<copy_const_reference>()) + .def("GetEntityIds", &MMCifInfo::GetEntityIds) + .def("GetEntityIdsOfType", &MMCifInfo::GetEntityIdsOfType) .add_property("citations", make_function(&MMCifInfo::GetCitations, return_value_policy<copy_const_reference>())) .add_property("biounits", make_function(&MMCifInfo::GetBioUnits, diff --git a/modules/io/src/mol/mmcif_info.cc b/modules/io/src/mol/mmcif_info.cc index 96f256ca91fc80811eb8380d67a611d43ce3e116..e723440a4acf6f086a6e89d514ef5066d19d9a02 100644 --- a/modules/io/src/mol/mmcif_info.cc +++ b/modules/io/src/mol/mmcif_info.cc @@ -310,6 +310,24 @@ void MMCifInfo::SetEntityDesc(const String& entity_id, entity_desc_[entity_id] = entity_desc; } +std::vector<String> MMCifInfo::GetEntityIds() const { + std::vector<String> vec; + for(auto it: entity_desc_) { + vec.push_back(it.first); + } + return vec; +} + +std::vector<String> MMCifInfo::GetEntityIdsOfType(const String& entity_type) const { + std::vector<String> vec; + for(auto it: entity_desc_) { + if(it.second.entity_type == entity_type) { + vec.push_back(it.first); + } + } + return vec; +} + std::ostream& operator<<(std::ostream& os, const MMCifInfoEntityBranchLink& eb) { os << "<MMCifInfoEntityBranchLink atom1:" << eb.GetAtom1() << " atom2:" diff --git a/modules/io/src/mol/mmcif_info.hh b/modules/io/src/mol/mmcif_info.hh index d4ca56194b45869b49d85085c1d29447ceee23e6..438b906115670a8b97086b6af1d26710f474a450 100644 --- a/modules/io/src/mol/mmcif_info.hh +++ b/modules/io/src/mol/mmcif_info.hh @@ -1233,6 +1233,10 @@ public: void SetEntityDesc(const String& entity_id, const MMCifEntityDesc& entity_desc); + std::vector<String> GetEntityIds() const; + + std::vector<String> GetEntityIdsOfType(const String& type) const; + //protected: private: