Loading...
Searching...
No Matches
RDKit::Canon Namespace Reference

## Namespaces

namespace | detail

## Classes

union | MolStackUnion
| used to store components in the molecular stack More...
class | MolStackElem
| these are the actual elements in the molecular stack More...
struct | bondholder
struct | canon_atom
class | SpecialChiralityAtomCompareFunctor
class | SpecialSymmetryAtomCompareFunctor
class | AtomCompareFunctor
class | ChiralAtomCompareFunctor

## Typedefs

typedef std::vector< MolStackElem > | MolStack
typedef std::tuple< int, int, Bond * > | PossibleType
| used to represent possible branches from an atom

## Enumerations

enum | AtomColors { WHITE_NODE = 0 , GREY_NODE , BLACK_NODE }
| used in traversals of the molecule More...
enum | MolStackTypes { MOL_STACK_ATOM = 0 , MOL_STACK_BOND , MOL_STACK_RING , MOL_STACK_BRANCH_OPEN , MOL_STACK_BRANCH_CLOSE }
| used to indicate types of entries in the molecular stack: More...

## Functions

RDKIT_GRAPHMOL_EXPORT void | canonicalizeFragment (ROMol &mol, int atomIdx, std::vector< AtomColors > &colors, const std::vector< unsigned int > &ranks, MolStack &molStack, const boost::dynamic_bitset<> *bondsInPlay=nullptr, const std::vector< std::string > *bondSymbols=nullptr, bool doIsomericSmiles=false, bool doRandom=false, bool doChiralInversions=true)
| constructs the canonical traversal order for a molecular fragment
RDKIT_GRAPHMOL_EXPORT void | canonicalizeFragment (ROMol &mol, int atomIdx, std::vector< AtomColors > &colors, const std::vector< unsigned int > &ranks, MolStack &molStack, const boost::dynamic_bitset<> *atomsInPlay, const boost::dynamic_bitset<> *bondsInPlay, const std::vector< std::string > *bondSymbols=nullptr, bool doIsomericSmiles=false, bool doRandom=false, bool doChiralInversions=true)
RDKIT_GRAPHMOL_EXPORT bool | chiralAtomNeedsTagInversion (const RDKit::ROMol &mol, const RDKit::Atom *atom, bool isAtomFirst, size_t numClosures)
RDKIT_GRAPHMOL_EXPORT void | canonicalizeEnhancedStereo (ROMol &mol, const std::vector< unsigned int > *atomRanks=nullptr)
| Canonicalizes the atom stereo labels in enhanced stereo groups.
RDKIT_GRAPHMOL_EXPORT void | updateAtomNeighborIndex (canon_atom *atoms, std::vector< bondholder > &nbrs)
RDKIT_GRAPHMOL_EXPORT void | updateAtomNeighborNumSwaps (canon_atom *atoms, std::vector< bondholder > &nbrs, unsigned int atomIdx, std::vector< std::pair< unsigned int, unsigned int > > &result)
template<typename CompareFunc>
void | RefinePartitions (const ROMol &mol, canon_atom *atoms, CompareFunc compar, int mode, std::vector< int > &order, std::vector< int > &count, int &activeset, std::vector< int > &next, std::vector< int > &changed, std::vector< char > &touchedPartitions)
template<typename CompareFunc>
void | BreakTies (const ROMol &mol, canon_atom *atoms, CompareFunc compar, int mode, std::vector< int > &order, std::vector< int > &count, int &activeset, std::vector< int > &next, std::vector< int > &changed, std::vector< char > &touchedPartitions)
RDKIT_GRAPHMOL_EXPORT void | CreateSinglePartition (unsigned int nAtoms, std::vector< int > &order, std::vector< int > &count, canon_atom *atoms)
RDKIT_GRAPHMOL_EXPORT void | ActivatePartitions (unsigned int nAtoms, std::vector< int > &order, std::vector< int > &count, int &activeset, std::vector< int > &next, std::vector< int > &changed)
RDKIT_GRAPHMOL_EXPORT void | rankMolAtoms (const ROMol &mol, std::vector< unsigned int > &res, bool breakTies=true, bool includeChirality=true, bool includeIsotopes=true, bool includeAtomMaps=true, bool includeChiralPresence=false, bool includeStereoGroups=true, bool useNonStereoRanks=false, bool includeRingStereo=true)
| Note that atom maps on dummy atoms will always be used.

RDKIT_GRAPHMOL_EXPORT void

rankFragmentAtoms (const ROMol &mol, std::vector< unsigned int > &res, const boost::dynamic_bitset<> &atomsInPlay, const boost::dynamic_bitset<> &bondsInPlay, const std::vector< std::string > *atomSymbols, const std::vector< std::string > *bondSymbols, bool breakTies, bool includeChirality, bool includeIsotope, bool includeAtomMaps, bool includeChiralPresence, bool includeRingStereo=true)

| Note that atom maps on dummy atoms will always be used.
void | rankFragmentAtoms (const ROMol &mol, std::vector< unsigned int > &res, const boost::dynamic_bitset<> &atomsInPlay, const boost::dynamic_bitset<> &bondsInPlay, const std::vector< std::string > *atomSymbols=nullptr, bool breakTies=true, bool includeChirality=true, bool includeIsotopes=true, bool includeAtomMaps=true, bool includeChiralPresence=false, bool includeRingStereo=true)
| Note that atom maps on dummy atoms will always be used.
RDKIT_GRAPHMOL_EXPORT void | chiralRankMolAtoms (const ROMol &mol, std::vector< unsigned int > &res)
RDKIT_GRAPHMOL_EXPORT void | initCanonAtoms (const ROMol &mol, std::vector< Canon::canon_atom > &atoms, bool includeChirality=true, bool includeStereoGroups=true)

## Variables

constexpr int | MAX_NATOMS = 5000
| used in the canonical traversal code
constexpr int | MAX_CYCLES = 1024
| used in the canonical traversal code
constexpr int | MAX_BONDTYPE = 32
| used in the canonical traversal code
const unsigned int | ATNUM_CLASS_OFFSET = 10000

## Typedef Documentation

## MolStack

typedef std::vector<MolStackElem> RDKit::Canon::MolStack

Definition at line 90 of file Canon.h.

## PossibleType

typedef std::tuple<int, int, Bond *> RDKit::Canon::PossibleType

used to represent possible branches from an atom

Definition at line 93 of file Canon.h.

## Enumeration Type Documentation

## AtomColors

enum RDKit::Canon::AtomColors

used in traversals of the molecule

Enumerator
WHITE_NODE | not visited
GREY_NODE | visited, but not finished
BLACK_NODE | visited and finished

Definition at line 25 of file Canon.h.

## MolStackTypes

enum RDKit::Canon::MolStackTypes

used to indicate types of entries in the molecular stack:

Enumerator
MOL_STACK_ATOM | an Atom
MOL_STACK_BOND | a Bond
MOL_STACK_RING | a ring closure
MOL_STACK_BRANCH_OPEN | beginning of a branch
MOL_STACK_BRANCH_CLOSE | end of a branch

Definition at line 32 of file Canon.h.

## Function Documentation

## ActivatePartitions()

RDKIT_GRAPHMOL_EXPORT void RDKit::Canon::ActivatePartitions | ( | unsigned int | nAtoms,
|  | std::vector< int > & | order,
|  | std::vector< int > & | count,
|  | int & | activeset,
|  | std::vector< int > & | next,
|  | std::vector< int > & | changed )

References RDKIT_GRAPHMOL_EXPORT.

## BreakTies()

template<typename CompareFunc>

void RDKit::Canon::BreakTies | ( | const ROMol & | mol,
|  | canon_atom * | atoms,
|  | CompareFunc | compar,
|  | int | mode,
|  | std::vector< int > & | order,
|  | std::vector< int > & | count,
|  | int & | activeset,
|  | std::vector< int > & | next,
|  | std::vector< int > & | changed,
|  | std::vector< char > & | touchedPartitions )

Definition at line 794 of file new_canon.h.

References RDKit::Canon::canon_atom::degree, RDKit::ROMol::getNumAtoms(), RDKit::Canon::canon_atom::index, RDKit::Canon::canon_atom::nbrIds, and RefinePartitions().

## canonicalizeEnhancedStereo()

RDKIT_GRAPHMOL_EXPORT void RDKit::Canon::canonicalizeEnhancedStereo | ( | ROMol & | mol,
|  | const std::vector< unsigned int > * | atomRanks = nullptr )

Canonicalizes the atom stereo labels in enhanced stereo groups.

For example, after calling this function the chiral centers in the molecules C[C@H](F)Cl |&1:1| and C[C@@H](F)Cl |&1:1| will have the same chiral tags.

References RDKIT_GRAPHMOL_EXPORT.

## canonicalizeFragment() [1/2]

RDKIT_GRAPHMOL_EXPORT void RDKit::Canon::canonicalizeFragment | ( | ROMol & | mol,
|  | int | atomIdx,
|  | std::vector< AtomColors > & | colors,
|  | const std::vector< unsigned int > & | ranks,
|  | MolStack & | molStack,
|  | const boost::dynamic_bitset<> * | atomsInPlay,
|  | const boost::dynamic_bitset<> * | bondsInPlay,
|  | const std::vector< std::string > * | bondSymbols = nullptr,
|  | bool | doIsomericSmiles = false,
|  | bool | doRandom = false,
|  | bool | doChiralInversions = true )

References RDKIT_GRAPHMOL_EXPORT.

## canonicalizeFragment() [2/2]

RDKIT_GRAPHMOL_EXPORT void RDKit::Canon::canonicalizeFragment | ( | ROMol & | mol,
|  | int | atomIdx,
|  | std::vector< AtomColors > & | colors,
|  | const std::vector< unsigned int > & | ranks,
|  | MolStack & | molStack,
|  | const boost::dynamic_bitset<> * | bondsInPlay = nullptr,
|  | const std::vector< std::string > * | bondSymbols = nullptr,
|  | bool | doIsomericSmiles = false,
|  | bool | doRandom = false,
|  | bool | doChiralInversions = true )

constructs the canonical traversal order for a molecular fragment

Parameters

  mol | the ROMol we're working on
  atomIdx | the index of the atom to start the traversal from
  colors | the traversal status of each atom in `mol`
  ranks | the assigned rank of each atom in `mol`
  molStack | the current traversal stack (used to return the results)

Notes

- `mol` will, in general, be modified by this operation as bond directions and the like are changed to fit the canonical traversal order

References RDKIT_GRAPHMOL_EXPORT.

## chiralAtomNeedsTagInversion()

RDKIT_GRAPHMOL_EXPORT bool RDKit::Canon::chiralAtomNeedsTagInversion | ( | const RDKit::ROMol & | mol,
|  | const RDKit::Atom * | atom,
|  | bool | isAtomFirst,
|  | size_t | numClosures )

Check if a chiral atom needs to have its tag flipped after reading or before writing SMILES

References RDKIT_GRAPHMOL_EXPORT.

## chiralRankMolAtoms()

RDKIT_GRAPHMOL_EXPORT void RDKit::Canon::chiralRankMolAtoms | ( | const ROMol & | mol,
|  | std::vector< unsigned int > & | res )

References RDKIT_GRAPHMOL_EXPORT.

## CreateSinglePartition()

RDKIT_GRAPHMOL_EXPORT void RDKit::Canon::CreateSinglePartition | ( | unsigned int | nAtoms,
|  | std::vector< int > & | order,
|  | std::vector< int > & | count,
|  | canon_atom * | atoms )

References RDKIT_GRAPHMOL_EXPORT.

## initCanonAtoms()

RDKIT_GRAPHMOL_EXPORT void RDKit::Canon::initCanonAtoms | ( | const ROMol & | mol,
|  | std::vector< Canon::canon_atom > & | atoms,
|  | bool | includeChirality = true,
|  | bool | includeStereoGroups = true )

References RDKIT_GRAPHMOL_EXPORT.

## rankFragmentAtoms() [1/2]

RDKIT_GRAPHMOL_EXPORT void RDKit::Canon::rankFragmentAtoms | ( | const ROMol & | mol,
|  | std::vector< unsigned int > & | res,
|  | const boost::dynamic_bitset<> & | atomsInPlay,
|  | const boost::dynamic_bitset<> & | bondsInPlay,
|  | const std::vector< std::string > * | atomSymbols,
|  | const std::vector< std::string > * | bondSymbols,
|  | bool | breakTies,
|  | bool | includeChirality,
|  | bool | includeIsotope,
|  | bool | includeAtomMaps,
|  | bool | includeChiralPresence,
|  | bool | includeRingStereo = true )

Note that atom maps on dummy atoms will always be used.

References RDKIT_GRAPHMOL_EXPORT.

Referenced by rankFragmentAtoms().

## rankFragmentAtoms() [2/2]

void RDKit::Canon::rankFragmentAtoms | ( | const ROMol & | mol,
|  | std::vector< unsigned int > & | res,
|  | const boost::dynamic_bitset<> & | atomsInPlay,
|  | const boost::dynamic_bitset<> & | bondsInPlay,
|  | const std::vector< std::string > * | atomSymbols = nullptr,
|  | bool | breakTies = true,
|  | bool | includeChirality = true,
|  | bool | includeIsotopes = true,
|  | bool | includeAtomMaps = true,
|  | bool | includeChiralPresence = false,
|  | bool | includeRingStereo = true )

inline

Note that atom maps on dummy atoms will always be used.

Definition at line 875 of file new_canon.h.

References rankFragmentAtoms().

## rankMolAtoms()

RDKIT_GRAPHMOL_EXPORT void RDKit::Canon::rankMolAtoms | ( | const ROMol & | mol,
|  | std::vector< unsigned int > & | res,
|  | bool | breakTies = true,
|  | bool | includeChirality = true,
|  | bool | includeIsotopes = true,
|  | bool | includeAtomMaps = true,
|  | bool | includeChiralPresence = false,
|  | bool | includeStereoGroups = true,
|  | bool | useNonStereoRanks = false,
|  | bool | includeRingStereo = true )

Note that atom maps on dummy atoms will always be used.

References RDKIT_GRAPHMOL_EXPORT.

## RefinePartitions()

template<typename CompareFunc>

void RDKit::Canon::RefinePartitions | ( | const ROMol & | mol,
|  | canon_atom * | atoms,
|  | CompareFunc | compar,
|  | int | mode,
|  | std::vector< int > & | order,
|  | std::vector< int > & | count,
|  | int & | activeset,
|  | std::vector< int > & | next,
|  | std::vector< int > & | changed,
|  | std::vector< char > & | touchedPartitions )

Definition at line 696 of file new_canon.h.

References RDKit::Canon::canon_atom::degree, RDKit::ROMol::getNumAtoms(), RDKit::hanoisort(), RDKit::Canon::canon_atom::index, and RDKit::Canon::canon_atom::nbrIds.

Referenced by BreakTies().

## updateAtomNeighborIndex()

RDKIT_GRAPHMOL_EXPORT void RDKit::Canon::updateAtomNeighborIndex | ( | canon_atom * | atoms,
|  | std::vector< bondholder > & | nbrs )

References RDKIT_GRAPHMOL_EXPORT.

Referenced by RDKit::Canon::AtomCompareFunctor::operator()(), RDKit::Canon::SpecialChiralityAtomCompareFunctor::operator()(), and RDKit::Canon::SpecialSymmetryAtomCompareFunctor::operator()().

## updateAtomNeighborNumSwaps()

RDKIT_GRAPHMOL_EXPORT void RDKit::Canon::updateAtomNeighborNumSwaps | ( | canon_atom * | atoms,
|  | std::vector< bondholder > & | nbrs,
|  | unsigned int | atomIdx,
|  | std::vector< std::pair< unsigned int, unsigned int > > & | result )

References RDKIT_GRAPHMOL_EXPORT.

Referenced by RDKit::Canon::SpecialChiralityAtomCompareFunctor::operator()().

## Variable Documentation

## ATNUM_CLASS_OFFSET

const unsigned int RDKit::Canon::ATNUM_CLASS_OFFSET = 10000

Definition at line 569 of file new_canon.h.

Referenced by RDKit::Canon::ChiralAtomCompareFunctor::operator()().

## MAX_BONDTYPE

int RDKit::Canon::MAX_BONDTYPE = 32

constexpr

used in the canonical traversal code

Definition at line 22 of file Canon.h.

## MAX_CYCLES

int RDKit::Canon::MAX_CYCLES = 1024

constexpr

used in the canonical traversal code

Definition at line 21 of file Canon.h.

## MAX_NATOMS

int RDKit::Canon::MAX_NATOMS = 5000

constexpr

used in the canonical traversal code

Definition at line 20 of file Canon.h.