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

Finds torsion rules from a ConfGen.TorsionLibrary instance that match a given rotatable bond. More...

+ Inheritance diagram for CDPL.ConfGen.TorsionRuleMatcher:

Public Member Functions

None __init__ ()
 Constructs the TorsionRuleMatcher instance without an associated torsion library.
 
None __init__ (TorsionLibrary lib)
 Constructs the TorsionRuleMatcher instance and associates it with lib. More...
 
None findUniqueMappingsOnly (bool unique)
 Specifies whether only unique substructure mappings shall be reported during matching. More...
 
bool findUniqueMappingsOnly ()
 Tells whether only unique substructure mappings are reported during matching. More...
 
None findAllRuleMappings (bool all)
 Specifies whether all matching rules shall be reported (instead of just the most-specific one). More...
 
bool findAllRuleMappings ()
 Tells whether all matching rules are reported during matching. More...
 
None stopAtFirstMatchingRule (bool stop)
 Specifies whether the matching process shall stop at the first rule that produces matches. More...
 
bool stopAtFirstMatchingRule ()
 Tells whether matching stops at the first rule that produces matches. More...
 
None setTorsionLibrary (TorsionLibrary lib)
 Sets the torsion library to query. More...
 
TorsionLibrary getTorsionLibrary ()
 Returns the currently associated torsion library. More...
 
int getNumMatches ()
 Returns the number of stored torsion rule matches found by calls to findMatches(). More...
 
TorsionRuleMatch getMatch (int idx)
 Returns a reference to the stored torsion rule match object at index idx. More...
 
bool findMatches (Chem.Bond bond, Chem.MolecularGraph molgraph, bool append=False)
 Searches the associated torsion library for rules that match the bond bond of the molecular graph molgraph. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
TorsionRuleMatch __getitem__ (int idx)
 
int __len__ ()
 

Properties

 objectID = property(getObjectID)
 
 numMatches = property(getNumMatches)
 
 uniqueMappingsOnly = property(findUniqueMappingsOnly, findUniqueMappingsOnly)
 
 allRuleMappings = property(findAllRuleMappings, findAllRuleMappings)
 
 onlyFirstMatchingRule = property(stopAtFirstMatchingRule, stopAtFirstMatchingRule)
 
 torsionLibrary = property(getTorsionLibrary, setTorsionLibrary)
 

Detailed Description

Finds torsion rules from a ConfGen.TorsionLibrary instance that match a given rotatable bond.

For a queried bond in a molecular graph the matcher iterates the configured torsion library (top-down through torsion categories) and reports every rule whose central bond pattern matches the queried bond. Each match is stored as a ConfGen.TorsionRuleMatch object providing the four matching atoms, the matched rule and the underlying atom/bond mapping.

Constructor & Destructor Documentation

◆ __init__()

None CDPL.ConfGen.TorsionRuleMatcher.__init__ ( TorsionLibrary  lib)

Constructs the TorsionRuleMatcher instance and associates it with lib.

Parameters
libThe torsion library to query.

Member Function Documentation

◆ findUniqueMappingsOnly() [1/2]

None CDPL.ConfGen.TorsionRuleMatcher.findUniqueMappingsOnly ( bool  unique)

Specifies whether only unique substructure mappings shall be reported during matching.

Parameters
uniqueIf True, only one of multiple equivalent mappings is reported per rule.

◆ findUniqueMappingsOnly() [2/2]

bool CDPL.ConfGen.TorsionRuleMatcher.findUniqueMappingsOnly ( )

Tells whether only unique substructure mappings are reported during matching.

Returns
True if only unique mappings are reported, and False otherwise.

◆ findAllRuleMappings() [1/2]

None CDPL.ConfGen.TorsionRuleMatcher.findAllRuleMappings ( bool  all)

Specifies whether all matching rules shall be reported (instead of just the most-specific one).

Parameters
allIf True, every matching rule across all categories is reported.

◆ findAllRuleMappings() [2/2]

bool CDPL.ConfGen.TorsionRuleMatcher.findAllRuleMappings ( )

Tells whether all matching rules are reported during matching.

Returns
True if all matching rules are reported, and False otherwise.

◆ stopAtFirstMatchingRule() [1/2]

None CDPL.ConfGen.TorsionRuleMatcher.stopAtFirstMatchingRule ( bool  stop)

Specifies whether the matching process shall stop at the first rule that produces matches.

Parameters
stopIf True, matching stops as soon as a rule yields at least one match.

◆ stopAtFirstMatchingRule() [2/2]

bool CDPL.ConfGen.TorsionRuleMatcher.stopAtFirstMatchingRule ( )

Tells whether matching stops at the first rule that produces matches.

Returns
True if matching stops at the first matching rule, and False otherwise.

◆ setTorsionLibrary()

None CDPL.ConfGen.TorsionRuleMatcher.setTorsionLibrary ( TorsionLibrary  lib)

Sets the torsion library to query.

Parameters
libThe new torsion library.

◆ getTorsionLibrary()

TorsionLibrary CDPL.ConfGen.TorsionRuleMatcher.getTorsionLibrary ( )

Returns the currently associated torsion library.

Returns
A reference to the torsion library smart reference.

◆ getNumMatches()

int CDPL.ConfGen.TorsionRuleMatcher.getNumMatches ( )

Returns the number of stored torsion rule matches found by calls to findMatches().

Returns
The number of stored torsion rule matches.

◆ getMatch()

TorsionRuleMatch CDPL.ConfGen.TorsionRuleMatcher.getMatch ( int  idx)

Returns a reference to the stored torsion rule match object at index idx.

Parameters
idxThe zero-based index of the torsion rule match object to return.
Returns
A reference to the torsion rule match object at index idx.
Exceptions
Base.IndexErrorif no torsion rule matches are available or idx is not in the range [0, getNumMatches() - 1].

◆ findMatches()

bool CDPL.ConfGen.TorsionRuleMatcher.findMatches ( Chem.Bond  bond,
Chem.MolecularGraph  molgraph,
bool   append = False 
)

Searches the associated torsion library for rules that match the bond bond of the molecular graph molgraph.

Parameters
bondThe rotatable bond for which matching torsion rules are sought.
molgraphThe molecular graph the bond belongs to.
appendIf True, new matches are appended to the previously stored ones. Otherwise, stored matches are cleared first.
Returns
True if at least one matching rule was found, and False otherwise.

◆ getObjectID()

int CDPL.ConfGen.TorsionRuleMatcher.getObjectID ( )

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

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

◆ __getitem__()

TorsionRuleMatch CDPL.ConfGen.TorsionRuleMatcher.__getitem__ ( int  idx)
Parameters
idx
Returns

◆ __len__()

int CDPL.ConfGen.TorsionRuleMatcher.__len__ ( )
Returns