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

Fragment. More...

+ Inheritance diagram for CDPL.Chem.Fragment:

Classes

class  AtomSequence
 
class  BondSequence
 

Public Member Functions

None __init__ ()
 Constructs an empty Fragment instance.
 
None __init__ (Fragment frag)
 Constructs a copy of the Fragment instance frag. More...
 
None __init__ (MolecularGraph molgraph)
 Constructs a Fragment instance storing the atoms, bonds and properties of the molecular graph molgraph. More...
 
Fragment assign (Fragment frag)
 Replaces the current set of atoms, bonds and properties by the atoms, bonds and properties of the fragment frag. More...
 
Fragment assign (MolecularGraph molgraph)
 Replaces the current set of atoms, bonds and properties by the atoms, bonds and properties of the molecular graph molgraph. More...
 
bool addAtom (Atom atom)
 Extends the fragment by the specified atom. More...
 
None removeAtom (int idx)
 Removes the atom at the specified index. More...
 
bool removeAtom (Atom atom)
 Removes the specified atom. More...
 
bool addBond (Bond bond)
 Extends the fragment by the specified bond. More...
 
None removeBond (int idx)
 Removes the bond at the specified index. More...
 
bool removeBond (Bond bond)
 Removes the specified bond. More...
 
None clear ()
 Removes all atoms and bonds.
 
None swap (Fragment frag)
 Exchanges the atoms, bonds and properties of this fragment with the atoms, bonds and properties of the fragment frag. More...
 
AtomSequence getAtoms ()
 
BondSequence getBonds ()
 
None reserveMemoryForAtoms (int num_atoms)
 
None reserveMemoryForBonds (int num_bonds)
 
bool __contains__ (Atom atom)
 Returns the result of the membership test operation atom in self. More...
 
bool __contains__ (Bond bond)
 Returns the result of the membership test operation bond in self. More...
 
bool __contains__ (Base.LookupKey key)
 Returns the result of the membership test operation key in self. More...
 
Base.Any __getitem__ (Base.LookupKey key)
 
None __setitem__ (Base.LookupKey key, Base.Any value)
 
bool __delitem__ (Base.LookupKey key)
 
int __len__ ()
 
Fragment __iadd__ (MolecularGraph molgraph)
 Performs the in-place addition operation self += molgraph. More...
 
Fragment __isub__ (MolecularGraph molgraph)
 Performs the in-place subtraction operation self -= molgraph. More...
 
- Public Member Functions inherited from CDPL.Chem.MolecularGraph
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 (ForceField.InteractionFilterFunction2 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 ()
 
- Public Member Functions inherited from CDPL.Chem.AtomContainer
Atom __getitem__ (int idx)
 
- Public Member Functions inherited from CDPL.Chem.Entity3DContainer
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
- Public Member Functions inherited from CDPL.Chem.BondContainer
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
Bond __getitem__ (int idx)
 
- Public Member Functions inherited from CDPL.Base.PropertyContainer
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
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

 atoms = property(getAtoms)
 
 bonds = property(getBonds)
 
- 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

Fragment.

Constructor & Destructor Documentation

◆ __init__() [1/2]

None CDPL.Chem.Fragment.__init__ ( Fragment  frag)

Constructs a copy of the Fragment instance frag.

Parameters
fragThe other Fragment instance to copy.

◆ __init__() [2/2]

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

Constructs a Fragment instance storing the atoms, bonds and properties of the molecular graph molgraph.

Parameters
molgraphThe Chem.MolecularGraph instance providing the atoms, bonds and properties to store.

Reimplemented in CDPL.Chem.CyclicSubstructure, and CDPL.Chem.AromaticSubstructure.

Member Function Documentation

◆ assign() [1/2]

Fragment CDPL.Chem.Fragment.assign ( Fragment  frag)

Replaces the current set of atoms, bonds and properties by the atoms, bonds and properties of the fragment frag.

Parameters
fragThe fragment to copy.
Returns
self

◆ assign() [2/2]

Fragment CDPL.Chem.Fragment.assign ( MolecularGraph  molgraph)

Replaces the current set of atoms, bonds and properties by the atoms, bonds and properties of the molecular graph molgraph.

Parameters
molgraphThe Chem.MolecularGraph instance providing the atoms, bonds and properties to copy.
Returns
self

◆ addAtom()

bool CDPL.Chem.Fragment.addAtom ( Atom  atom)

Extends the fragment by the specified atom.

Parameters
atomThe atom to add.
Returns
True if the atom was not already a part of the fragment, and False otherwise.

◆ removeAtom() [1/2]

None CDPL.Chem.Fragment.removeAtom ( int  idx)

Removes the atom at the specified index.

If the specified atom is connected to any other atoms of the fragment, the connecting bonds will also be removed.

Parameters
idxThe zero-based index of the atom to remove.
Exceptions
Base.IndexErrorif the number of atoms is zero or idx is not in the range [0, getNumAtoms() - 1].

◆ removeAtom() [2/2]

bool CDPL.Chem.Fragment.removeAtom ( Atom  atom)

Removes the specified atom.

If the specified atom is connected to any other atoms of the fragment, the connecting bonds will also be removed.

Parameters
atomThe atom to remove.
Returns
True if the atom was part of the fragment and has been removed, and False otherwise.

◆ addBond()

bool CDPL.Chem.Fragment.addBond ( Bond  bond)

Extends the fragment by the specified bond.

If the atoms of the bond are not already part of the fragment, they will be added automatically.

Parameters
bondThe bond to add.
Returns
True if the bond was not already a part of the fragment, and False otherwise.

◆ removeBond() [1/2]

None CDPL.Chem.Fragment.removeBond ( int  idx)

Removes the bond at the specified index.

Parameters
idxThe zero-based index of the bond to remove.
Exceptions
Base.IndexErrorif the number of bonds is zero or idx is not in the range [0, getNumBonds() - 1].

◆ removeBond() [2/2]

bool CDPL.Chem.Fragment.removeBond ( Bond  bond)

Removes the specified bond.

Parameters
bondThe bond to remove.
Returns
True if the bond was removed, and False otherwise.

◆ swap()

None CDPL.Chem.Fragment.swap ( Fragment  frag)

Exchanges the atoms, bonds and properties of this fragment with the atoms, bonds and properties of the fragment frag.

Parameters
fragThe fragment the atoms, bonds and properties get exchanged with.

◆ getAtoms()

AtomSequence CDPL.Chem.Fragment.getAtoms ( )
Returns

Reimplemented from CDPL.Chem.MolecularGraph.

◆ getBonds()

BondSequence CDPL.Chem.Fragment.getBonds ( )
Returns

Reimplemented from CDPL.Chem.MolecularGraph.

◆ reserveMemoryForAtoms()

None CDPL.Chem.Fragment.reserveMemoryForAtoms ( int  num_atoms)
Parameters
num_atoms

◆ reserveMemoryForBonds()

None CDPL.Chem.Fragment.reserveMemoryForBonds ( int  num_bonds)
Parameters
num_bonds

◆ __contains__() [1/3]

bool CDPL.Chem.Fragment.__contains__ ( Atom  atom)

Returns the result of the membership test operation atom in self.

Parameters
atomThe value to test for membership.
Returns
The result of the membership test operation.

Reimplemented from CDPL.Chem.MolecularGraph.

◆ __contains__() [2/3]

bool CDPL.Chem.Fragment.__contains__ ( Bond  bond)

Returns the result of the membership test operation bond in self.

Parameters
bondThe value to test for membership.
Returns
The result of the membership test operation.

Reimplemented from CDPL.Chem.MolecularGraph.

◆ __contains__() [3/3]

bool CDPL.Chem.Fragment.__contains__ ( Base.LookupKey  key)

Returns the result of the membership test operation key in self.

Parameters
keyThe value to test for membership.
Returns
The result of the membership test operation.

Reimplemented from CDPL.Chem.MolecularGraph.

◆ __getitem__()

Base.Any CDPL.Chem.Fragment.__getitem__ ( Base.LookupKey  key)
Parameters
key
Returns

Reimplemented from CDPL.Chem.MolecularGraph.

◆ __setitem__()

None CDPL.Chem.Fragment.__setitem__ ( Base.LookupKey  key,
Base.Any  value 
)
Parameters
key
value

Reimplemented from CDPL.Chem.MolecularGraph.

◆ __delitem__()

bool CDPL.Chem.Fragment.__delitem__ ( Base.LookupKey  key)
Parameters
key
Returns

Reimplemented from CDPL.Chem.MolecularGraph.

◆ __len__()

int CDPL.Chem.Fragment.__len__ ( )

◆ __iadd__()

Fragment CDPL.Chem.Fragment.__iadd__ ( MolecularGraph  molgraph)

Performs the in-place addition operation self += molgraph.

Parameters
molgraphSpecifies the second addend.
Returns
The updated Fragment instance self.

◆ __isub__()

Fragment CDPL.Chem.Fragment.__isub__ ( MolecularGraph  molgraph)

Performs the in-place subtraction operation self -= molgraph.

Parameters
molgraphSpecifies the subtrahend.
Returns
The updated Fragment instance self.