Loading...
Searching...
No Matches
OBResidue Class Reference

`#include <openbabel/residue.h>`

Inheritance diagram for OBResidue:
[legend]

## Public Member Functions

| OBResidue (void)
| OBResidue (const OBResidue &)
virtual | ~OBResidue (void)
OBResidue & | operator= (const OBResidue &)
void | AddAtom (OBAtom *atom)
void | InsertAtom (OBAtom *atom)
void | RemoveAtom (OBAtom *atom)
bool | Clear ()
void | SetName (const std::string &resname)
void | SetNum (const unsigned int resnum)
void | SetNum (const std::string resnum)
void | SetChain (const char chain)
void | SetChainNum (const unsigned int chainnum)
void | SetIdx (const unsigned int idx)
void | SetInsertionCode (const char insertioncode)
void | SetAtomID (OBAtom *atom, const std::string &id)
void | SetHetAtom (OBAtom *atom, bool hetatm)
void | SetSerialNum (OBAtom *atom, unsigned int sernum)
std::string | GetName (void) const
int | GetNum (void)
std::string | GetNumString (void)
unsigned int | GetNumAtoms () const
char | GetChain (void) const
unsigned int | GetChainNum (void) const
unsigned int | GetIdx (void) const
unsigned int | GetResKey (void) const
std::vector< OBAtom * > | GetAtoms (void) const
std::vector< OBBond * > | GetBonds (bool exterior=true) const
std::string | GetAtomID (OBAtom *atom) const
unsigned | GetSerialNum (OBAtom *atom) const
char | GetInsertionCode (void) const
bool | GetAminoAcidProperty (int) const
bool | GetAtomProperty (OBAtom *a, int) const
bool | GetResidueProperty (int) const
bool | IsHetAtom (OBAtom *atom) const
bool | IsResidueType (int) const
virtual OBBase * | DoTransformations (const std::map< std::string, std::string > *, OBConversion *)
template<class T>
T * | CastAndClear (bool clear=true)
virtual const char * | GetTitle (bool replaceNewlines=true) const
virtual void | SetTitle (const char *)

## Static Public Member Functions

static const char * | ClassDescription ()

## Iterator methods

unsigned int | _idx
char | _chain
unsigned int | _aakey
unsigned int | _reskey
std::string | _resnum
std::string | _resname
char | _insertioncode
std::vector< bool > | _hetatm
std::vector< std::string > | _atomid
std::vector< OBAtom * > | _atoms
std::vector< unsigned int > | _sernum
OBAtomIterator | BeginAtoms ()
OBAtomIterator | EndAtoms ()
OBAtom * | BeginAtom (std::vector< OBAtom * >::iterator &i)
OBAtom * | NextAtom (std::vector< OBAtom * >::iterator &i)

## Generic data handling methods (via OBGenericData)

std::vector< OBGenericData * > | _vdata
bool | HasData (const std::string &)
bool | HasData (const char *)
bool | HasData (const unsigned int type)
void | DeleteData (unsigned int type)
void | DeleteData (OBGenericData *)
void | DeleteData (std::vector< OBGenericData * > &)
bool | DeleteData (const std::string &s)
void | SetData (OBGenericData *d)
void | CloneData (OBGenericData *d)
size_t | DataSize () const
OBGenericData * | GetData (const unsigned int type)
OBGenericData * | GetData (const std::string &)
OBGenericData * | GetData (const char *)
std::vector< OBGenericData * > & | GetData ()
std::vector< OBGenericData * > | GetData (DataOrigin source)
std::vector< OBGenericData * > | GetAllData (const unsigned int type)
OBDataIterator | BeginData ()
OBDataIterator | EndData ()

## Detailed Description

Residue information.

The residue information is drawn from PDB or MOL2 files (or similar), which track biomolecule information, and are stored in the OBResidue class. OBResidues are stored inside the OBAtom class and OBMol classes. The residue information for an atom can be requested in the following way:

OBAtom *atom;
OBResidue *r;
atom = mol.GetAtom(1);
r = atom->GetResidue();
OpenBabel::OBAtom
Atom class.
Definition atom.h:72
OpenBabel::OBAtom::GetResidue
OBResidue * GetResidue()
Definition atom.cpp:446
OpenBabel::OBResidue::OBResidue
OBResidue(void)
Constructor.
Definition residue.cpp:821

The residue information for a molecule can be manipulated too:

cout << "This molecule has " << mol.NumResidues() << " residues." << endl;
OBResidue *r;
r = mol.GetResidue(1);

## Constructor & Destructor Documentation

## OBResidue() [1/2]

OBResidue | ( | void |  | ) |

Constructor.

Referenced by OBResidue(), and operator=().

## OBResidue() [2/2]

OBResidue | ( | const OBResidue & | src | ) |

Copy constructor.

## ~OBResidue()

~OBResidue | ( | void |  | ) |

virtual

Destructor.

## Member Function Documentation

## operator=()

OBResidue & operator= | ( | const OBResidue & | src | ) |

## AddAtom()

void AddAtom | ( | OBAtom * | atom | ) |

Add `atom` to this residue. Updates the atom via OBAtom::SetResidue().

Referenced by OBMol::AddNewHydrogens(), OBMol::CopySubstructure(), InsertAtom(), and OBMol::operator=().

## InsertAtom()

void InsertAtom | ( | OBAtom * | atom | ) |

Add `atom` to this residue. Updates the atom via OBAtom::SetResidue().

## RemoveAtom()

void RemoveAtom | ( | OBAtom * | atom | ) |

Remove `atom` from this residue and update the atom.

## Clear()

bool Clear | ( | void |  | ) |

virtual

Clear any and all data associated with this residue. Updates all atoms included in the residue, as well as calling OBBase::Clear() for any generic data.

Returns
  Whether the call was successful.

Reimplemented from OBBase.

## SetName()

void SetName | ( | const std::string & | resname | ) |

Set the name of this residue (e.g., "ALA"). Use 3-char PDB standard names. http://www.rcsb.org/pdb/file_formats/pdb/pdbguide2.2/part_79.html MODRES records for modified residues: http://www.rcsb.org/pdb/file_formats/pdb/pdbguide2.2/part_36.html.

## SetNum() [1/2]

void SetNum | ( | const unsigned int | resnum | ) |

Set the residue number (in the sequence).

## SetNum() [2/2]

void SetNum | ( | const std::string | resnum | ) |

## SetChain()

void SetChain | ( | const char | chain | ) |

Set the chain ID for this residue.

## SetChainNum()

void SetChainNum | ( | const unsigned int | chainnum | ) |

Set the chain number for this residue.

## SetIdx()

void SetIdx | ( | const unsigned int | idx | ) |

Set the internal index of this residue in the parent OBMol. Intended mostly for internal use

Referenced by OBMol::AddResidue(), and OBMol::NewResidue().

## SetInsertionCode()

void SetInsertionCode | ( | const char | insertioncode | ) |

Set PDB insertion code information for this residue. This allows consecutive residues to have the same number. Some communities that work in a well-conserved structural world use this, e.g. for immunoglobulins.

## SetAtomID()

void SetAtomID | ( | OBAtom * | atom,
|  | const std::string & | id )

Set the character code ID for an ATOM record for the supplied atom This does nothing if the supplied atom is not found in the residue

Referenced by OBMol::AddNewHydrogens(), OBMol::CopySubstructure(), and OBMol::operator=().

## SetHetAtom()

void SetHetAtom | ( | OBAtom * | atom,
|  | bool | hetatm )

Referenced by OBMol::AddNewHydrogens(), OBMol::CopySubstructure(), and OBMol::operator=().

## SetSerialNum()

void SetSerialNum | ( | OBAtom * | atom,
|  | unsigned int | sernum )

Set the atomic serial number for a given atom (see OBSerialNums).

Referenced by OBMol::CopySubstructure(), and OBMol::operator=().

## GetName()

string GetName | ( | void |  | ) | const

Returns
  The residue name

Referenced by OBResidueData::AssignBonds().

## GetNum()

int GetNum | ( | void |  | ) |

Returns
  The residue number (in the sequence)

## GetNumString()

std::string GetNumString | ( | void |  | ) |

Referenced by OBResidueData::AssignBonds().

## GetNumAtoms()

unsigned int GetNumAtoms | ( | void |  | ) | const

Returns
  The number of atoms in this residue

## GetChain()

char GetChain | ( | void |  | ) | const

Returns
  The ID of the chain which includes this residue

Referenced by OBResidueData::AssignBonds().

## GetChainNum()

unsigned int GetChainNum | ( | void |  | ) | const

Returns
  The number of the chain which includes this residue

## GetIdx()

unsigned int GetIdx | ( | void |  | ) | const

Returns
  The internal index of this residue in the parent OBMol

Referenced by OBMol::DeleteResidue().

## GetResKey()

unsigned int GetResKey | ( | void |  | ) | const

Returns
  The residue key (i.e., an entry in the OBResidueIndex namespace)

## GetAtoms()

vector< OBAtom * > GetAtoms | ( | void |  | ) | const

Returns
  a vector of all atoms in this residue

## GetBonds()

vector< OBBond * > GetBonds | ( | bool | exterior = true | ) | const

Returns
  all bonds in this residue. `exterior` includes bonds to atoms outside this residue (default is true)

## GetAtomID()

string GetAtomID | ( | OBAtom * | atom | ) | const

Returns
  the atom ID (character code) for the supplied atom or "" if the atom is not found in this residue

Referenced by OBResidueData::AssignBonds(), OBMol::CopySubstructure(), GetAtomProperty(), and OBMol::operator=().

## GetSerialNum()

unsigned int GetSerialNum | ( | OBAtom * | atom | ) | const

Returns
  the serial number of the supplied atom (uses OBSerialNums)

Referenced by OBMol::CopySubstructure(), and OBMol::operator=().

## GetInsertionCode()

char GetInsertionCode | ( | void |  | ) | const

Returns
  The Insertion Code (i.e., an extra position motivated by a multiple sequence alignment against a template with defined numbers)

## GetAminoAcidProperty()

bool GetAminoAcidProperty | ( | int | property | ) | const

Returns
  Whether this residue has the supplied amino acid property defined from the OBAminoAcidProperty namespace

## GetAtomProperty()

bool GetAtomProperty | ( | OBAtom * | a,
|  | int | property ) const

Returns
  Whether atom `a` has the supplied residue atom property defined from the OBResidueAtomProperty namespace

## GetResidueProperty()

bool GetResidueProperty | ( | int | property | ) | const

Returns
  Whether this residue has the supplied property defined from the OBResidueProperty namespace

Referenced by GetAtomProperty().

## IsHetAtom()

bool IsHetAtom | ( | OBAtom * | atom | ) | const

Returns
  If the given atom is a HETATM record

Referenced by OBMol::AddNewHydrogens(), OBMol::CopySubstructure(), GetAtomProperty(), and OBMol::operator=().

## IsResidueType()

bool IsResidueType | ( | int | restype | ) | const

Returns
  If this residue matches the supplied `restype` Set by SetResidueKeys()

## BeginAtoms()

OBAtomIterator BeginAtoms | ( |  | ) |

inline

Returns
  An iterator to the beginning of the atom list in this residue

## EndAtoms()

OBAtomIterator EndAtoms | ( |  | ) |

inline

Returns
  An iterator to the end of the atom list in this residue

## BeginAtom()

OBAtom * BeginAtom | ( | std::vector< OBAtom * >::iterator & | i | ) |

Set the iterator `i` to the beginning of the atom list in this residue

Returns
  The first atom (or NULL if none exist)

Referenced by OBMol::operator=().

## NextAtom()

OBAtom * NextAtom | ( | std::vector< OBAtom * >::iterator & | i | ) |

Increment the iterator `i`

Returns
  The next atom (or NULL if none exist)

Referenced by OBMol::operator=().

## DoTransformations()

virtual OBBase * DoTransformations | ( | const std::map< std::string, std::string > * | ,
|  | OBConversion * | )

inline virtual inherited

Perform a set of transformations specified by the user

Typically these are program options to filter or modify an object For example, see OBMol::DoTransformations() and OBMol::ClassDescription() Base type does nothing

Reimplemented in OBMol.

## ClassDescription()

const char * ClassDescription | ( |  | ) |

inline static inherited

Returns
  A list of descriptions of command-line options for DoTransformations()

## CastAndClear()

template<class T>

T * CastAndClear | ( | bool | clear = true | ) |

inline inherited

By default clears the object. Called from ReadMolecule of most format classes.

## GetTitle()

virtual const char * GetTitle | ( | bool | replaceNewlines = true | ) | const

inline virtual inherited

Base type does nothing Made virtual around r3535 to simplify code which passes around OBBase*.

Reimplemented in OBMol.

Referenced by OBMoleculeFormat::DoOutputOptions().

## SetTitle()

virtual void SetTitle | ( | const char * |  | ) |

inline virtual inherited

Reimplemented in OBMol.

Referenced by OBMoleculeFormat::DoOutputOptions().

## HasData() [1/3]

bool HasData | ( | const std::string & | s | ) |

inherited

Returns
  whether the generic attribute/value pair exists

Referenced by OBMol::AddAtom(), OBDepict::DrawMolecule(), OBMol::FindAngles(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBMol::FindTorsions(), OBForceField::GetAtomTypes(), OBForceField::GetConformers(), OBForceField::GetCoordinates(), OBMol::GetEnergies(), OBMol::GetEnergy(), OBMol::GetLSSR(), OBForceField::GetPartialCharges(), OBMol::GetSSSR(), HasData(), OBDescriptor::MatchPairData(), OBMol::NewAtom(), OBMoleculeFormat::ReadChemObjectImpl(), and OBMol::SetEnergies().

## HasData() [2/3]

bool HasData | ( | const char * | s | ) |

inherited

Returns
  whether the generic attribute/value pair exists

## HasData() [3/3]

bool HasData | ( | const unsigned int | type | ) |

inherited

Returns
  whether the generic attribute/value pair exists, for a given OBGenericDataType

## DeleteData() [1/4]

void DeleteData | ( | unsigned int | type | ) |

inherited

Delete any data matching the given OBGenericDataType.

Referenced by OBMol::AddAtom(), OBMol::BeginModify(), OpenBabel::CanonicalLabels(), OBDescriptor::DeleteProperties(), OpenBabel::DeleteStereoOnAtom(), OBMol::EndModify(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBMol::NewAtom(), and OBMol::RenumberAtoms().

## DeleteData() [2/4]

void DeleteData | ( | OBGenericData * | gd | ) |

inherited

Delete the given generic data from this object.

## DeleteData() [3/4]

void DeleteData | ( | std::vector< OBGenericData * > & | vg | ) |

inherited

Delete all of the given generic data from this object.

## DeleteData() [4/4]

bool DeleteData | ( | const std::string & | s | ) |

inherited

Deletes the generic data with the specified attribute, returning false if not found.

## SetData()

void SetData | ( | OBGenericData * | d | ) |

inline inherited

Adds a data object; does nothing if d==NULL.

Referenced by OBMol::AddBond(), OBGastChrg::AssignPartialCharges(), OBMol::CopySubstructure(), OBMol::DoTransformations(), OBAtom::Duplicate(), AliasData::Expand(), OBMol::FindAngles(), OBMol::FindLSSR(), OBMol::FindSSSR(), OBMol::FindTorsions(), OBForceField::GetAtomTypes(), OBForceField::GetConformers(), OBForceField::GetCoordinates(), OBMol::GetEnergies(), OBMol::GetEnergy(), OBMol::GetFormula(), OBMol::GetLSSR(), OBForceField::GetPartialCharges(), OBMol::GetSSSR(), OBMoleculeFormat::MakeCombinedMolecule(), OBMol::operator+=(), OBMol::operator=(), OBDescriptor::PredictAndSave(), OBMol::SetEnergies(), and OBMol::SetFormula().

## CloneData()

void CloneData | ( | OBGenericData * | d | ) |

inherited

Adds a copy of a data object; does nothing if d == NULL

Since
  version 2.2

Referenced by OBMol::AddBond().

## DataSize()

size_t DataSize | ( |  | ) | const

inline inherited

Returns
  the number of OBGenericData items attached to this molecule.

## GetData() [1/5]

OBGenericData * GetData | ( | const unsigned int | type | ) |

inherited

Returns
  the first matching data for a given type from OBGenericDataType or NULL if nothing matches

Referenced by OBDepict::DrawMolecule(), OpenBabel::extract_thermochemistry(), OBDescriptor::FilterCompare(), OBAtom::GetAngle(), OBForceField::GetAtomTypes(), OBForceField::GetConformers(), OBForceField::GetCoordinates(), OBAtom::GetDistance(), OBBond::GetLength(), OBForceField::GetPartialCharges(), OBDescriptor::GetValues(), OpenBabel::IsSuppressibleHydrogen(), OBMoleculeFormat::MakeCombinedMolecule(), OBMolAngleIter::OBMolAngleIter(), OBMolAngleIter::OBMolAngleIter(), OBMolTorsionIter::OBMolTorsionIter(), OBMolTorsionIter::OBMolTorsionIter(), and OBDescriptor::PredictAndSave().

## GetData() [2/5]

OBGenericData * GetData | ( | const std::string & | s | ) |

inherited

Returns
  any data matching the given attribute name or NULL if nothing matches
  the value given an attribute name

## GetData() [3/5]

OBGenericData * GetData | ( | const char * | s | ) |

inherited

Returns
  any data matching the given attribute name or NULL if nothing matches
  the value given an attribute name

## GetData() [4/5]

std::vector< OBGenericData * > & GetData | ( |  | ) |

inline inherited

Returns
  all data, suitable for iterating

Referenced by OBMol::BeginModify(), OBMol::ConnectTheDots(), OBMol::CopySubstructure(), OBMol::DoTransformations(), OBMol::GetEnergies(), OBMol::GetEnergy(), OBMol::GetFormula(), OBMol::GetLSSR(), OBMol::GetSSSR(), OBMol::GetTorsion(), OBMol::SetEnergies(), and OBMol::SetFormula().

## GetData() [5/5]

std::vector< OBGenericData * > GetData | ( | DataOrigin | source | ) |

inherited

Returns
  all data with a specific origin, suitable for iterating

## GetAllData()

std::vector< OBGenericData * > GetAllData | ( | const unsigned int | type | ) |

inherited

Returns
  the all matching data for a given type from OBGenericDataType or an empty vector if nothing matches

Since
  version 2.2

Referenced by OpenBabel::CanonicalLabels(), OBMol::CopySubstructure(), OBBuilder::CorrectStereoAtoms(), OBBuilder::CorrectStereoBonds(), OpenBabel::DeleteStereoOnAtom(), and OBMol::operator+=().

## BeginData()

OBDataIterator BeginData | ( |  | ) |

inline inherited

Returns
  An iterator pointing to the beginning of the data

Referenced by OBMol::AddAtom(), OBMol::AddBond(), OBAtom::Duplicate(), OBMoleculeFormat::MakeCombinedMolecule(), OBMol::NewAtom(), and OBMol::operator=().

## EndData()

OBDataIterator EndData | ( |  | ) |

inline inherited

Returns
  An iterator pointing to the end of the data

Referenced by OBMol::AddAtom(), OBMol::AddBond(), OBAtom::Duplicate(), OBMoleculeFormat::MakeCombinedMolecule(), OBMol::NewAtom(), and OBMol::operator=().

## Member Data Documentation

## _idx

unsigned int _idx

protected

Residue index (i.e., internal index in an OBMol).

Referenced by Clear(), GetIdx(), OBResidue(), and SetIdx().

## _chain

char _chain

protected

Chain ID.

Referenced by Clear(), GetChain(), GetChainNum(), OBResidue(), OBResidue(), operator=(), SetChain(), and SetChainNum().

## _aakey

unsigned int _aakey

protected

Amino Acid key ID – see SetResidueKeys().

Referenced by Clear(), GetAminoAcidProperty(), OBResidue(), OBResidue(), operator=(), and SetName().

## _reskey

unsigned int _reskey

protected

Residue key ID – see SetResidueKeys().

Referenced by Clear(), GetResidueProperty(), GetResKey(), IsResidueType(), OBResidue(), OBResidue(), operator=(), and SetName().

## _resnum

std::string _resnum

protected

Residue number (i.e., in file) 23, 1B, etc.

Referenced by Clear(), GetNum(), GetNumString(), OBResidue(), OBResidue(), operator=(), SetNum(), and SetNum().

## _resname

std::string _resname

protected

Residue text name.

Referenced by Clear(), GetName(), OBResidue(), OBResidue(), operator=(), and SetName().

## _insertioncode

char _insertioncode

protected

PBB insertion code.

Referenced by Clear(), GetInsertionCode(), OBResidue(), OBResidue(), operator=(), and SetInsertionCode().

## _hetatm

std::vector<bool> _hetatm

protected

Is a given atom a HETAM.

Referenced by AddAtom(), Clear(), IsHetAtom(), OBResidue(), operator=(), RemoveAtom(), and SetHetAtom().

## _atomid

std::vector<std::string> _atomid

protected

Residue atom text IDs.

Referenced by AddAtom(), Clear(), GetAtomID(), OBResidue(), operator=(), RemoveAtom(), and SetAtomID().

## _atoms

std::vector<OBAtom*> _atoms

protected

List of OBAtom in this residue.

Referenced by AddAtom(), BeginAtom(), BeginAtoms(), Clear(), EndAtoms(), GetAtomID(), GetAtoms(), GetBonds(), GetNumAtoms(), GetSerialNum(), IsHetAtom(), NextAtom(), RemoveAtom(), SetAtomID(), SetHetAtom(), SetSerialNum(), and ~OBResidue().

## _sernum

std::vector<unsigned int> _sernum

protected

List of serial numbers.

Referenced by AddAtom(), Clear(), GetSerialNum(), OBResidue(), operator=(), RemoveAtom(), and SetSerialNum().

## _vdata

std::vector<OBGenericData*> _vdata

protected inherited

Custom data.

Referenced by BeginData(), Clear(), CloneData(), DataSize(), DeleteData(), DeleteData(), DeleteData(), DeleteData(), OBAtom::Duplicate(), EndData(), GetAllData(), GetData(), GetData(), GetData(), GetData(), GetData(), HasData(), HasData(), OBBond::OBBond(), OBMol::OBMol(), OBMol::OBMol(), OBResidue::OBResidue(), SetData(), and ~OBBase().

The documentation for this class was generated from the following files:

- residue.h
- residue.cpp