class OEAtomMatchResidue : public OESystem::OEUnaryPredicate<OEChem::OEAtomBase>

This class represents OEAtomMatchResidue functor that identifies atoms (OEAtomBase) in residues (OEResidue) matching specific pieces, like residue name, residue number, insertion code, chain ID, and fragment number.

The following methods are publicly inherited from OEUnaryPredicate:

operator() CreateCopy CreatePredicateCopy

The following methods are publicly inherited from OEUnaryFunction:

operator() CreateCopy  


OEAtomMatchResidue(const OEAtomMatchResidueID& resId);
OEAtomMatchResidue(const std::string& resId);

Constructs the functor with the residue properties specified by an OEAtomMatchResidueID or a regex string.

OEAtomMatchResidue(OEChem::OEMolBase& molA, OEChem::OEMolBase& molB, double dist);

Constructs the functor to match the complete residues in molA that are within the specific distance dist in molB.


bool operator()(const OEAtomBase &atom) const

Returns true, if the residue of the atom (returned by the OEAtomGetResidue function) has equivalent residue properties (i.e. residue name, residue number, insertion code, chain ID, and fragment number) with which the functor is constructed.


OESystem::OEUnaryFunction<OEChem::OEAtomBase , bool> *CreateCopy() const

Deep copy constructor that returns a copy of the object. The memory for the returned OEAtomMatchResidue object is dynamically allocated and owned by the caller.

The returned copy should be deallocated using C++ delete operator in order to prevent a memory leak.


The examples below demonstrate how to create various predicates that allow to access atoms based on their residue information.

OEAtomMatchResidueID resAla;
OEAtomMatchResidue predAla(resAla);
cout << "Number of atoms matching residue name ALA = " << OECount(mol, predAla) << endl;

OEAtomMatchResidueID resChainA;
OEAtomMatchResidue predChainA(resChainA);
cout << "Number of atoms matching chain A = " << OECount(mol, predChainA) << endl;

OEAtomMatchResidueID resHis;
OEAtomMatchResidue predHis(resHis);
cout << "Number of atoms matching residue (HIS A 88) = " << OECount(mol, predHis) << endl;

// alternative way to initialize as regex
OEAtomMatchResidue predHis2("HIS:88:.*:A:.*");
cout << "Number of atoms matching residue (HIS A 88) = " << OECount(mol, predHis2) << endl;

OEIsBackboneAtom backbonepred;
cout << "Backbone atoms of residue (HIS A 88): ";
for(OEIter<OEAtomBase> atom = mol.GetAtoms(OEAnd<OEAtomBase>(predHis, backbonepred)); atom; ++atom)
  OEResidue res = OEAtomGetResidue(atom);
  cout << atom->GetName() << " ";
  cout << res.GetName() << " " << res.GetChainID() << " " << res.GetResidueNumber() << endl;