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