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

Evaluates a boolean expression over multiple substructure queries against a target molecular graph. More...

+ Inheritance diagram for CDPL.Chem.MultiSubstructureSearch:

Public Member Functions

None __init__ ()
 Constructs and initializes a MultiSubstructureSearch instance.
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
None addSubstructure (MolecularGraph molgraph)
 Appends a substructure query to the internal substructure list. More...
 
int getNumSubstructures ()
 Returns the number of stored substructure queries. More...
 
None clear ()
 Removes all stored substructure queries and clears the compiled expression.
 
bool matches (MolecularGraph target)
 
None setup (str expr='')
 
str validate (str expr, int max_substr_id)
 

Properties

 objectID = property(getObjectID)
 
 numSubstructures = property(getNumSubstructures)
 

Detailed Description

Evaluates a boolean expression over multiple substructure queries against a target molecular graph.

Substructure query molecular graphs are added via addSubstructure() and referenced in the boolean expression by their 1-based insertion order (e.g. "1 AND (2 OR NOT 3)"). The expression is parsed by setup() and subsequently evaluated for each target molecular graph passed to matches().

Since
1.2

Member Function Documentation

◆ getObjectID()

int CDPL.Chem.MultiSubstructureSearch.getObjectID ( )

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

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

◆ addSubstructure()

None CDPL.Chem.MultiSubstructureSearch.addSubstructure ( MolecularGraph  molgraph)

Appends a substructure query to the internal substructure list.

The query receives the 1-based ID equal to the new value of getNumSubstructures(), which is how it is referenced in the boolean expression.

Parameters
molgraphA smart reference to the substructure query molecular graph.

◆ getNumSubstructures()

int CDPL.Chem.MultiSubstructureSearch.getNumSubstructures ( )

Returns the number of stored substructure queries.

Returns
The number of stored substructure queries.

◆ matches()

bool CDPL.Chem.MultiSubstructureSearch.matches ( MolecularGraph  target)
Parameters
target
Returns

◆ setup()

None CDPL.Chem.MultiSubstructureSearch.setup ( str   expr = '')
Parameters
expr

◆ validate()

str CDPL.Chem.MultiSubstructureSearch.validate ( str  expr,
int  max_substr_id 
)
Parameters
expr
max_substr_id
Returns