Chemical Data Processing Library Python API - Version 1.4.0
Classes | Public Member Functions | Properties | List of all members
CDPL.Chem.MolecularGraph Class Reference

Abstract base class for data structures that represent chemical structures as molecular graphs. More...

+ Inheritance diagram for CDPL.Chem.MolecularGraph:

Classes

class  AtomSequence
 
class  BondSequence
 

Public Member Functions

None __init__ ()
 Contructs the MolecularGraph instance.
 
AtomSequence getAtoms ()
 
BondSequence getBonds ()
 
MolecularGraph clone ()
 Creates a deep copy of the molecular graph. More...
 
Atom getAtom (int idx)
 Returns the atom at index idx. More...
 
bool containsAtom (Atom atom)
 Tells whether the specified atom is part of the atom sequence. More...
 
int getAtomIndex (Atom atom)
 Returns the index of the specified atom. More...
 
int getNumAtoms ()
 Returns the number of atoms. More...
 
None orderAtoms (BoolAtom2Functor func)
 Orders the atoms according to criteria implemented by the provided atom comparison function. More...
 
Entity3D getEntity (int idx)
 Returns the entity at index idx. More...
 
int getNumEntities ()
 Returns the number of stored Chem.Entity3D instances. More...
 
Bond getBond (int idx)
 Returns the bond at index idx. More...
 
bool containsBond (Bond bond)
 Tells whether the specified bond is part of the bond sequence. More...
 
None orderBonds (BoolBond2Functor func)
 Orders the bonds according to criteria implemented by the provided bond comparison function. More...
 
int getBondIndex (Bond bond)
 Returns the index of the specified bond. More...
 
int getNumBonds ()
 Returns the number of bonds. More...
 
Base.Any __getitem__ (Base.LookupKey key)
 
bool __contains__ (Base.LookupKey key)
 Returns the result of the membership test operation key in self. More...
 
bool __contains__ (Bond bond)
 Returns the result of the membership test operation bond in self. More...
 
bool __contains__ (Atom atom)
 Returns the result of the membership test operation atom in self. More...
 
None __setitem__ (Base.LookupKey key, Base.Any val)
 
bool __delitem__ (Base.LookupKey key)
 
int __len__ ()
 Returns the number of property entries. More...
 
- Public Member Functions inherited from CDPL.Chem.AtomContainer
Atom __getitem__ (int idx)
 
- Public Member Functions inherited from CDPL.Chem.Entity3DContainer
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
- Public Member Functions inherited from CDPL.Chem.BondContainer
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
Bond __getitem__ (int idx)
 
- Public Member Functions inherited from CDPL.Base.PropertyContainer
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
int getNumProperties ()
 Returns the number of property entries. More...
 
Any getPropertyOrDefault (LookupKey key, Any def_val)
 Returns the value of the property specified by key , or the default value def_val if an entry does not exist. More...
 
list getPropertyKeys ()
 Returns a list containing the keys of the current property entries. More...
 
list getPropertyValues ()
 Returns a list containing the values of the current property entries. More...
 
list getProperties ()
 Returns a reference to itself. More...
 
None setProperty (LookupKey key, Any val)
 Sets the value of the property specified by key to val. More...
 
bool removeProperty (LookupKey key)
 Removes the entry for the property specified by key. More...
 
Any getProperty (LookupKey key, bool throw_=False)
 Returns the value of the property specified by key. More...
 
bool isPropertySet (LookupKey key)
 Tells whether or not a value has been assigned to the property specified by key. More...
 
None clearProperties ()
 Erases all container entries.
 
None addProperties (PropertyContainer cntnr)
 Adds the property entries of the PropertyContainer instance cntnr. More...
 
None copyProperties (PropertyContainer cntnr)
 Replaces the current property entries by a copy of the entries in cntnr. More...
 
None swap (PropertyContainer cntnr)
 Exchanges the property entries of this container with the ones of cntnr. More...
 
Any __getitem__ (LookupKey key)
 Returns the value of the property specified by key. More...
 
bool __contains__ (LookupKey key)
 Tells whether or not a value has been assigned to the property specified by key. More...
 
None __setitem__ (LookupKey key, Any val)
 Sets the value of the property specified by key to val. More...
 
bool __delitem__ (LookupKey key)
 Removes the entry for the property specified by key. More...
 

Properties

 atoms = property(getAtoms)
 
 bonds = property(getBonds)
 
- Properties inherited from CDPL.Chem.AtomContainer
 numAtoms = property(getNumAtoms)
 
- Properties inherited from CDPL.Chem.Entity3DContainer
 objectID = property(getObjectID)
 
 numEntities = property(getNumEntities)
 
- Properties inherited from CDPL.Chem.BondContainer
 objectID = property(getObjectID)
 
 numBonds = property(getNumBonds)
 
- Properties inherited from CDPL.Base.PropertyContainer
 objectID = property(getObjectID)
 
 propertyKeys = property(getPropertyKeys)
 
 propertyValues = property(getPropertyValues)
 
 properties = property(getProperties)
 
 numProperties = property(getNumProperties)
 

Detailed Description

Abstract base class for data structures that represent chemical structures as molecular graphs.

Vertices (= atoms) of the molecular graph are represented by Chem.Atom instances and edges (= bonds) by Chem.Bond instances. Read-only access to the Chem.Atom and Chem.Bond instances is enabled by corresponding methods inherited from Chem.AtomContainer and Chem.BondContainer, respectively. Molecular graph properties can be stored/retrieved via methods provided by the Base.PropertyContainer base class. Deep copies of the molecular graph are created by the pure virtual clone() method which needs to be implemented by concrete subclasses (e.g. Chem.BasicMolecule, Chem.Fragment) of MolecularGraph.

Member Function Documentation

◆ clone()

MolecularGraph CDPL.Chem.MolecularGraph.clone ( )

Creates a deep copy of the molecular graph.

Returns
A smart reference to the copy of the molecular graph.

◆ getAtom()

Atom CDPL.Chem.MolecularGraph.getAtom ( int  idx)

Returns the atom at index idx.

Parameters
idxThe zero-based index of the atom to return.
Returns
The atom at the specified index.
Exceptions
Base.IndexErrorif idx is not in the range [0, getNumAtoms()).

Reimplemented from CDPL.Chem.AtomContainer.

Reimplemented in CDPL.Chem.Molecule.

◆ containsAtom()

bool CDPL.Chem.MolecularGraph.containsAtom ( Atom  atom)

Tells whether the specified atom is part of the atom sequence.

Parameters
atomThe atom to look for.
Returns
True if atom is part of the sequence, and False otherwise.

Reimplemented from CDPL.Chem.AtomContainer.

Reimplemented in CDPL.Chem.Molecule.

◆ getAtomIndex()

int CDPL.Chem.MolecularGraph.getAtomIndex ( Atom  atom)

Returns the index of the specified atom.

Parameters
atomThe atom for which to return the index.
Returns
The zero-based index of the specified atom.
Exceptions
Base.ItemNotFoundif the specified atom could not be found.

Reimplemented from CDPL.Chem.AtomContainer.

Reimplemented in CDPL.Chem.Molecule.

◆ getNumAtoms()

int CDPL.Chem.MolecularGraph.getNumAtoms ( )

Returns the number of atoms.

Returns
The number of atoms.

Reimplemented from CDPL.Chem.AtomContainer.

Reimplemented in CDPL.Chem.Molecule.

◆ orderAtoms()

None CDPL.Chem.MolecularGraph.orderAtoms ( BoolAtom2Functor  func)

Orders the atoms according to criteria implemented by the provided atom comparison function.

Parameters
funcThe atom comparison function implementing the applied ordering criteria.

Reimplemented from CDPL.Chem.AtomContainer.

Reimplemented in CDPL.Chem.Molecule.

◆ getEntity()

Entity3D CDPL.Chem.MolecularGraph.getEntity ( int  idx)

Returns the entity at index idx.

Forwards to getAtom() and exists to satisfy the Chem.Entity3DContainer interface.

Parameters
idxThe zero-based entity index.
Returns
The entity at the specified index.
Exceptions
Base.IndexErrorif idx is not in the range [0, getNumAtoms()).

Reimplemented from CDPL.Chem.AtomContainer.

Reimplemented in CDPL.Chem.Molecule.

◆ getNumEntities()

int CDPL.Chem.MolecularGraph.getNumEntities ( )

Returns the number of stored Chem.Entity3D instances.

Forwards to getNumAtoms() and exists to satisfy the Chem.Entity3DContainer interface.

Returns
The number of contained atoms.

Reimplemented from CDPL.Chem.AtomContainer.

Reimplemented in CDPL.Chem.Molecule.

◆ getBond()

Bond CDPL.Chem.MolecularGraph.getBond ( int  idx)

Returns the bond at index idx.

Parameters
idxThe zero-based index of the bond to return.
Returns
The bond at the specified index.
Exceptions
Base.IndexErrorif idx is not in the range [0, getNumBonds()).

Reimplemented from CDPL.Chem.BondContainer.

Reimplemented in CDPL.Chem.Molecule.

◆ containsBond()

bool CDPL.Chem.MolecularGraph.containsBond ( Bond  bond)

Tells whether the specified bond is part of the bond sequence.

Parameters
bondThe bond to look for.
Returns
True if bond is part of the sequence, and False otherwise.

Reimplemented from CDPL.Chem.BondContainer.

Reimplemented in CDPL.Chem.Molecule.

◆ orderBonds()

None CDPL.Chem.MolecularGraph.orderBonds ( BoolBond2Functor  func)

Orders the bonds according to criteria implemented by the provided bond comparison function.

Parameters
funcThe bond comparison function implementing the applied ordering criteria.

Reimplemented from CDPL.Chem.BondContainer.

Reimplemented in CDPL.Chem.Molecule.

◆ getBondIndex()

int CDPL.Chem.MolecularGraph.getBondIndex ( Bond  bond)

Returns the index of the specified bond.

Parameters
bondThe bond for which to return the index.
Returns
The zero-based index of the specified bond.
Exceptions
Base.ItemNotFoundif the specified bond could not be found.

Reimplemented from CDPL.Chem.BondContainer.

Reimplemented in CDPL.Chem.Molecule.

◆ getNumBonds()

int CDPL.Chem.MolecularGraph.getNumBonds ( )

Returns the number of bonds.

Returns
The number of bonds.

Reimplemented from CDPL.Chem.BondContainer.

Reimplemented in CDPL.Chem.Molecule.

◆ __contains__() [1/3]

bool CDPL.Chem.MolecularGraph.__contains__ ( Base.LookupKey  key)

Returns the result of the membership test operation key in self.

Parameters
keyThe value to test for membership.
Returns
The result of the membership test operation.

Reimplemented in CDPL.Chem.Molecule, and CDPL.Chem.Fragment.

◆ __contains__() [2/3]

bool CDPL.Chem.MolecularGraph.__contains__ ( Bond  bond)

Returns the result of the membership test operation bond in self.

Parameters
bondThe value to test for membership.
Returns
The result of the membership test operation.

Reimplemented from CDPL.Chem.BondContainer.

Reimplemented in CDPL.Chem.Molecule, and CDPL.Chem.Fragment.

◆ __contains__() [3/3]

bool CDPL.Chem.MolecularGraph.__contains__ ( Atom  atom)

Returns the result of the membership test operation atom in self.

Parameters
atomThe value to test for membership.
Returns
The result of the membership test operation.

Reimplemented from CDPL.Chem.AtomContainer.

Reimplemented in CDPL.Chem.Molecule, and CDPL.Chem.Fragment.

◆ __len__()

int CDPL.Chem.MolecularGraph.__len__ ( )

Returns the number of property entries.

Returns
The number of property entries.

Reimplemented from CDPL.Base.PropertyContainer.

Reimplemented in CDPL.Chem.Molecule, CDPL.Chem.Fragment, CDPL.Biomol.HierarchyViewModel, and CDPL.Biomol.HierarchyViewChain.