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

Calculation of canonical atom numberings for molecular graphs using McKay's algorithm for practical graph isomorphism. More...

+ Inheritance diagram for CDPL.Chem.CanonicalNumberingCalculator:

Public Member Functions

None __init__ ()
 Constructs the CanonicalNumberingCalculator instance.
 
None __init__ (MolecularGraph molgraph, Util.STArray numbering)
 Constructs the CanonicalNumberingCalculator instance and performs a canonical numbering of the atoms in the molecular graph molgraph. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
None setAtomPropertyFlags (int flags)
 Allows to specify the set of atomic properties that has to be considered by the canonical numering algorithm. More...
 
int getAtomPropertyFlags ()
 Returns the set of atomic properties that gets considered by the canonical numbering algorithm. More...
 
None setBondPropertyFlags (int flags)
 Allows to specify the set of bond properties that has to be considered by the canonical numering algorithm. More...
 
int getBondPropertyFlags ()
 Returns the set of bond properties that gets considered by the canonical numbering algorithm. More...
 
None setHydrogenCountFunction (SizeTypeAtomMolecularGraphFunctor func)
 Specifies a function for the retrieval of the hydrogen count of an atom. More...
 
SizeTypeAtomMolecularGraphFunctor getHydrogenCountFunction ()
 Returns the function used for the retrieval of the hydrogen count of an atom. More...
 
None calculate (MolecularGraph molgraph, Util.STArray numbering)
 Performs a canonical numbering of the atoms in the molecular graph molgraph. More...
 

Static Public Attributes

int DEF_ATOM_PROPERTY_FLAGS = 414
 Specifies the default set of atomic properties considered by the canonical numbering algorithm.
 
int DEF_BOND_PROPERTY_FLAGS = 26
 Specifies the default set of bond properties considered by the canonical numbering algorithm.
 

Properties

 objectID = property(getObjectID)
 
 atomPropertyFlags = property(getAtomPropertyFlags, setAtomPropertyFlags)
 
 bondPropertyFlags = property(getBondPropertyFlags, setBondPropertyFlags)
 
 hydrogenCountFunc = property(getHydrogenCountFunction, setHydrogenCountFunction)
 

Detailed Description

Calculation of canonical atom numberings for molecular graphs using McKay's algorithm for practical graph isomorphism.

The set of atom and bond properties used to break ties during numbering can be configured via setAtomPropertyFlags() and setBondPropertyFlags(); a custom hydrogen-count function used for label generation can be installed via setHydrogenCountFunction().

See also
[MCKAY]

Constructor & Destructor Documentation

◆ __init__()

None CDPL.Chem.CanonicalNumberingCalculator.__init__ ( MolecularGraph  molgraph,
Util.STArray  numbering 
)

Constructs the CanonicalNumberingCalculator instance and performs a canonical numbering of the atoms in the molecular graph molgraph.

Parameters
molgraphThe molecular graph for which to perform the canonical numbering.
numberingAn array that contains the calculated canonical atom labels. The labels are stored in the same order as the atoms appear in the atom list of the molecular graph (i.e. the canonical number of an atom is accessible via its index).

Member Function Documentation

◆ getObjectID()

int CDPL.Chem.CanonicalNumberingCalculator.getObjectID ( )

Returns the numeric identifier (ID) of the wrapped C++ class instance.

Different Python CanonicalNumberingCalculator instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b thus cannot tell reliably whether the two CanonicalNumberingCalculator instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID().

Returns
The numeric ID of the internally referenced C++ class instance.

◆ setAtomPropertyFlags()

None CDPL.Chem.CanonicalNumberingCalculator.setAtomPropertyFlags ( int  flags)

Allows to specify the set of atomic properties that has to be considered by the canonical numering algorithm.

The flags argument is an OR combination of the constants defined in namespace Chem.AtomPropertyFlag. Supported property flags are:

Parameters
flagsThe set of atomic properties to consider.
Note
The default set of atomic properties is specified by CanonicalNumberingCalculator.DEF_ATOM_PROPERTY_FLAGS.

◆ getAtomPropertyFlags()

int CDPL.Chem.CanonicalNumberingCalculator.getAtomPropertyFlags ( )

Returns the set of atomic properties that gets considered by the canonical numbering algorithm.

Returns
The set of considered atomic properties.
See also
setAtomPropertyFlags()

◆ setBondPropertyFlags()

None CDPL.Chem.CanonicalNumberingCalculator.setBondPropertyFlags ( int  flags)

Allows to specify the set of bond properties that has to be considered by the canonical numering algorithm.

The flags argument is an OR combination of the constants defined in namespace Chem.BondPropertyFlag. Supported property flags are:

Parameters
flagsThe set of bond properties to consider.
Note
The default set of bond properties is specified by CanonicalNumberingCalculator.DEF_BOND_PROPERTY_FLAGS.

◆ getBondPropertyFlags()

int CDPL.Chem.CanonicalNumberingCalculator.getBondPropertyFlags ( )

Returns the set of bond properties that gets considered by the canonical numbering algorithm.

Returns
The set of considered bond properties.
See also
setBondPropertyFlags()

◆ setHydrogenCountFunction()

None CDPL.Chem.CanonicalNumberingCalculator.setHydrogenCountFunction ( SizeTypeAtomMolecularGraphFunctor  func)

Specifies a function for the retrieval of the hydrogen count of an atom.

Parameters
funcThe hydrogen count function.

◆ getHydrogenCountFunction()

SizeTypeAtomMolecularGraphFunctor CDPL.Chem.CanonicalNumberingCalculator.getHydrogenCountFunction ( )

Returns the function used for the retrieval of the hydrogen count of an atom.

Returns
The currently configured hydrogen count function.

◆ calculate()

None CDPL.Chem.CanonicalNumberingCalculator.calculate ( MolecularGraph  molgraph,
Util.STArray  numbering 
)

Performs a canonical numbering of the atoms in the molecular graph molgraph.

Parameters
molgraphThe molecular graph for which to perform the canonical numbering.
numberingAn array that contains the calculated canonical atom labels. The labels are stored in the same order as the atoms appear in the atom list of the molecular graph (i.e. the canonical number of an atom is accessible via its index).