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

MaxCommonAtomSubstructureSearch. More...

+ Inheritance diagram for CDPL.Chem.MaxCommonAtomSubstructureSearch:

Public Member Functions

None __init__ ()
 Constructs and initializes a MaxCommonAtomSubstructureSearch instance.
 
None __init__ (MolecularGraph query)
 Constructs and initializes a MaxCommonAtomSubstructureSearch instance for the specified query structure. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
bool mappingExists (MolecularGraph target)
 Searches for a common substructure between the query and the specified target molecular graph. More...
 
bool findAllMappings (MolecularGraph target)
 Searches for all atom/bond mappings of query subgraphs to substructures of the specified target molecular graph with a maximum atom count. More...
 
bool findMaxBondMappings (MolecularGraph target)
 Searches for all atom/bond mappings of query subgraphs to substructures of the specified target molecular graph with a maximum atom and bond count. More...
 
int getNumMappings ()
 Returns the number of atom/bond mappings that were recorded in the last search for common substructures. More...
 
AtomBondMapping getMapping (int idx)
 Returns a reference to the stored atom/bond mapping object at index idx. More...
 
None uniqueMappingsOnly (bool unique)
 Allows to specify whether or not to store only unique atom/bond mappings. More...
 
bool uniqueMappingsOnly ()
 Tells whether duplicate atom/bond mappings are discarded. More...
 
int getMaxNumMappings ()
 Returns the specified limit on the number of stored atom/bond mappings. More...
 
None setMaxNumMappings (int max_num_mappings)
 Allows to specify a limit on the number of stored atom/bond mappings. More...
 
int getMinSubstructureSize ()
 Returns the minimum accepted common substructure size. More...
 
None setMinSubstructureSize (int min_size)
 Allows to specify the minimum accepted common substructure size. More...
 
None setQuery (MolecularGraph query)
 Allows to specify a new query structure. More...
 
AtomBondMapping __getitem__ (int idx)
 
int __len__ ()
 
bool __nonzero__ (MolecularGraph self)
 
bool __bool__ (MolecularGraph self)
 

Properties

 objectID = property(getObjectID)
 
 numMappings = property(getNumMappings)
 
 uniqueMappings = property(uniqueMappingsOnly, uniqueMappingsOnly)
 
 maxNumMappings = property(getMaxNumMappings, setMaxNumMappings)
 
 minSubstructureSize = property(getMinSubstructureSize, setMinSubstructureSize)
 

Detailed Description

MaxCommonAtomSubstructureSearch.

See also
[MCASA]

Constructor & Destructor Documentation

◆ __init__()

None CDPL.Chem.MaxCommonAtomSubstructureSearch.__init__ ( MolecularGraph  query)

Constructs and initializes a MaxCommonAtomSubstructureSearch instance for the specified query structure.

Parameters
queryA molecular graph that represents the query structure.

Member Function Documentation

◆ getObjectID()

int CDPL.Chem.MaxCommonAtomSubstructureSearch.getObjectID ( )

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

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

◆ mappingExists()

bool CDPL.Chem.MaxCommonAtomSubstructureSearch.mappingExists ( MolecularGraph  target)

Searches for a common substructure between the query and the specified target molecular graph.

The method does not store any atom/bond mappings between query and target substructures - it just tells if a valid common substructure mapping solution involving at least getMinSubstructureSize() atoms could be found. If you need access to the atom/bond mappings, use findAllMappings() or findMaxBondMappings() instead.

Parameters
targetThe molecular graph that has to be searched for a substructure in common with the query.
Returns
True if a common substructure of at least the minimum accepted size could be found, and False otherwise.
Note
Any atom/bond mappings that were recorded in a previous call to findAllMappings() or findMaxMappings() will be discarded.

◆ findAllMappings()

bool CDPL.Chem.MaxCommonAtomSubstructureSearch.findAllMappings ( MolecularGraph  target)

Searches for all atom/bond mappings of query subgraphs to substructures of the specified target molecular graph with a maximum atom count.

The method will store all maximum-sized (in number of atoms) common substructure mapping solutions involving at least getMinSubstructureSize() atoms up to the maximum number of recorded mappings specified by setMaxNumMappings(). If only unique mappings have to be stored (see uniqueMappingsOnly(bool unique)), any duplicates of previously found mappings will be discarded.

Parameters
targetThe molecular graph that has to be searched for all maximum-sized substructures in common with the query.
Returns
True if common substructures of at least the minimum accepted size were found, and False otherwise.
Note
Any atom/bond mappings that were recorded in a previous call to findAllMappings() or findMaxBondMappings() will be discarded.

◆ findMaxBondMappings()

bool CDPL.Chem.MaxCommonAtomSubstructureSearch.findMaxBondMappings ( MolecularGraph  target)

Searches for all atom/bond mappings of query subgraphs to substructures of the specified target molecular graph with a maximum atom and bond count.

The method will store all maximum-sized (both in number of atoms and bonds) common substructure mapping solutions involving at least getMinSubstructureSize() atoms up to the maximum number of recorded mappings specified by setMaxNumMappings(). If only unique mappings have to be stored (see uniqueMappingsOnly(bool unique)), any duplicates of previously found mappings will be discarded.

Parameters
targetThe molecular graph that has to be searched for all maximum-sized substructures in common with the query.
Returns
True if common substructures of at least the minimum accepted size were found, and False otherwise.
Note
Any atom/bond mappings that were recorded in a previous call to findAllMappings() or findMaxBondMappings() will be discarded.

◆ getNumMappings()

int CDPL.Chem.MaxCommonAtomSubstructureSearch.getNumMappings ( )

Returns the number of atom/bond mappings that were recorded in the last search for common substructures.

Returns
The number of atom/bond mappings that were recorded in the last search for common substructures.
See also
findAllMappings(), findMaxBondMappings()

◆ getMapping()

AtomBondMapping CDPL.Chem.MaxCommonAtomSubstructureSearch.getMapping ( int  idx)

Returns a reference to the stored atom/bond mapping object at index idx.

Parameters
idxThe zero-based index of the atom/bond mapping object to return.
Returns
A reference to the atom/bond mapping object at index idx.
Exceptions
Base.IndexErrorif no mappings are available or idx is not in the range [0, getNumMappings() - 1].

◆ uniqueMappingsOnly() [1/2]

None CDPL.Chem.MaxCommonAtomSubstructureSearch.uniqueMappingsOnly ( bool  unique)

Allows to specify whether or not to store only unique atom/bond mappings.

The mapping of a query pattern subgraph to a substructure of the target molecular graph is considered to be unique if it differs from all previously found mappings by at least one atom or bond. If the unique argument is True, and a newly discovered mapping covers the same atoms and bonds of the target (including all permutations) as a mapping that was found earlier in the search process, it is considered as a duplicate and will be discarded.

Parameters
uniqueIf True, only unique mappings will be stored, and all found mappings otherwise.
Note
By default, duplicate mappings are not discarded.

◆ uniqueMappingsOnly() [2/2]

bool CDPL.Chem.MaxCommonAtomSubstructureSearch.uniqueMappingsOnly ( )

Tells whether duplicate atom/bond mappings are discarded.

Returns
True if duplicate mappings are discarded, and False otherwise.
See also
uniqueMappingsOnly(bool unique)

◆ getMaxNumMappings()

int CDPL.Chem.MaxCommonAtomSubstructureSearch.getMaxNumMappings ( )

Returns the specified limit on the number of stored atom/bond mappings.

Returns
The specified maximum number of stored atom/bond mappings.
See also
setMaxNumMappings(), findMappings()

◆ setMaxNumMappings()

None CDPL.Chem.MaxCommonAtomSubstructureSearch.setMaxNumMappings ( int  max_num_mappings)

Allows to specify a limit on the number of stored atom/bond mappings.

In a call to findAllMappings() or findMaxBondMappings() the common substructure search will terminate as soon as the specified maximum number of stored atom/bond mappings has been reached. A previously set limit on the number of mappings can be disabled by providing zero for the value of max_num_mappings.

Parameters
max_num_mappingsThe maximum number of atom/bond mappings to store.
Note
By default, no limit is imposed on the number of stored mappings.

◆ getMinSubstructureSize()

int CDPL.Chem.MaxCommonAtomSubstructureSearch.getMinSubstructureSize ( )

Returns the minimum accepted common substructure size.

Returns
The minimum accepted common substructure size in number of atoms.
See also
setMinSubstructureSize()

◆ setMinSubstructureSize()

None CDPL.Chem.MaxCommonAtomSubstructureSearch.setMinSubstructureSize ( int  min_size)

Allows to specify the minimum accepted common substructure size.

Any found common substructures which cover less than min_size atoms are not accepted as a valid solution and will be discarded.

Parameters
min_sizeThe minimum accepted common substructure size in number of atoms.
Note
By default, the minimum common substructure size is set to zero.

◆ setQuery()

None CDPL.Chem.MaxCommonAtomSubstructureSearch.setQuery ( MolecularGraph  query)

Allows to specify a new query structure.

Parameters
queryA molecular graph that represents the query structure.

◆ __getitem__()

AtomBondMapping CDPL.Chem.MaxCommonAtomSubstructureSearch.__getitem__ ( int  idx)
Parameters
idx
Returns

◆ __len__()

int CDPL.Chem.MaxCommonAtomSubstructureSearch.__len__ ( )
Returns

◆ __nonzero__()

bool CDPL.Chem.MaxCommonAtomSubstructureSearch.__nonzero__ ( MolecularGraph  self)
Parameters
arg1
Returns

◆ __bool__()

bool CDPL.Chem.MaxCommonAtomSubstructureSearch.__bool__ ( MolecularGraph  self)
Parameters
arg1
Returns