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

Convenience functions to get entity ids in MMCifInfo object

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