Commit eb80490b by Maarten L. Hekkelman

getPolymerByAsymID

parent ba2b06f5
...@@ -600,7 +600,11 @@ class Structure ...@@ -600,7 +600,11 @@ class Structure
std::list<Polymer> &polymers() { return mPolymers; } std::list<Polymer> &polymers() { return mPolymers; }
Polymer &getPolymerByAsymID(const std::string &asymID); Polymer &getPolymerByAsymID(const std::string &asymID);
const Polymer &getPolymerByAsymID(const std::string &asymID) const;
const Polymer &getPolymerByAsymID(const std::string &asymID) const
{
return const_cast<Structure*>(this)->getPolymerByAsymID(asymID);
}
const std::list<Branch> &branches() const { return mBranches; } const std::list<Branch> &branches() const { return mBranches; }
std::list<Branch> &branches() { return mBranches; } std::list<Branch> &branches() { return mBranches; }
......
...@@ -1594,6 +1594,19 @@ Atom Structure::getAtomByPositionAndType(Point p, std::string_view type, std::st ...@@ -1594,6 +1594,19 @@ Atom Structure::getAtomByPositionAndType(Point p, std::string_view type, std::st
return {}; return {};
} }
Polymer &Structure::getPolymerByAsymID(const std::string &asymID)
{
for (auto &poly : mPolymers)
{
if (poly.asymID() != asymID)
continue;
return poly;
}
throw std::runtime_error("Polymer with asym id " + asymID + " not found");
}
Residue &Structure::getResidue(const std::string &asymID) Residue &Structure::getResidue(const std::string &asymID)
{ {
for (auto &res : mNonPolymers) for (auto &res : mNonPolymers)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment