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

Enumerates the tautomers of a molecular graph by iteratively applying a configurable set of Chem.TautomerizationRule instances and reporting each accepted tautomer to a user-supplied callback. More...

+ Inheritance diagram for CDPL.Chem.TautomerGenerator:

Classes

class  Mode
 Constants specifying the output tautomer filtering strategy. More...
 

Public Member Functions

None __init__ ()
 Constructs the TautomerGenerator instance.
 
None __init__ (TautomerGenerator gen)
 Constructs a copy of the TautomerGenerator instance gen. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
None addTautomerizationRule (TautomerizationRule rule)
 Registers a new tautomerization rule. More...
 
None removeTautomerizationRule (int idx)
 Removes the registered tautomerization rule at index idx. More...
 
TautomerizationRule getTautomerizationRule (int idx)
 Returns the registered tautomerization rule at index idx. More...
 
int getNumTautomerizationRules ()
 Returns the number of registered tautomerization rules. More...
 
None setCallbackFunction (BoolMolecularGraphFunctor func)
 Sets the callback invoked for every accepted output tautomer. More...
 
BoolMolecularGraphFunctor getCallbackFunction ()
 Returns the currently configured callback. More...
 
None setMode (Mode mode)
 Sets the tautomer duplicate filtering mode. More...
 
Mode getMode ()
 Returns the currently configured tautomer duplicate filtering mode. More...
 
None regardStereochemistry (bool regard)
 Specifies whether atom/bond stereochemistry shall be regarded by the tautomer duplicate detection algorithm. More...
 
bool stereochemistryRegarded ()
 Tells whether atom/bond stereochemistry is regarded by the tautomer duplicate detection algorithm. More...
 
None regardIsotopes (bool regard)
 Specifies whether atom isotope information shall be regarded by the tautomer duplicate detection algorithm. More...
 
bool isotopesRegarded ()
 Tells whether atom isotope information is regarded by the tautomer duplicate detection algorithm. More...
 
bool coordinates2DCleared ()
 Tells whether 2D atom coordinates are cleared from the generated tautomers. More...
 
bool coordinates3DCleared ()
 Tells whether 3D atom coordinates are cleared from the generated tautomers. More...
 
None removeResonanceDuplicates (bool remove)
 Specifies whether tautomers that differ only by resonance (no atom-connectivity change) shall be filtered out. More...
 
bool resonanceDuplicatesRemoved ()
 Tells whether resonance-only duplicates are filtered out. More...
 
None setCustomSetupFunction (VoidMolecularGraphFunctor func)
 Sets the optional setup function invoked on the generated tautomers. More...
 
None generate (MolecularGraph molgraph)
 Enumerates the tautomers of molgraph and reports each accepted one to the registered callback. More...
 
TautomerGenerator assign (TautomerGenerator gen)
 Replaces the state of this generator by a copy of the state of gen. More...
 

Properties

 objectID = property(getObjectID)
 
 clearCoordinates2D = property(coordinates2DCleared, clearCoordinates2D)
 
 clearCoordinates3D = property(coordinates3DCleared, clearCoordinates3D)
 
 callbackFunction = property(getCallbackFunction, setCallbackFunction)
 
 mode = property(getMode, setMode)
 
 regStereo = property(stereochemistryRegarded, regardStereochemistry)
 
 regIsotopes = property(isotopesRegarded, regardIsotopes)
 
 remResonanceDuplicates = property(resonanceDuplicatesRemoved, removeResonanceDuplicates)
 
 numTautomerizationRules = property(getNumTautomerizationRules)
 

Detailed Description

Enumerates the tautomers of a molecular graph by iteratively applying a configurable set of Chem.TautomerizationRule instances and reporting each accepted tautomer to a user-supplied callback.

After registering tautomerization rules (via addTautomerizationRule()) and a callback (via setCallbackFunction()), each call to generate() seeds the enumeration with the input molecular graph, applies every registered rule to every intermediate tautomer to derive the next generation, and reports each newly-generated tautomer to the callback. The Mode setting controls how various types of duplicates shall be handled.

Constructor & Destructor Documentation

◆ __init__()

None CDPL.Chem.TautomerGenerator.__init__ ( TautomerGenerator  gen)

Constructs a copy of the TautomerGenerator instance gen.

Parameters
genThe TautomerGenerator to copy.

Member Function Documentation

◆ getObjectID()

int CDPL.Chem.TautomerGenerator.getObjectID ( )

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

Different Python TautomerGenerator 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 TautomerGenerator 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.

◆ addTautomerizationRule()

None CDPL.Chem.TautomerGenerator.addTautomerizationRule ( TautomerizationRule  rule)

Registers a new tautomerization rule.

Parameters
ruleThe tautomerization rule to register.

◆ removeTautomerizationRule()

None CDPL.Chem.TautomerGenerator.removeTautomerizationRule ( int  idx)

Removes the registered tautomerization rule at index idx.

Parameters
idxThe zero-based rule index.
Exceptions
Base.IndexErrorif the number of rules is zero or idx is not in the range [0, getNumTautomerizationRules() - 1].

◆ getTautomerizationRule()

TautomerizationRule CDPL.Chem.TautomerGenerator.getTautomerizationRule ( int  idx)

Returns the registered tautomerization rule at index idx.

Parameters
idxThe zero-based rule index.
Returns
A reference to the rule smart reference.
Exceptions
Base.IndexErrorif the number of rules is zero or idx is not in the range [0, getNumTautomerizationRules() - 1].

◆ getNumTautomerizationRules()

int CDPL.Chem.TautomerGenerator.getNumTautomerizationRules ( )

Returns the number of registered tautomerization rules.

Returns
The rule count.

◆ setCallbackFunction()

None CDPL.Chem.TautomerGenerator.setCallbackFunction ( BoolMolecularGraphFunctor  func)

Sets the callback invoked for every accepted output tautomer.

The callback receives the tautomer molecular graph as its argument and returns a boolean: returning False aborts the enumeration.

Parameters
funcThe new callback function.

◆ getCallbackFunction()

BoolMolecularGraphFunctor CDPL.Chem.TautomerGenerator.getCallbackFunction ( )

Returns the currently configured callback.

Returns
A reference to the callback function.

◆ setMode()

None CDPL.Chem.TautomerGenerator.setMode ( Mode  mode)

Sets the tautomer duplicate filtering mode.

Parameters
modeThe new duplicate filtering mode.

◆ getMode()

Mode CDPL.Chem.TautomerGenerator.getMode ( )

Returns the currently configured tautomer duplicate filtering mode.

Returns
The current duplicate filtering mode.

◆ regardStereochemistry()

None CDPL.Chem.TautomerGenerator.regardStereochemistry ( bool  regard)

Specifies whether atom/bond stereochemistry shall be regarded by the tautomer duplicate detection algorithm.

Parameters
regardIf True, atom/bond stereo configurations are taken into account.

◆ stereochemistryRegarded()

bool CDPL.Chem.TautomerGenerator.stereochemistryRegarded ( )

Tells whether atom/bond stereochemistry is regarded by the tautomer duplicate detection algorithm.

Returns
True if stereochemistry is regarded, and False otherwise.

◆ regardIsotopes()

None CDPL.Chem.TautomerGenerator.regardIsotopes ( bool  regard)

Specifies whether atom isotope information shall be regarded by the tautomer duplicate detection algorithm.

Parameters
regardIf True, atom isotope information is taken into account.

◆ isotopesRegarded()

bool CDPL.Chem.TautomerGenerator.isotopesRegarded ( )

Tells whether atom isotope information is regarded by the tautomer duplicate detection algorithm.

Returns
True if atom isotope information is regarded, and False otherwise.

◆ coordinates2DCleared()

bool CDPL.Chem.TautomerGenerator.coordinates2DCleared ( )

Tells whether 2D atom coordinates are cleared from the generated tautomers.

Returns
True if 2D coordinates are cleared, and False otherwise.
Since
1.3

◆ coordinates3DCleared()

bool CDPL.Chem.TautomerGenerator.coordinates3DCleared ( )

Tells whether 3D atom coordinates are cleared from the generated tautomers.

Returns
True if 3D coordinates are cleared, and False otherwise.
Since
1.3

◆ removeResonanceDuplicates()

None CDPL.Chem.TautomerGenerator.removeResonanceDuplicates ( bool  remove)

Specifies whether tautomers that differ only by resonance (no atom-connectivity change) shall be filtered out.

Parameters
removeIf True, resonance-only duplicates are not reported.
Since
1.1

◆ resonanceDuplicatesRemoved()

bool CDPL.Chem.TautomerGenerator.resonanceDuplicatesRemoved ( )

Tells whether resonance-only duplicates are filtered out.

Returns
True if resonance duplicates are removed, and False otherwise.
Since
1.1

◆ setCustomSetupFunction()

None CDPL.Chem.TautomerGenerator.setCustomSetupFunction ( VoidMolecularGraphFunctor  func)

Sets the optional setup function invoked on the generated tautomers.

Parameters
funcThe new custom setup function.

◆ generate()

None CDPL.Chem.TautomerGenerator.generate ( MolecularGraph  molgraph)

Enumerates the tautomers of molgraph and reports each accepted one to the registered callback.

Parameters
molgraphThe molecular graph whose tautomers shall be generated.

◆ assign()

TautomerGenerator CDPL.Chem.TautomerGenerator.assign ( TautomerGenerator  gen)

Replaces the state of this generator by a copy of the state of gen.

Parameters
genThe source TautomerGenerator.
Returns
self