RDKit
Open-source cheminformatics and machine learning.
CIPLabeler.h
Go to the documentation of this file.
1 //
2 //
3 // Copyright (C) 2020 Schrödinger, LLC
4 //
5 // @@ All Rights Reserved @@
6 // This file is part of the RDKit.
7 // The contents are covered by the terms of the BSD license
8 // which is included in the file license.txt, found at the root
9 // of the RDKit source tree.
10 //
11 #pragma once
12 
13 #include <boost/dynamic_bitset.hpp>
14 
15 #include <RDGeneral/export.h>
16 
17 namespace RDKit {
18 
19 class ROMol;
20 
21 namespace CIPLabeler_detail {
23 }
24 
25 namespace CIPLabeler {
26 
27 /*
28  Some very symmetrical mols can cause pseudo infinite processing
29  (e.g. dodecahedrane)
30  To avoid this a maxinum number of iterations can be set by the caller as a
31  parameter to assignCIPLabels.
32  If that maximum value is exceeded, the following error is thrown
33 */
34 
36  : public std::runtime_error {
37  public:
39  : std::runtime_error(
40  "Max Iterations Exceeded in CIP label calculation"){};
41 };
42 
43 /**
44  * Calculate Stereochemical labels based on an accurate implementation
45  * of the CIP rules.
46  *
47  * This is a C++ port of https://github.com/SiMolecule/centres, which was
48  * originally written by John Mayfield in Java. The original algorithm was
49  * described in:
50  *
51  * Hanson, R. M., Musacchio, S., Mayfield, J. W., Vainio, M. J., Yerin, A.,
52  * Redkin, D. Algorithmic Analysis of Cahn--Ingold--Prelog Rules of
53  * Stereochemistry: Proposals for Revised Rules and a Guide for Machine
54  * Implementation. J. Chem. Inf. Model. 2018, 58, 1755-1765.
55  *
56  * \param mol - the molecule to be labelled.
57  *
58  * \note only atoms with chiral tags and double bonds with proper
59  * bond directions will be labelled.
60  * \note Labels will be stored under the common_properties::_CIPCode
61  * property of the relevant atoms/bonds.
62  */
64  ROMol &mol, unsigned int maxRecursiveIterations = 0);
65 
66 /**
67  * Overload that allows selecting which atoms and/or bonds will be labeled.
68  *
69  * \param mol - the molecule to be labelled.
70  *
71  * \param atoms - bitset with the atom indexes to be labeled.
72  *
73  * \param bonds - bitset with the bond indexes to be labeled.
74  *
75  * \param maxRecursiveIterations - maximum number of iterations
76  * A value of 1,250,000 take about 1 second. Most structures requires
77  * less than 10,000 iterations. A peptide with MW~3000 took about
78  * 100 iterations, and a 20,000 mw protein took about 600 iterations.
79  *
80  */
82  ROMol &mol, const boost::dynamic_bitset<> &atoms,
83  const boost::dynamic_bitset<> &bonds,
84  unsigned int maxRecursiveIterations = 0);
85 
86 } // namespace CIPLabeler
87 } // namespace RDKit
#define RDKIT_CIPLABELER_EXPORT
Definition: export.h:33
RDKIT_CIPLABELER_EXPORT bool decrementRemainingCallCountAndCheck()
RDKIT_CIPLABELER_EXPORT void assignCIPLabels(ROMol &mol, unsigned int maxRecursiveIterations=0)
Std stuff.
Definition: Abbreviations.h:19