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

Enumerates the connected substructures of a molecular graph of a specified bond count. More...

+ Inheritance diagram for CDPL.Chem.ConnectedSubstructureSet:

Public Member Functions

None __init__ ()
 Constructs an empty ConnectedSubstructureSet instance.
 
None __init__ (MolecularGraph molgraph)
 Constructs and initialzes a ConnectedSubstructureSet instance for the molecular graph molgraph. More...
 
None reset (MolecularGraph molgraph)
 Specifies the molecular graph that is searched for connected substructures. More...
 
int getSubstructureSize ()
 Returns the current substructure size in terms of number of bonds. More...
 
None findSubstructures (int size)
 Searches the specified molecular graph for connected substructures of the given size. More...
 
- Public Member Functions inherited from CDPL.Chem.FragmentList
None __init__ (FragmentList list)
 Contructs a copy of the FragmentList instance list. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
int getSize ()
 Returns the number of elements stored in the list. More...
 
bool isEmpty ()
 Tells whether the list is empty (getSize() == 0). More...
 
None resize (int num_elem, Fragment value)
 Inserts or erases elements at the end so that the size becomes num_elem. More...
 
None reserve (int num_elem)
 Preallocates memory for (at least) num_elem elements. More...
 
int getCapacity ()
 Returns the number of elements for which memory has been allocated. More...
 
None clear ()
 Erases all elements.
 
FragmentList assign (FragmentList list)
 Replaces the current state with a copy of the state of the FragmentList instance list. More...
 
None assign (int num_elem, Fragment value)
 This function fills the array with num_elem copies of the given value. More...
 
None addElement (Fragment value)
 Adds a new element at the end of the list. More...
 
None addElements (FragmentList values)
 Adds the elements of values to the end of the list. More...
 
None insertElement (int idx, Fragment value)
 Inserts a new element before the location specified by the index idx. More...
 
None insertElements (int idx, int num_elem, Fragment value)
 Inserts num_elem copies of value before the location specified by the index idx. More...
 
None insertElements (int idx, FragmentList values)
 Insert the elements of values before the location specified by the index idx. More...
 
None popLastElement ()
 Removes the last element of the list. More...
 
None removeElement (int idx)
 Removes the element at index idx. More...
 
None removeElements (int begin_idx, int end_idx)
 Removes the elements at indices in the range [begin_idx, end_idx). More...
 
Fragment getFirstElement ()
 Returns the first element of the list. More...
 
Fragment getLastElement ()
 Returns the last element of the list. More...
 
Fragment getElement (int idx)
 Returns the element at index idx. More...
 
None setElement (int idx, Fragment value)
 Assigns a new value to the element at index idx. More...
 
None __delitem__ (int idx)
 Removes the element at index idx. More...
 
Fragment __getitem__ (int idx)
 Returns the element at index idx. More...
 
int __len__ ()
 Returns the number of elements stored in the list. More...
 
None __setitem__ (int idx, Fragment value)
 Assigns a new value to the element at index idx. More...
 
bool __eq__ (object list)
 Returns the result of the comparison operation self == list. More...
 
bool __ne__ (object list)
 Returns the result of the comparison operation self != list. More...
 

Properties

 substructureSize = property(getSubstructureSize, setSubstructureSize)
 
- Properties inherited from CDPL.Chem.FragmentList
 objectID = property(getObjectID)
 
 size = property(getSize)
 

Detailed Description

Enumerates the connected substructures of a molecular graph of a specified bond count.

After construction or a call to reset(), invoke findSubstructures() with a target size to populate the inherited Chem.FragmentList with all connected subgraphs of that size. Successive findSubstructures() calls accumulate fragments in the list; use getSubstructureSize() to query the most recently requested size.

Constructor & Destructor Documentation

◆ __init__()

None CDPL.Chem.ConnectedSubstructureSet.__init__ ( MolecularGraph  molgraph)

Constructs and initialzes a ConnectedSubstructureSet instance for the molecular graph molgraph.

Parameters
molgraphThe molecular graph to search for connected substructures.

Member Function Documentation

◆ reset()

None CDPL.Chem.ConnectedSubstructureSet.reset ( MolecularGraph  molgraph)

Specifies the molecular graph that is searched for connected substructures.

The current substructure size is reset to zero.

Parameters
molgraphThe molecular graph to search for connected substructures.

◆ getSubstructureSize()

int CDPL.Chem.ConnectedSubstructureSet.getSubstructureSize ( )

Returns the current substructure size in terms of number of bonds.

The current substructure size corresponds to the size that was specified in the the last call to findSubstructures(). If findSubstructures() has not yet been called, the current substructure size is zero.

Returns
The current substructure size.

◆ findSubstructures()

None CDPL.Chem.ConnectedSubstructureSet.findSubstructures ( int  size)

Searches the specified molecular graph for connected substructures of the given size.

If a molecular graph has not yet been specified (in the constructor or by a prior call to reset(const Chem.MolecularGraph&)), the method has no effect. Otherwise, all connected substructures of the specified size are added as Chem.Fragment instances to the list of previously found (if any) substructures. If the specified size is zero, substructures of size 1 (i.e. the bonds of the molecular graph) will be extracted.

Parameters
sizeThe substructure size in terms of number of bonds.