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

A canonicalized molecular fragment with an associated hash code, used as the key for fragment-library lookup in conformer generation. More...

+ Inheritance diagram for CDPL.ConfGen.CanonicalFragment:

Classes

class  AtomMapping
 Maps each atom of the fragment (in canonical order) to the corresponding atom of the parent molecular graph. More...
 

Public Member Functions

None __init__ ()
 Constructs an empty CanonicalFragment instance.
 
None __init__ (Chem.MolecularGraph molgraph, Chem.MolecularGraph parent)
 Constructs a CanonicalFragment instance from the fragment molgraph of the parent molecular graph parent. More...
 
None __init__ (CanonicalFragment frag)
 Constructs a copy of the CanonicalFragment instance frag. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
CanonicalFragment assign (CanonicalFragment frag)
 Replaces the contents of this fragment with a copy of frag. More...
 
None create (Chem.MolecularGraph molgraph, Chem.MolecularGraph parent, bool modify=True, bool strip_aro_subst=True)
 Builds the canonical fragment from the fragment molgraph of the parent molecular graph parent. More...
 
int getHashCode ()
 Returns the hash code of the fragment. More...
 
None clear ()
 Removes all atoms and bonds and resets the hash code.
 
Chem.AtomMapping getAtomMapping ()
 Returns the atom mapping from this fragment to the parent molecular graph. More...
 
- Public Member Functions inherited from CDPL.Chem.MolecularGraph
AtomSequence getAtoms ()
 
BondSequence getBonds ()
 
MolecularGraph clone ()
 Creates a copy of the molecular graph. More...
 
Atom getAtom (int idx)
 
bool containsAtom (Atom atom)
 
int getAtomIndex (Atom atom)
 
int getNumAtoms ()
 
None orderAtoms (BoolAtom2Functor func)
 
Entity3D getEntity (int idx)
 
int getNumEntities ()
 
Bond getBond (int idx)
 
bool containsBond (Bond bond)
 
None orderBonds (BoolBond2Functor func)
 
int getBondIndex (Bond bond)
 
int getNumBonds ()
 
Base.Any __getitem__ (Base.LookupKey key)
 
bool __contains__ (Base.LookupKey key)
 Returns the result of the membership test operation key in self. More...
 
bool __contains__ (Bond bond)
 Returns the result of the membership test operation bond in self. More...
 
bool __contains__ (Atom atom)
 Returns the result of the membership test operation atom in self. More...
 
None __setitem__ (Base.LookupKey key, Base.Any value)
 
bool __delitem__ (Base.LookupKey key)
 
int __len__ ()
 
- Public Member Functions inherited from CDPL.Chem.AtomContainer
Atom __getitem__ (int idx)
 
- Public Member Functions inherited from CDPL.Chem.BondContainer
Bond __getitem__ (int idx)
 
- Public Member Functions inherited from CDPL.Base.PropertyContainer
int getNumProperties ()
 Returns the number of property entries. More...
 
Any getPropertyOrDefault (LookupKey key, Any def_value)
 
list getPropertyKeys ()
 
list getPropertyValues ()
 
list getProperties ()
 Returns a reference to itself. More...
 
None setProperty (LookupKey key, Any value)
 
bool removeProperty (LookupKey key)
 Clears the value of the property specified by key. More...
 
Any getProperty (LookupKey key, bool throw_=False)
 Returns the value of the property specified by key. More...
 
bool isPropertySet (LookupKey key)
 Tells whether or not a value has been assigned to the property specified by key. More...
 
None clearProperties ()
 Clears all property values.
 
None addProperties (PropertyContainer cntnr)
 Adds the property value entries in the PropertyContainer instance cntnr. More...
 
None copyProperties (PropertyContainer cntnr)
 Replaces the current set of properties by a copy of the entries in cntnr. More...
 
None swap (PropertyContainer cntnr)
 Exchanges the properties of this container with the properties of the container cntnr. More...
 
Any __getitem__ (LookupKey key)
 
bool __contains__ (LookupKey key)
 Returns the result of the membership test operation key in self. More...
 
None __setitem__ (LookupKey key, Any value)
 
bool __delitem__ (LookupKey key)
 

Properties

 objectID = property(getObjectID)
 
 hashCode = property(getHashCode)
 
 atomMapping = property(getAtomMapping)
 
- Properties inherited from CDPL.Chem.MolecularGraph
 atoms = property(getAtoms)
 
 bonds = property(getBonds)
 
- Properties inherited from CDPL.Chem.AtomContainer
 numAtoms = property(getNumAtoms)
 
- Properties inherited from CDPL.Chem.Entity3DContainer
 objectID = property(getObjectID)
 
 numEntities = property(getNumEntities)
 
- Properties inherited from CDPL.Chem.BondContainer
 objectID = property(getObjectID)
 
 numBonds = property(getNumBonds)
 
- Properties inherited from CDPL.Base.PropertyContainer
 objectID = property(getObjectID)
 
 propertyKeys = property(getPropertyKeys)
 
 propertyValues = property(getPropertyValues)
 
 properties = property(getProperties)
 
 numProperties = property(getNumProperties)
 

Detailed Description

A canonicalized molecular fragment with an associated hash code, used as the key for fragment-library lookup in conformer generation.

A CanonicalFragment is constructed from a fragment of a parent molecular graph and stores a canonicalized copy of the fragment's atoms and bonds. Canonicalization yields a stable atom ordering and an associated hash code that uniquely identifies the topology (and, optionally, the stereochemistry) of the fragment.

See also
ConfGen.FragmentLibrary

Constructor & Destructor Documentation

◆ __init__() [1/2]

None CDPL.ConfGen.CanonicalFragment.__init__ ( Chem.MolecularGraph  molgraph,
Chem.MolecularGraph  parent 
)

Constructs a CanonicalFragment instance from the fragment molgraph of the parent molecular graph parent.

Parameters
molgraphThe molecular graph defining the fragment to canonicalize.
parentThe parent molecular graph the fragment was derived from.

◆ __init__() [2/2]

None CDPL.ConfGen.CanonicalFragment.__init__ ( CanonicalFragment  frag)

Constructs a copy of the CanonicalFragment instance frag.

Parameters
fragThe CanonicalFragment to copy.

Member Function Documentation

◆ getObjectID()

int CDPL.ConfGen.CanonicalFragment.getObjectID ( )

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

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

Reimplemented from CDPL.Base.PropertyContainer.

◆ assign()

CanonicalFragment CDPL.ConfGen.CanonicalFragment.assign ( CanonicalFragment  frag)

Replaces the contents of this fragment with a copy of frag.

Parameters
fragThe source CanonicalFragment.
Returns
self

◆ create()

None CDPL.ConfGen.CanonicalFragment.create ( Chem.MolecularGraph  molgraph,
Chem.MolecularGraph  parent,
bool   modify = True,
bool   strip_aro_subst = True 
)

Builds the canonical fragment from the fragment molgraph of the parent molecular graph parent.

Parameters
molgraphThe molecular graph defining the fragment to canonicalize.
parentThe parent molecular graph the fragment was derived from.
modifyIf True, the fragment is modified prior to canonicalization (e.g. ring perception, hydrogenization).
strip_aro_substIf True, aromatic-ring substituents are stripped during fragment construction.

◆ getHashCode()

int CDPL.ConfGen.CanonicalFragment.getHashCode ( )

Returns the hash code of the fragment.

Returns
The fragment hash code (0 if not yet computed).

◆ getAtomMapping()

Chem.AtomMapping CDPL.ConfGen.CanonicalFragment.getAtomMapping ( )

Returns the atom mapping from this fragment to the parent molecular graph.

Returns
A reference to the atom mapping.