Chemical Data Processing Library C++ API - Version 1.4.0
Public Types | Public Member Functions | List of all members
CDPL::ConfGen::CanonicalFragment Class Reference

Data structure representing a canonicalized molecular fragment. More...

#include <CanonicalFragment.hpp>

+ Inheritance diagram for CDPL::ConfGen::CanonicalFragment:

Public Types

typedef std::shared_ptr< CanonicalFragmentSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated CanonicalFragment instances. More...
 
typedef Chem::BasicMolecule::AtomIterator AtomIterator
 A mutable iterator over the contained atoms. More...
 
typedef Chem::BasicMolecule::ConstAtomIterator ConstAtomIterator
 A constant iterator over the contained atoms. More...
 
typedef Chem::BasicMolecule::BondIterator BondIterator
 A mutable iterator over the contained bonds. More...
 
typedef Chem::BasicMolecule::ConstBondIterator ConstBondIterator
 A constant iterator over the contained bonds. More...
 
typedef std::vector< const Chem::Atom * > AtomMapping
 Maps each atom of the fragment (in canonical order) to the corresponding atom of the parent molecular graph. More...
 
- Public Types inherited from CDPL::Chem::MolecularGraph
typedef std::shared_ptr< MolecularGraphSharedPointer
 A reference-counted smart pointer [SHPTR] for dynamically allocated MolecularGraph instances. More...
 
- Public Types inherited from CDPL::Chem::AtomContainer
typedef Util::IndexedElementIterator< const Atom, ConstAtomAccessor > ConstAtomIterator
 A constant random access iterator used to iterate over the stored const Chem::Atom objects. More...
 
typedef Util::IndexedElementIterator< Atom, AtomAccessor > AtomIterator
 A mutable random access iterator used to iterate over the stored Chem::Atom objects. More...
 
- Public Types inherited from CDPL::Chem::Entity3DContainer
typedef Util::IndexedElementIterator< const Entity3D, ConstEntityAccessor > ConstEntityIterator
 A constant random access iterator used to iterate over the stored const Chem::Entity3D objects. More...
 
typedef Util::IndexedElementIterator< Entity3D, EntityAccessor > EntityIterator
 A mutable random access iterator used to iterate over the stored Chem::Entity3D objects. More...
 
- Public Types inherited from CDPL::Chem::BondContainer
typedef Util::IndexedElementIterator< const Bond, ConstBondAccessor > ConstBondIterator
 A constant random access iterator used to iterate over the stored const Chem::Bond objects. More...
 
typedef Util::IndexedElementIterator< Bond, BondAccessor > BondIterator
 A mutable random access iterator used to iterate over the stored Chem::Bond objects. More...
 
- Public Types inherited from CDPL::Base::PropertyContainer
typedef PropertyMap::value_type PropertyEntry
 A Base::LookupKey / Base::Any pair that stores the property value for a given property key. More...
 
typedef PropertyMap::const_iterator ConstPropertyIterator
 A constant iterator used to iterate over the property entries. More...
 

Public Member Functions

 CanonicalFragment ()
 Constructs an empty CanonicalFragment instance. More...
 
 CanonicalFragment (const Chem::MolecularGraph &molgraph, const Chem::MolecularGraph &parent)
 Constructs a CanonicalFragment instance from the fragment molgraph of the parent molecular graph parent. More...
 
 CanonicalFragment (const CanonicalFragment &frag)
 Constructs a copy of the CanonicalFragment instance frag. More...
 
void clear ()
 Removes all atoms and bonds and resets the hash code. More...
 
std::size_t getNumAtoms () const
 Returns the number of atoms in the fragment. More...
 
const Chem::AtomgetAtom (std::size_t idx) const
 Returns a const reference to the atom at index idx. More...
 
Chem::AtomgetAtom (std::size_t idx)
 Returns a reference to the atom at index idx. More...
 
ConstAtomIterator getAtomsBegin () const
 Returns a constant iterator pointing to the first atom. More...
 
ConstAtomIterator getAtomsEnd () const
 Returns a constant iterator pointing one past the last atom. More...
 
AtomIterator getAtomsBegin ()
 Returns a mutable iterator pointing to the first atom. More...
 
AtomIterator getAtomsEnd ()
 Returns a mutable iterator pointing one past the last atom. More...
 
bool containsAtom (const Chem::Atom &atom) const
 Tells whether the fragment contains atom. More...
 
std::size_t getAtomIndex (const Chem::Atom &atom) const
 Returns the index of atom in the fragment. More...
 
std::size_t getNumEntities () const
 Returns the number of 3D entities in the fragment. More...
 
const Chem::Entity3DgetEntity (std::size_t idx) const
 Returns a const reference to the 3D entity at index idx. More...
 
Chem::Entity3DgetEntity (std::size_t idx)
 Returns a reference to the 3D entity at index idx. More...
 
std::size_t getNumBonds () const
 Returns the number of bonds in the fragment. More...
 
const Chem::BondgetBond (std::size_t idx) const
 Returns a const reference to the bond at index idx. More...
 
Chem::BondgetBond (std::size_t idx)
 Returns a reference to the bond at index idx. More...
 
ConstBondIterator getBondsBegin () const
 Returns a constant iterator pointing to the first bond. More...
 
ConstBondIterator getBondsEnd () const
 Returns a constant iterator pointing one past the last bond. More...
 
BondIterator getBondsBegin ()
 Returns a mutable iterator pointing to the first bond. More...
 
BondIterator getBondsEnd ()
 Returns a mutable iterator pointing one past the last bond. More...
 
bool containsBond (const Chem::Bond &bond) const
 Tells whether the fragment contains bond. More...
 
std::size_t getBondIndex (const Chem::Bond &bond) const
 Returns the index of bond in the fragment. More...
 
void orderAtoms (const Chem::AtomCompareFunction &func)
 Reorders the atoms of the fragment according to func. More...
 
void orderBonds (const Chem::BondCompareFunction &func)
 Reorders the bonds of the fragment according to func. More...
 
std::uint64_t getHashCode () const
 Returns the hash code of the fragment. More...
 
Chem::MolecularGraph::SharedPointer clone () const
 Creates and returns a deep copy of the fragment. More...
 
CanonicalFragmentoperator= (const CanonicalFragment &frag)
 Replaces the contents of this fragment with a copy of frag. More...
 
void create (const Chem::MolecularGraph &molgraph, const 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...
 
const AtomMappinggetAtomMapping () const
 Returns the atom mapping from this fragment to the parent molecular graph. More...
 
void perceiveSSSR ()
 Perceives the smallest set of smallest rings of the fragment. More...
 
- Public Member Functions inherited from CDPL::Chem::MolecularGraph
virtual ~MolecularGraph ()
 Virtual destructor. More...
 
- Public Member Functions inherited from CDPL::Chem::AtomContainer
ConstAtomIterator getAtomsBegin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Atom objects. More...
 
ConstAtomIterator getAtomsEnd () const
 Returns a constant iterator pointing to the end of the stored const Chem::Atom objects. More...
 
AtomIterator getAtomsBegin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Atom objects. More...
 
AtomIterator getAtomsEnd ()
 Returns a mutable iterator pointing to the end of the stored Chem::Atom objects. More...
 
ConstAtomIterator begin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Atom objects. More...
 
ConstAtomIterator end () const
 Returns a constant iterator pointing to the end of the stored const Chem::Atom objects. More...
 
AtomIterator begin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Atom objects. More...
 
AtomIterator end ()
 Returns a mutable iterator pointing to the end of the stored Chem::Atom objects. More...
 
const AtomContainergetAtoms () const
 Returns a const reference to itself. More...
 
AtomContainergetAtoms ()
 Returns a reference to itself. More...
 
- Public Member Functions inherited from CDPL::Chem::Entity3DContainer
ConstEntityIterator getEntitiesBegin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Entity3D objects. More...
 
ConstEntityIterator getEntitiesEnd () const
 Returns a constant iterator pointing to the end of the stored const Chem::Entity3D objects. More...
 
EntityIterator getEntitiesBegin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Entity3D objects. More...
 
EntityIterator getEntitiesEnd ()
 Returns a mutable iterator pointing to the end of the stored Chem::Entity3D objects. More...
 
ConstEntityIterator begin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Entity3D objects. More...
 
ConstEntityIterator end () const
 Returns a constant iterator pointing to the end of the stored const Chem::Entity3D objects. More...
 
EntityIterator begin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Entity3D objects. More...
 
EntityIterator end ()
 Returns a mutable iterator pointing to the end of the stored Chem::Entity3D objects. More...
 
const Entity3DContainergetEntities () const
 Returns a const reference to itself. More...
 
Entity3DContainergetEntities ()
 Returns a reference to itself. More...
 
- Public Member Functions inherited from CDPL::Chem::BondContainer
ConstBondIterator getBondsBegin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Bond objects. More...
 
ConstBondIterator getBondsEnd () const
 Returns a constant iterator pointing to the end of the stored const Chem::Bond objects. More...
 
BondIterator getBondsBegin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Bond objects. More...
 
BondIterator getBondsEnd ()
 Returns a mutable iterator pointing to the end of the stored Chem::Bond objects. More...
 
ConstBondIterator begin () const
 Returns a constant iterator pointing to the beginning of the stored const Chem::Bond objects. More...
 
ConstBondIterator end () const
 Returns a constant iterator pointing to the end of the stored const Chem::Bond objects. More...
 
BondIterator begin ()
 Returns a mutable iterator pointing to the beginning of the stored Chem::Bond objects. More...
 
BondIterator end ()
 Returns a mutable iterator pointing to the end of the stored Chem::Bond objects. More...
 
const BondContainergetBonds () const
 Returns a const reference to itself. More...
 
BondContainergetBonds ()
 Returns a reference to itself. More...
 
- Public Member Functions inherited from CDPL::Base::PropertyContainer
std::size_t getNumProperties () const
 Returns the number of property entries. More...
 
template<typename T >
void setProperty (const LookupKey &key, T &&val)
 Sets the value of the property specified by key to val. More...
 
template<typename T >
const T & getProperty (const LookupKey &key) const
 Returns the value of the property specified by key as a const reference to an object of type T. More...
 
template<typename T >
const T & getPropertyOrDefault (const LookupKey &key, const T &def_val) const
 Returns the value of the property specified by key as a const reference to an object of type T, or the default value def_val if a stored value does not exist. More...
 
const AnygetProperty (const LookupKey &key, bool throw_=false) const
 Returns the value of the property specified by key. More...
 
bool isPropertySet (const LookupKey &key) const
 Tells whether or not a value has been assigned to the property specified by key. More...
 
ConstPropertyIterator getPropertiesBegin () const
 Returns a constant iterator pointing to the beginning of the property entries. More...
 
ConstPropertyIterator getPropertiesEnd () const
 Returns a constant iterator pointing to the end of the property entries. More...
 
ConstPropertyIterator begin () const
 Returns a constant iterator pointing to the beginning of the property entries. More...
 
ConstPropertyIterator end () const
 Returns a constant iterator pointing to the end of the property entries. More...
 
bool removeProperty (const LookupKey &key)
 Clears the value of the property specified by key. More...
 
void clearProperties ()
 Clears all property values. More...
 
void addProperties (const PropertyContainer &cntnr)
 Adds the property value entries in the PropertyContainer instance cntnr. More...
 
void copyProperties (const PropertyContainer &cntnr)
 Replaces the current set of properties by a copy of the entries in cntnr. More...
 
void swap (PropertyContainer &cntnr)
 Exchanges the properties of this container with the properties of the container cntnr. More...
 
const PropertyContainergetProperties () const
 Returns a const reference to itself. More...
 

Additional Inherited Members

- Protected Member Functions inherited from CDPL::Chem::MolecularGraph
MolecularGraphoperator= (const MolecularGraph &molgraph)
 Assignment operator. More...
 
- Protected Member Functions inherited from CDPL::Chem::AtomContainer
virtual ~AtomContainer ()
 Virtual destructor. More...
 
AtomContaineroperator= (const AtomContainer &cntnr)
 Assignment operator. More...
 
- Protected Member Functions inherited from CDPL::Chem::Entity3DContainer
virtual ~Entity3DContainer ()
 Virtual destructor. More...
 
Entity3DContaineroperator= (const Entity3DContainer &cntnr)
 Assignment operator. More...
 
- Protected Member Functions inherited from CDPL::Chem::BondContainer
virtual ~BondContainer ()
 Virtual destructor. More...
 
BondContaineroperator= (const BondContainer &cntnr)
 Assignment operator. More...
 
- Protected Member Functions inherited from CDPL::Base::PropertyContainer
 PropertyContainer ()
 Constructs an empty PropertyContainer instance. More...
 
 PropertyContainer (const PropertyContainer &cntnr)
 Constructs a copy of the PropertyContainer instance cntnr. More...
 
virtual ~PropertyContainer ()
 Virtual destructor. More...
 
PropertyContaineroperator= (const PropertyContainer &cntnr)
 Assignment operator. More...
 

Detailed Description

Data structure representing a canonicalized molecular fragment.

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

Member Typedef Documentation

◆ SharedPointer

A reference-counted smart pointer [SHPTR] for dynamically allocated CanonicalFragment instances.

◆ AtomIterator

A mutable iterator over the contained atoms.

◆ ConstAtomIterator

A constant iterator over the contained atoms.

◆ BondIterator

A mutable iterator over the contained bonds.

◆ ConstBondIterator

A constant iterator over the contained bonds.

◆ AtomMapping

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

Constructor & Destructor Documentation

◆ CanonicalFragment() [1/3]

CDPL::ConfGen::CanonicalFragment::CanonicalFragment ( )

Constructs an empty CanonicalFragment instance.

◆ CanonicalFragment() [2/3]

CDPL::ConfGen::CanonicalFragment::CanonicalFragment ( const Chem::MolecularGraph molgraph,
const 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.

◆ CanonicalFragment() [3/3]

CDPL::ConfGen::CanonicalFragment::CanonicalFragment ( const CanonicalFragment frag)

Constructs a copy of the CanonicalFragment instance frag.

Parameters
fragThe CanonicalFragment to copy.

Member Function Documentation

◆ clear()

void CDPL::ConfGen::CanonicalFragment::clear ( )

Removes all atoms and bonds and resets the hash code.

◆ getNumAtoms()

std::size_t CDPL::ConfGen::CanonicalFragment::getNumAtoms ( ) const
virtual

Returns the number of atoms in the fragment.

Returns
The number of atoms.

Implements CDPL::Chem::AtomContainer.

◆ getAtom() [1/2]

const Chem::Atom& CDPL::ConfGen::CanonicalFragment::getAtom ( std::size_t  idx) const
virtual

Returns a const reference to the atom at index idx.

Parameters
idxThe index of the atom.
Returns
A const reference to the atom.

Implements CDPL::Chem::AtomContainer.

◆ getAtom() [2/2]

Chem::Atom& CDPL::ConfGen::CanonicalFragment::getAtom ( std::size_t  idx)
virtual

Returns a reference to the atom at index idx.

Parameters
idxThe index of the atom.
Returns
A reference to the atom.

Implements CDPL::Chem::AtomContainer.

◆ getAtomsBegin() [1/2]

ConstAtomIterator CDPL::ConfGen::CanonicalFragment::getAtomsBegin ( ) const

Returns a constant iterator pointing to the first atom.

Returns
A constant iterator pointing to the first atom.

◆ getAtomsEnd() [1/2]

ConstAtomIterator CDPL::ConfGen::CanonicalFragment::getAtomsEnd ( ) const

Returns a constant iterator pointing one past the last atom.

Returns
A constant iterator pointing one past the last atom.

◆ getAtomsBegin() [2/2]

AtomIterator CDPL::ConfGen::CanonicalFragment::getAtomsBegin ( )

Returns a mutable iterator pointing to the first atom.

Returns
A mutable iterator pointing to the first atom.

◆ getAtomsEnd() [2/2]

AtomIterator CDPL::ConfGen::CanonicalFragment::getAtomsEnd ( )

Returns a mutable iterator pointing one past the last atom.

Returns
A mutable iterator pointing one past the last atom.

◆ containsAtom()

bool CDPL::ConfGen::CanonicalFragment::containsAtom ( const Chem::Atom atom) const
virtual

Tells whether the fragment contains atom.

Parameters
atomThe atom to look up.
Returns
true if the atom is part of the fragment, and false otherwise.

Implements CDPL::Chem::AtomContainer.

◆ getAtomIndex()

std::size_t CDPL::ConfGen::CanonicalFragment::getAtomIndex ( const Chem::Atom atom) const
virtual

Returns the index of atom in the fragment.

Parameters
atomThe atom whose index is requested.
Returns
The index of the atom.

Implements CDPL::Chem::AtomContainer.

◆ getNumEntities()

std::size_t CDPL::ConfGen::CanonicalFragment::getNumEntities ( ) const
virtual

Returns the number of 3D entities in the fragment.

Returns
The number of 3D entities (equal to getNumAtoms()).

Reimplemented from CDPL::Chem::AtomContainer.

◆ getEntity() [1/2]

const Chem::Entity3D& CDPL::ConfGen::CanonicalFragment::getEntity ( std::size_t  idx) const
virtual

Returns a const reference to the 3D entity at index idx.

Parameters
idxThe index of the entity.
Returns
A const reference to the entity.

Reimplemented from CDPL::Chem::AtomContainer.

◆ getEntity() [2/2]

Chem::Entity3D& CDPL::ConfGen::CanonicalFragment::getEntity ( std::size_t  idx)
virtual

Returns a reference to the 3D entity at index idx.

Parameters
idxThe index of the entity.
Returns
A reference to the entity.

Reimplemented from CDPL::Chem::AtomContainer.

◆ getNumBonds()

std::size_t CDPL::ConfGen::CanonicalFragment::getNumBonds ( ) const
virtual

Returns the number of bonds in the fragment.

Returns
The number of bonds.

Implements CDPL::Chem::BondContainer.

◆ getBond() [1/2]

const Chem::Bond& CDPL::ConfGen::CanonicalFragment::getBond ( std::size_t  idx) const
virtual

Returns a const reference to the bond at index idx.

Parameters
idxThe index of the bond.
Returns
A const reference to the bond.

Implements CDPL::Chem::BondContainer.

◆ getBond() [2/2]

Chem::Bond& CDPL::ConfGen::CanonicalFragment::getBond ( std::size_t  idx)
virtual

Returns a reference to the bond at index idx.

Parameters
idxThe index of the bond.
Returns
A reference to the bond.

Implements CDPL::Chem::BondContainer.

◆ getBondsBegin() [1/2]

ConstBondIterator CDPL::ConfGen::CanonicalFragment::getBondsBegin ( ) const

Returns a constant iterator pointing to the first bond.

Returns
A constant iterator pointing to the first bond.

◆ getBondsEnd() [1/2]

ConstBondIterator CDPL::ConfGen::CanonicalFragment::getBondsEnd ( ) const

Returns a constant iterator pointing one past the last bond.

Returns
A constant iterator pointing one past the last bond.

◆ getBondsBegin() [2/2]

BondIterator CDPL::ConfGen::CanonicalFragment::getBondsBegin ( )

Returns a mutable iterator pointing to the first bond.

Returns
A mutable iterator pointing to the first bond.

◆ getBondsEnd() [2/2]

BondIterator CDPL::ConfGen::CanonicalFragment::getBondsEnd ( )

Returns a mutable iterator pointing one past the last bond.

Returns
A mutable iterator pointing one past the last bond.

◆ containsBond()

bool CDPL::ConfGen::CanonicalFragment::containsBond ( const Chem::Bond bond) const
virtual

Tells whether the fragment contains bond.

Parameters
bondThe bond to look up.
Returns
true if the bond is part of the fragment, and false otherwise.

Implements CDPL::Chem::BondContainer.

◆ getBondIndex()

std::size_t CDPL::ConfGen::CanonicalFragment::getBondIndex ( const Chem::Bond bond) const
virtual

Returns the index of bond in the fragment.

Parameters
bondThe bond whose index is requested.
Returns
The index of the bond.

Implements CDPL::Chem::BondContainer.

◆ orderAtoms()

void CDPL::ConfGen::CanonicalFragment::orderAtoms ( const Chem::AtomCompareFunction func)
virtual

Reorders the atoms of the fragment according to func.

Parameters
funcThe comparison function used to define the new atom order.

Implements CDPL::Chem::AtomContainer.

◆ orderBonds()

void CDPL::ConfGen::CanonicalFragment::orderBonds ( const Chem::BondCompareFunction func)
virtual

Reorders the bonds of the fragment according to func.

Parameters
funcThe comparison function used to define the new bond order.

Implements CDPL::Chem::BondContainer.

◆ getHashCode()

std::uint64_t CDPL::ConfGen::CanonicalFragment::getHashCode ( ) const

Returns the hash code of the fragment.

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

◆ clone()

Chem::MolecularGraph::SharedPointer CDPL::ConfGen::CanonicalFragment::clone ( ) const
virtual

Creates and returns a deep copy of the fragment.

Returns
A smart pointer to the cloned fragment.

Implements CDPL::Chem::MolecularGraph.

◆ operator=()

CanonicalFragment& CDPL::ConfGen::CanonicalFragment::operator= ( const CanonicalFragment frag)

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

Parameters
fragThe source CanonicalFragment.
Returns
A reference to itself.

◆ create()

void CDPL::ConfGen::CanonicalFragment::create ( const Chem::MolecularGraph molgraph,
const 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.

◆ getAtomMapping()

const AtomMapping& CDPL::ConfGen::CanonicalFragment::getAtomMapping ( ) const

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

Returns
A const reference to the atom mapping.

◆ perceiveSSSR()

void CDPL::ConfGen::CanonicalFragment::perceiveSSSR ( )

Perceives the smallest set of smallest rings of the fragment.


The documentation for this class was generated from the following file: