RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
MolStandardize/Tautomer.h
Go to the documentation of this file.
1//
2// Copyright (C) 2018-2021 Susan H. Leung and other RDKit contributors
3//
4// @@ All Rights Reserved @@
5// This file is part of the RDKit.
6// The contents are covered by the terms of the BSD license
7// which is included in the file license.txt, found at the root
8// of the RDKit source tree.
9//
10#include <RDGeneral/export.h>
11#ifndef RD_TAUTOMER_H
12#define RD_TAUTOMER_H
13
14#include <boost/function.hpp>
15#include <iterator>
16#include <memory>
17#include <string>
18#include <utility>
19#include <Catalogs/Catalog.h>
20#include <GraphMol/ROMol.h>
25#include <boost/dynamic_bitset.hpp>
26
27namespace RDKit {
28class ROMol;
29class RWMol;
30
31namespace MolStandardize {
32
33typedef RDCatalog::HierarchCatalog<TautomerCatalogEntry, TautomerCatalogParams,
34 int>
36
38const std::string tautomerScoringVersion = "1.0.0";
39
40//! The SubstructTerm controls how Tautomers are generated
41/// Each Term is defined by a name, smarts pattern and score
42/// For example, the C=O term is defined as
43/// SubstructTerm("C=O", "[#6]=,:[#8]", 2)
44/// This gets a score of +2 for each Carbon doubly or aromatically
45/// Bonded to an Oxygen.
46/// For a list of current definitions, see getDefaultTautomerScoreSubstructs
48 std::string name;
49 std::string smarts;
50 int score;
51 RWMol matcher; // requires assignment
52
53 // Pre-screening support: elements that must be present (empty = no filter)
54 std::vector<int> requiredElements;
55 // Bond-order-agnostic connectivity pattern for pre-screening (may be empty)
56 std::string connectivitySmarts;
58
59 SubstructTerm(std::string aname, std::string asmarts, int ascore,
60 std::vector<int> reqElements = {}, std::string connSmarts = "");
61 SubstructTerm(const SubstructTerm &rhs) = default;
62 SubstructTerm &operator=(const SubstructTerm &rhs) = default;
63
64 bool operator==(const SubstructTerm &rhs) const {
65 return name == rhs.name && smarts == rhs.smarts && score == rhs.score;
66 }
67};
68
69//! getDefaultTautomerSubstructs returns the SubstructTerms used in scoring
70/// tautomer forms. See SubstructTerm for details.
71RDKIT_MOLSTANDARDIZE_EXPORT const std::vector<SubstructTerm> &
73
74//! Score the rings of the current tautomer
75/// Aromatic rings score 100, all carbon aromatic rings score 250
76/*!
77 \param mol Molcule to score
78 \returns integer score for the molecule's rings
79*/
81
82//! scoreSubstructs scores the molecule based on the substructure definitions
83/*!
84 \param mol Molecule to score
85 \param terms Substruct Terms used for scoring this particular tautomer form
86 \returns integer score for the molecule's substructure terms
87*/
89 const ROMol &mol, const std::vector<SubstructTerm> &terms =
91
92//! Determine which SubstructTerms are potentially relevant for a molecule.
93/// This pre-filters terms in two stages:
94/// 1. Element check: skip terms requiring elements not in the molecule
95/// 2. Connectivity check: skip terms whose bond-order-agnostic pattern
96/// doesn't match (since tautomerization doesn't create/destroy bonds)
97/// Returns indices into the terms vector for relevant terms.
99 const ROMol &mol, const std::vector<SubstructTerm> &terms =
101
102//! Score substructures using only the terms at the specified indices.
103/// Uses specialized matchers for simple patterns (C=O, N=O, P=O, methyl, etc.)
104/// and falls back to VF2 for complex patterns. Use with
105/// getRelevantSubstructTermIndices for efficient scoring of many tautomers
106/// from the same parent molecule.
108 const ROMol &mol, const std::vector<SubstructTerm> &terms,
109 const std::vector<size_t> &relevantIndices);
110//! scoreHeteroHs score the molecules hydrogens
111/// This gives a negative penalty to hydrogens attached to S,P, Se and Te
112/*!
113 \param mol Molecule to score
114 \returns integer score for the molecule hetero hydrogens
115*/
117
118inline int scoreTautomer(const ROMol &mol) {
119 return scoreRings(mol) + scoreSubstructs(mol) + scoreHeteroHs(mol);
120}
121
122//! Create an optimized scoring function for tautomers of a specific molecule.
123/// This pre-filters SubstructTerms based on elements and connectivity present
124/// in the input molecule, avoiding unnecessary substructure searches for
125/// patterns that can never match any tautomer of this molecule.
126/// The returned function captures the filtered term indices and can be passed
127/// to pickCanonical or canonicalize.
128inline boost::function<int(const ROMol &)> makeOptimizedScorer(
129 const ROMol &mol) {
130 auto relevantIndices = getRelevantSubstructTermIndices(mol);
131 // Capture by value since the indices are small and we want the lambda to
132 // outlive this function.
133 return [relevantIndices](const ROMol &taut) {
134 const auto &terms = getDefaultTautomerScoreSubstructs();
135 return scoreRings(taut) +
136 scoreSubstructsFiltered(taut, terms, relevantIndices) +
137 scoreHeteroHs(taut);
138 };
139}
140} // namespace TautomerScoringFunctions
141
142namespace detail {
143//! Number of explicitly specified stereo descriptors on a molecule.
144/*!
145 Used only to break score ties when picking the canonical tautomer, where a
146 lexicographic comparison of SMILES would otherwise be systematically biased
147 against stereochemistry.
148*/
149inline unsigned int countSpecifiedStereo(const ROMol &mol) {
150 unsigned int nSpecified = 0;
151 for (const auto atom : mol.atoms()) {
152 // CHI_UNSPECIFIED is the only "none" value on the atom side; ChiralType has
153 // no analogue of STEREOANY, so a simple inequality is right here.
154 if (atom->getChiralTag() != Atom::CHI_UNSPECIFIED) {
155 ++nSpecified;
156 }
157 }
158 for (const auto bond : mol.bonds()) {
159 // STEREOANY is *intentionally unspecified*, not retained stereochemistry,
160 // and getClearedTautomerBondStereo() assigns it to cleared acyclic double
161 // bonds, so counting it would let a tautomer win a tie on unknown stereo.
162 // The enum is ordered so that "> STEREOANY" is the idiomatic test; see
163 // Bond.h.
164 if (bond->getStereo() > Bond::STEREOANY) {
165 ++nSpecified;
166 }
167 }
168 return nSpecified;
169}
170} // namespace detail
171
178
179class Tautomer {
180 friend class TautomerEnumerator;
181
182 public:
183 Tautomer() : d_numModifiedAtoms(0), d_numModifiedBonds(0), d_done(false) {}
184 // Constructor with just the tautomer - kekulized form will be created lazily
185 Tautomer(ROMOL_SPTR t, size_t a = 0, size_t b = 0)
186 : tautomer(std::move(t)),
187 d_numModifiedAtoms(a),
188 d_numModifiedBonds(b),
189 d_done(false) {}
190 // Legacy constructor for compatibility
191 Tautomer(ROMOL_SPTR t, ROMOL_SPTR k, size_t a = 0, size_t b = 0)
192 : tautomer(std::move(t)),
193 kekulized(std::move(k)),
194 d_numModifiedAtoms(a),
195 d_numModifiedBonds(b),
196 d_done(false) {}
198 mutable ROMOL_SPTR kekulized; // Lazily initialized
199
200 // Get the kekulized form, creating it lazily if needed
201 const ROMOL_SPTR &getKekulized() const {
202 if (!kekulized && tautomer) {
203 kekulized.reset(new RWMol(*tautomer));
204 MolOps::Kekulize(static_cast<RWMol &>(*kekulized), false, true);
205 }
206 return kekulized;
207 }
208
209 private:
210 size_t d_numModifiedAtoms;
211 size_t d_numModifiedBonds;
212 bool d_done;
213};
214
215typedef std::map<std::string, Tautomer> SmilesTautomerMap;
216typedef std::pair<std::string, Tautomer> SmilesTautomerPair;
217
218//! Contains results of tautomer enumeration
220 friend class TautomerEnumerator;
221
222 public:
224 public:
226 typedef std::ptrdiff_t difference_type;
227 typedef const ROMol *pointer;
228 typedef const ROMOL_SPTR &reference;
229 typedef std::bidirectional_iterator_tag iterator_category;
230
231 explicit const_iterator(const SmilesTautomerMap::const_iterator &it)
232 : d_it(it) {}
233 reference operator*() const { return d_it->second.tautomer; }
234 pointer operator->() const { return d_it->second.tautomer.get(); }
235 bool operator==(const const_iterator &other) const {
236 return (d_it == other.d_it);
237 }
238 bool operator!=(const const_iterator &other) const {
239 return !(*this == other);
240 }
242 const_iterator copy(d_it);
243 operator++();
244 return copy;
245 }
247 ++d_it;
248 return *this;
249 }
251 const_iterator copy(d_it);
252 operator--();
253 return copy;
254 }
256 --d_it;
257 return *this;
258 }
259
260 private:
261 SmilesTautomerMap::const_iterator d_it;
262 };
265 : d_tautomers(other.d_tautomers),
266 d_status(other.d_status),
267 d_modifiedAtoms(other.d_modifiedAtoms),
268 d_modifiedBonds(other.d_modifiedBonds) {
269 fillTautomersItVec();
270 }
271 const const_iterator begin() const {
272 return const_iterator(d_tautomers.begin());
273 }
274 const const_iterator end() const { return const_iterator(d_tautomers.end()); }
275 size_t size() const { return d_tautomers.size(); }
276 bool empty() const { return d_tautomers.empty(); }
277 const ROMOL_SPTR &at(size_t pos) const {
278 PRECONDITION(pos < d_tautomers.size(), "index out of bounds");
279 return d_tautomersItVec.at(pos)->second.tautomer;
280 }
281 const ROMOL_SPTR &operator[](size_t pos) const { return at(pos); }
282 const boost::dynamic_bitset<> &modifiedAtoms() const {
283 return d_modifiedAtoms;
284 }
285 const boost::dynamic_bitset<> &modifiedBonds() const {
286 return d_modifiedBonds;
287 }
288 TautomerEnumeratorStatus status() const { return d_status; }
289 std::vector<ROMOL_SPTR> tautomers() const {
290 std::vector<ROMOL_SPTR> tautomerVec;
291 tautomerVec.reserve(d_tautomers.size());
292 std::transform(
293 d_tautomers.begin(), d_tautomers.end(), std::back_inserter(tautomerVec),
294 [](const SmilesTautomerPair &t) { return t.second.tautomer; });
295 return tautomerVec;
296 }
297 std::vector<ROMOL_SPTR> operator()() const { return tautomers(); }
298 std::vector<std::string> smiles() const {
299 std::vector<std::string> smilesVec;
300 smilesVec.reserve(d_tautomers.size());
301 std::transform(d_tautomers.begin(), d_tautomers.end(),
302 std::back_inserter(smilesVec),
303 [](const SmilesTautomerPair &t) { return t.first; });
304 return smilesVec;
305 }
306 const SmilesTautomerMap &smilesTautomerMap() const { return d_tautomers; }
307
308 private:
309 void fillTautomersItVec() {
310 for (auto it = d_tautomers.begin(); it != d_tautomers.end(); ++it) {
311 d_tautomersItVec.push_back(it);
312 }
313 }
314 // the enumerated tautomers
315 SmilesTautomerMap d_tautomers;
316 // internal; vector of iterators into map items to enable random
317 // access to map items by index
318 std::vector<SmilesTautomerMap::const_iterator> d_tautomersItVec;
319 // status of the enumeration: did it complete? did it hit a limit?
320 // was it canceled?
321 TautomerEnumeratorStatus d_status;
322 // bit vector: flags atoms modified by the transforms
323 boost::dynamic_bitset<> d_modifiedAtoms;
324 // bit vector: flags bonds modified by the transforms
325 boost::dynamic_bitset<> d_modifiedBonds;
326};
327
334
336 public:
338 : dp_catalog(tautCat),
339 d_maxTautomers(1000),
340 d_maxTransforms(1000),
341 d_removeSp3Stereo(true),
342 d_removeBondStereo(true),
343 d_removeIsotopicHs(true),
344 d_reassignStereo(true) {}
347 : dp_catalog(other.dp_catalog),
348 d_callback(other.d_callback),
349 d_maxTautomers(other.d_maxTautomers),
350 d_maxTransforms(other.d_maxTransforms),
351 d_removeSp3Stereo(other.d_removeSp3Stereo),
352 d_removeBondStereo(other.d_removeBondStereo),
353 d_removeIsotopicHs(other.d_removeIsotopicHs),
354 d_reassignStereo(other.d_reassignStereo) {}
356 if (this == &other) {
357 return *this;
358 }
359 dp_catalog = other.dp_catalog;
360 d_callback = other.d_callback;
361 d_maxTautomers = other.d_maxTautomers;
362 d_maxTransforms = other.d_maxTransforms;
363 d_removeSp3Stereo = other.d_removeSp3Stereo;
364 d_removeBondStereo = other.d_removeBondStereo;
365 d_removeIsotopicHs = other.d_removeIsotopicHs;
366 d_reassignStereo = other.d_reassignStereo;
367 return *this;
368 }
369 //! \param maxTautomers maximum number of tautomers to be generated
370 void setMaxTautomers(unsigned int maxTautomers) {
371 d_maxTautomers = maxTautomers;
372 }
373 //! \return maximum number of tautomers to be generated
374 unsigned int getMaxTautomers() { return d_maxTautomers; }
375 /*! \param maxTransforms maximum number of transformations to be applied
376 this limit is usually hit earlier than the maxTautomers limit
377 and leads to a more linear scaling of CPU time with increasing
378 number of tautomeric centers (see Sitzmann et al.)
379 */
380 void setMaxTransforms(unsigned int maxTransforms) {
381 d_maxTransforms = maxTransforms;
382 }
383 //! \return maximum number of transformations to be applied
384 unsigned int getMaxTransforms() { return d_maxTransforms; }
385 /*! \param removeSp3Stereo; if set to true, stereochemistry information
386 will be removed from sp3 atoms involved in tautomerism.
387 This means that S-aminoacids will lose their stereochemistry after going
388 through tautomer enumeration because of the amido-imidol tautomerism.
389 This defaults to true in RDKit, false in the workflow described
390 by Sitzmann et al.
391 */
392 void setRemoveSp3Stereo(bool removeSp3Stereo) {
393 d_removeSp3Stereo = removeSp3Stereo;
394 }
395 /*! \return whether stereochemistry information will be removed from
396 sp3 atoms involved in tautomerism
397 */
398 bool getRemoveSp3Stereo() { return d_removeSp3Stereo; }
399 /*! \param removeBondStereo; if set to true, stereochemistry information
400 will be removed from double bonds involved in tautomerism.
401 This means that enols will lose their E/Z stereochemistry after going
402 through tautomer enumeration because of the keto-enolic tautomerism.
403 This defaults to true in RDKit and also in the workflow described
404 by Sitzmann et al.
405 */
406 void setRemoveBondStereo(bool removeBondStereo) {
407 d_removeBondStereo = removeBondStereo;
408 }
409 /*! \return whether stereochemistry information will be removed from
410 double bonds involved in tautomerism
411 */
412 bool getRemoveBondStereo() { return d_removeBondStereo; }
413 /*! \param removeIsotopicHs; if set to true, isotopic Hs
414 will be removed from centers involved in tautomerism.
415 */
416 void setRemoveIsotopicHs(bool removeIsotopicHs) {
417 d_removeIsotopicHs = removeIsotopicHs;
418 }
419 /*! \return whether isotpoic Hs will be removed from
420 centers involved in tautomerism
421 */
422 bool getRemoveIsotopicHs() { return d_removeIsotopicHs; }
423 /*! \param reassignStereo; if set to true, assignStereochemistry
424 will be called on each tautomer generated by the enumerate() method.
425 This defaults to true.
426 */
427 void setReassignStereo(bool reassignStereo) {
428 d_reassignStereo = reassignStereo;
429 }
430 /*! \return whether assignStereochemistry will be called on each
431 tautomer generated by the enumerate() method
432 */
433 bool getReassignStereo() { return d_reassignStereo; }
434 /*! set this to an instance of a class derived from
435 TautomerEnumeratorCallback where operator() is overridden.
436 DO NOT delete the instance as ownership of the pointer is transferred
437 to the TautomerEnumerator
438 */
440 d_callback.reset(callback);
441 }
442 void setCallback(std::shared_ptr<TautomerEnumeratorCallback> callback) {
443 d_callback = callback;
444 }
445
446 /*! \return pointer to an instance of a class derived from
447 TautomerEnumeratorCallback.
448 DO NOT delete the instance as ownership of the pointer is transferred
449 to the TautomerEnumerator
450 */
451 TautomerEnumeratorCallback *getCallback() const { return d_callback.get(); }
452
453 //! returns a \c TautomerEnumeratorResult structure for the input molecule
454 /*!
455 The enumeration rules are inspired by the publication: M. Sitzmann et al.,
456 “Tautomerism in Large Databases.”, JCAMD 24:521 (2010)
457 https://doi.org/10.1007/s10822-010-9346-4
458
459 \param mol: the molecule to be enumerated
460
461 Notes:
462 - the definitions used here are that the atoms modified during
463 tautomerization are the atoms at the beginning and end of each tautomer
464 transform (the H "donor" and H "acceptor" in the transform) and the
465 bonds modified during transformation are any bonds whose order is
466 changed during the tautomer transform (these are the bonds between the
467 "donor" and the "acceptor")
468 - if any atoms in the molecule have the common_properties::_protected
469 property set, they will not be considered for tautomerization. Any
470 transformations involving these atoms will be skipped.
471
472 */
474
475 //! Deprecated, please use the form returning a \c TautomerEnumeratorResult
476 //! instead
477 [[deprecated(
478 "please use the form returning a TautomerEnumeratorResult "
479 "instead")]] std::vector<ROMOL_SPTR>
480 enumerate(const ROMol &mol, boost::dynamic_bitset<> *modifiedAtoms,
481 boost::dynamic_bitset<> *modifiedBonds = nullptr) const;
482
483 //! returns the canonical tautomer from a \c TautomerEnumeratorResult
485 boost::function<int(const ROMol &mol)> scoreFunc =
487
488 //! returns the canonical tautomer from an iterable of possible tautomers
489 /// When Iterable is TautomerEnumeratorResult we use the other non-templated
490 /// overload for efficiency (TautomerEnumeratorResult already has SMILES so no
491 /// need to recompute them)
492 /// caller owns the pointer
493 template <class Iterable,
494 typename std::enable_if<
495 !std::is_same<Iterable, TautomerEnumeratorResult>::value,
496 int>::type = 0>
497 ROMol *pickCanonical(const Iterable &tautomers,
498 boost::function<int(const ROMol &mol)> scoreFunc =
500 ROMOL_SPTR bestMol;
501 if (tautomers.size() == 1) {
502 bestMol = *tautomers.begin();
503 } else {
504 // Calculate score for each tautomer
505 int bestScore = std::numeric_limits<int>::min();
506 unsigned int bestStereo = 0;
507 std::string bestSmiles = "";
508 for (const auto &t : tautomers) {
509 auto score = scoreFunc(*t);
510#ifdef VERBOSE_ENUMERATION
511 std::cerr << " " << MolToSmiles(*t) << " " << score << std::endl;
512#endif
513 if (score < bestScore) {
514 // cannot win, so do not pay for its SMILES
515 continue;
516 }
517 // See the comment in the pickCanonical overload in Tautomer.cpp: the
518 // lexicographic tie-break is biased against stereochemistry, so compare
519 // the amount of retained stereo first.
520 auto nStereo = detail::countSpecifiedStereo(*t);
521 bool better = false;
522 bool haveSmiles = false;
523 std::string smiles;
524 if (score > bestScore) {
525 better = true;
526 } else if (nStereo > bestStereo) {
527 better = true;
528 } else if (nStereo == bestStereo) {
529 smiles = MolToSmiles(*t);
530 haveSmiles = true;
531 better = smiles < bestSmiles;
532 }
533 if (better) {
534 if (!haveSmiles) {
535 smiles = MolToSmiles(*t);
536 }
537 bestScore = score;
538 bestStereo = nStereo;
539 bestSmiles = std::move(smiles);
540 bestMol = t;
541 }
542 }
543 }
544 ROMol *res = new ROMol(*bestMol);
545 static const bool cleanIt = true;
546 static const bool force = true;
547 MolOps::assignStereochemistry(*res, cleanIt, force);
548
549 return res;
550 }
551
552 //! returns the canonical tautomer for a molecule
553 /*!
554 Note that the canonical tautomer is very likely not the most stable tautomer
555 for any given conditions. The default scoring rules are designed to produce
556 "reasonable" tautomers, but the primary concern is that the results are
557 canonical: you always get the same canonical tautomer for a molecule
558 regardless of what the input tautomer or atom ordering were.
559
560 The default scoring scheme is inspired by the publication:
561 M. Sitzmann et al., “Tautomerism in Large Databases.”, JCAMD 24:521 (2010)
562 https://doi.org/10.1007/s10822-010-9346-4
563
564 */
565 /// When \p scoreFunc is empty (default), an optimized scorer is created
566 /// that pre-filters substructure patterns once for the input molecule.
567 /// caller owns the pointer
569 const ROMol &mol,
570 boost::function<int(const ROMol &mol)> scoreFunc = {}) const;
572 RWMol &mol, boost::function<int(const ROMol &mol)> scoreFunc = {}) const;
573
574 private:
575 bool setTautomerStereoAndIsoHs(const ROMol &mol, ROMol &taut,
576 const TautomerEnumeratorResult &res) const;
577 std::shared_ptr<TautomerCatalog> dp_catalog;
578 std::shared_ptr<TautomerEnumeratorCallback> d_callback;
579 unsigned int d_maxTautomers;
580 unsigned int d_maxTransforms;
581 bool d_removeSp3Stereo;
582 bool d_removeBondStereo;
583 bool d_removeIsotopicHs;
584 bool d_reassignStereo;
585}; // TautomerEnumerator class
586
587// caller owns the pointer
589 const CleanupParameters &params) {
590 return new TautomerEnumerator(params);
591}
592// caller owns the pointer
598
599} // namespace MolStandardize
600} // namespace RDKit
601
602#endif
#define PRECONDITION(expr, mess)
Definition Invariant.h:108
Defines the CleanupParameters and some convenience functions.
Defines the primary molecule class ROMol as well as associated typedefs.
@ CHI_UNSPECIFIED
chirality that hasn't been specified
Definition Atom.h:107
@ STEREOANY
Definition Bond.h:98
virtual bool operator()(const ROMol &, const TautomerEnumeratorResult &)=0
Contains results of tautomer enumeration.
const boost::dynamic_bitset & modifiedBonds() const
const boost::dynamic_bitset & modifiedAtoms() const
TautomerEnumeratorResult(const TautomerEnumeratorResult &other)
TautomerEnumerator(const CleanupParameters &params=CleanupParameters())
std::vector< ROMOL_SPTR > enumerate(const ROMol &mol, boost::dynamic_bitset<> *modifiedAtoms, boost::dynamic_bitset<> *modifiedBonds=nullptr) const
ROMol * pickCanonical(const TautomerEnumeratorResult &tautRes, boost::function< int(const ROMol &mol)> scoreFunc=TautomerScoringFunctions::scoreTautomer) const
returns the canonical tautomer from a TautomerEnumeratorResult
TautomerEnumeratorCallback * getCallback() const
TautomerEnumeratorResult enumerate(const ROMol &mol) const
returns a TautomerEnumeratorResult structure for the input molecule
TautomerEnumerator & operator=(const TautomerEnumerator &other)
void canonicalizeInPlace(RWMol &mol, boost::function< int(const ROMol &mol)> scoreFunc={}) const
void setCallback(TautomerEnumeratorCallback *callback)
ROMol * canonicalize(const ROMol &mol, boost::function< int(const ROMol &mol)> scoreFunc={}) const
returns the canonical tautomer for a molecule
void setCallback(std::shared_ptr< TautomerEnumeratorCallback > callback)
TautomerEnumerator(const TautomerEnumerator &other)
void setMaxTransforms(unsigned int maxTransforms)
void setMaxTautomers(unsigned int maxTautomers)
ROMol * pickCanonical(const Iterable &tautomers, boost::function< int(const ROMol &mol)> scoreFunc=TautomerScoringFunctions::scoreTautomer) const
Tautomer(ROMOL_SPTR t, ROMOL_SPTR k, size_t a=0, size_t b=0)
Tautomer(ROMOL_SPTR t, size_t a=0, size_t b=0)
const ROMOL_SPTR & getKekulized() const
CXXAtomIterator< MolGraph, Atom * > atoms()
C++11 Range iterator.
Definition ROMol.h:422
CXXBondIterator< MolGraph, Bond * > bonds()
Definition ROMol.h:502
RWMol is a molecule class that is intended to be edited.
Definition RWMol.h:32
#define RDKIT_MOLSTANDARDIZE_EXPORT
Definition export.h:471
RDKIT_GRAPHMOL_EXPORT void assignStereochemistry(ROMol &mol, bool cleanIt=false, bool force=false, bool flagPossibleStereoCenters=false)
Assign stereochemistry tags to atoms and bonds.
RDKIT_GRAPHMOL_EXPORT void Kekulize(RWMol &mol, bool markAtomsBonds=true, bool canonical=true, unsigned int maxBackTracks=100)
Kekulizes the molecule.
RDKIT_MOLSTANDARDIZE_EXPORT int scoreHeteroHs(const ROMol &mol)
RDKIT_MOLSTANDARDIZE_EXPORT std::vector< size_t > getRelevantSubstructTermIndices(const ROMol &mol, const std::vector< SubstructTerm > &terms=getDefaultTautomerScoreSubstructs())
RDKIT_MOLSTANDARDIZE_EXPORT int scoreSubstructsFiltered(const ROMol &mol, const std::vector< SubstructTerm > &terms, const std::vector< size_t > &relevantIndices)
RDKIT_MOLSTANDARDIZE_EXPORT const std::vector< SubstructTerm > & getDefaultTautomerScoreSubstructs()
RDKIT_MOLSTANDARDIZE_EXPORT int scoreRings(const ROMol &mol)
RDKIT_MOLSTANDARDIZE_EXPORT int scoreSubstructs(const ROMol &mol, const std::vector< SubstructTerm > &terms=getDefaultTautomerScoreSubstructs())
scoreSubstructs scores the molecule based on the substructure definitions
boost::function< int(const ROMol &)> makeOptimizedScorer(const ROMol &mol)
RDKIT_MOLSTANDARDIZE_EXPORT const TautomerTransformDefs defaultTautomerTransformsv1
unsigned int countSpecifiedStereo(const ROMol &mol)
Number of explicitly specified stereo descriptors on a molecule.
std::map< std::string, Tautomer > SmilesTautomerMap
TautomerEnumerator * tautomerEnumeratorFromParams(const CleanupParameters &params)
TautomerEnumerator * getV1TautomerEnumerator()
RDCatalog::HierarchCatalog< TautomerCatalogEntry, TautomerCatalogParams, int > TautomerCatalog
std::pair< std::string, Tautomer > SmilesTautomerPair
Std stuff.
RDKIT_SMILESPARSE_EXPORT std::string MolToSmiles(const ROMol &mol, const SmilesWriteParams &params)
returns canonical SMILES for a molecule
boost::shared_ptr< ROMol > ROMOL_SPTR
SubstructTerm(std::string aname, std::string asmarts, int ascore, std::vector< int > reqElements={}, std::string connSmarts="")
SubstructTerm & operator=(const SubstructTerm &rhs)=default