RDKit
Open-source cheminformatics and machine learning.
Normalize.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2018 Susan H. Leung
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 /*! \file Normalize.h
11 
12  \brief Defines the Normalizer class.
13 
14 */
15 #include <RDGeneral/export.h>
16 #ifndef __RD_NORMALIZE_H__
17 #define __RD_NORMALIZE_H__
18 
19 #include <Catalogs/Catalog.h>
23 
24 namespace RDKit {
25 class RWMol;
26 class ROMol;
27 
28 namespace MolStandardize {
29 RDKIT_MOLSTANDARDIZE_EXPORT extern const CleanupParameters
31 
32 typedef RDCatalog::HierarchCatalog<TransformCatalogEntry,
33  TransformCatalogParams, int>
35 typedef std::pair<std::string, ROMOL_SPTR> SmilesMolPair;
36 
37 //! The Normalizer class for applying Normalization transforms.
38 /*!
39 
40  <b>Notes:</b>
41  - This class is typically used to apply a series of Normalization transforms
42  to correct functional groups and recombine charges.
43  - Each transform is repeatedly applied until no further changes
44  occur.
45 */
46 
48  public:
50  //! Construct a Normalizer with a particular normalizeFile and maxRestarts
51  Normalizer(const std::string normalizeFile, const unsigned int maxRestarts);
52  //! Construct a Normalizer with a particular stream (with parameters) and
53  //! maxRestarts
54  Normalizer(std::istream &normalizeStream, const unsigned int maxRestarts);
55  //! making Normalizer objects non-copyable
56  Normalizer(const Normalizer &other) = delete;
57  Normalizer &operator=(Normalizer const &) = delete;
59 
60  //! Apply a series of Normalization transforms to correct functional groups
61  //! and recombine charges.
62  /*!
63  <b>Notes:</b>
64  - A series of transforms are applied to the molecule. For each
65  Normalization, the transform is applied repeatedly until no further changes
66  occur.
67  - If any changes occurred, we go back and start from the first
68  Normalization again, in case the changes mean an earlier transform is now
69  applicable.
70  - The molecule is returned once the entire series of
71  Normalizations cause no further changes or if max_restarts (default 200) is
72  reached.
73  */
74  ROMol *normalize(const ROMol &mol);
75 
76  private:
77  const TransformCatalog *d_tcat;
78  unsigned int MAX_RESTARTS;
79 
80  ROMOL_SPTR normalizeFragment(
81  const ROMol &mol,
82  const std::vector<std::shared_ptr<ChemicalReaction>> &transforms) const;
83  SmilesMolPair applyTransform(const ROMOL_SPTR &mol,
84  ChemicalReaction &rule) const;
85 
86 }; // Normalizer class
87 } // namespace MolStandardize
88 } // namespace RDKit
89 
90 #endif
A Catalog with a hierarchical structure.
Definition: Catalog.h:135
This is a class for storing and applying general chemical reactions.
Definition: Reaction.h:119
The Normalizer class for applying Normalization transforms.
Definition: Normalize.h:47
Normalizer(const Normalizer &other)=delete
making Normalizer objects non-copyable
Normalizer & operator=(Normalizer const &)=delete
ROMol * normalize(const ROMol &mol)
Normalizer(std::istream &normalizeStream, const unsigned int maxRestarts)
Normalizer(const std::string normalizeFile, const unsigned int maxRestarts)
Construct a Normalizer with a particular normalizeFile and maxRestarts.
#define RDKIT_MOLSTANDARDIZE_EXPORT
Definition: export.h:489
RDCatalog::HierarchCatalog< TransformCatalogEntry, TransformCatalogParams, int > TransformCatalog
Definition: Normalize.h:34
RDKIT_MOLSTANDARDIZE_EXPORT const CleanupParameters defaultCleanupParameters
Definition: Fragment.h:25
std::pair< std::string, ROMOL_SPTR > SmilesMolPair
Definition: Normalize.h:35
Std stuff.
Definition: Abbreviations.h:17
boost::shared_ptr< ROMol > ROMOL_SPTR