RDKit
Open-source cheminformatics and machine learning.
Deprotect.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2020 Brian P Kelley, Joann Prescott-Roy
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 #ifndef RDK_DEPROTECT_LIBRARY
11 #define RDK_DEPROTECT_LIBRARY
12 
13 #include <RDGeneral/export.h>
14 #include <GraphMol/RDKitBase.h>
16 #include <string>
17 #include <memory>
18 
19 namespace RDKit {
20 namespace Deprotect {
21 /*! Data for Deprotecting molecules
22 
23  Deprotects are described as reactions that remove the protecting
24  group and leave behind the group being protected.
25 
26  Each DeprotectData has the following attributes:
27 
28  - <b>deprotection_class</b> functional group being protected (i.e. amine,
29  alcohol, ...)
30  - <b>reaction_smarts</b> the reaction smarts pattern for removing the
31  protecting group
32  - <b>abbreviation</b> common abbreviation for the protecting group (Boc,
33  Fmoc)
34  - <b>full_name</b> full name for the protecting group
35  - <b> rxn </b> the reaction itself.
36 */
37 
39  std::string deprotection_class;
40  std::string reaction_smarts;
41  std::string abbreviation;
42  std::string full_name;
43  std::string example;
44 
45  std::shared_ptr<ChemicalReaction>
46  rxn; // so much easier than unique_ptr, sigh...
47 
48  DeprotectData(const std::string &deprotection_class,
49  const std::string &reaction_smarts,
50  const std::string &abbrevition,
51  const std::string &full_name,
52  const std::string &example="");
53 
54  bool operator==(const DeprotectData &other) const {
55  return (deprotection_class == other.deprotection_class &&
56  full_name == other.full_name &&
57  abbreviation == other.abbreviation &&
58  reaction_smarts == other.reaction_smarts &&
59  isValid() == other.isValid());
60  }
61 
62  //! Returns true if the deprotection is valid
63  bool isValid() const {
64  return rxn.get() != nullptr && rxn->getNumProductTemplates() == 1;
65  }
66 };
67 
68 //! Retrieves the built in list of common deprotections
69 RDKIT_DEPROTECT_EXPORT const std::vector<DeprotectData> &getDeprotections();
70 
71 //! Deprotect a molecule
72 /*!
73  The resulting molecule is annotated with the deprotections used (property
74  DEPROTECTIONS) and the number of deprotections applied (property
75  DEPROTECTIION_COUNT)
76 
77  \param mol the molecule to deprotect
78  \param deprotections - a vector of deprotections to use, defaults to the
79  built in deprotections.
80 
81  \return The deprotected form of the input molecule
82 */
83 RDKIT_DEPROTECT_EXPORT std::unique_ptr<ROMol> deprotect(
84  const ROMol &mol,
85  const std::vector<DeprotectData> &deprotections = getDeprotections());
86 } // namspace Deprotect
87 } // namespace RDKit
88 #endif
pulls in the core RDKit functionality
#define RDKIT_DEPROTECT_EXPORT
Definition: export.h:164
RDKIT_DEPROTECT_EXPORT std::unique_ptr< ROMol > deprotect(const ROMol &mol, const std::vector< DeprotectData > &deprotections=getDeprotections())
Deprotect a molecule.
RDKIT_DEPROTECT_EXPORT const std::vector< DeprotectData > & getDeprotections()
Retrieves the built in list of common deprotections.
Std stuff.
Definition: Abbreviations.h:17
bool operator==(const DeprotectData &other) const
Definition: Deprotect.h:54
std::shared_ptr< ChemicalReaction > rxn
Definition: Deprotect.h:46
DeprotectData(const std::string &deprotection_class, const std::string &reaction_smarts, const std::string &abbrevition, const std::string &full_name, const std::string &example="")
bool isValid() const
Returns true if the deprotection is valid.
Definition: Deprotect.h:63