File: Deprotect.h

package info (click to toggle)
rdkit 202503.1-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 220,160 kB
  • sloc: cpp: 399,240; python: 77,453; ansic: 25,517; java: 8,173; javascript: 4,005; sql: 2,389; yacc: 1,565; lex: 1,263; cs: 1,081; makefile: 580; xml: 229; fortran: 183; sh: 105
file content (105 lines) | stat: -rw-r--r-- 3,471 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
//
//  Copyright (C) 2020-2021 Brian P Kelley, Joann Prescott-Roy and other RDKit
//  contributors
//
//   @@ All Rights Reserved @@
//  This file is part of the RDKit.
//  The contents are covered by the terms of the BSD license
//  which is included in the file license.txt, found at the root
//  of the RDKit source tree.
//
#ifndef RDK_DEPROTECT_LIBRARY
#define RDK_DEPROTECT_LIBRARY

#include <RDGeneral/export.h>
#include <GraphMol/RDKitBase.h>
#include <GraphMol/ChemReactions/Reaction.h>
#include <string>
#include <memory>

namespace RDKit {
namespace Deprotect {
/*! Data for Deprotecting molecules

 Deprotects are described as reactions that remove the protecting
  group and leave behind the group being protected.

  Each DeprotectData has the following attributes:

    - <b>deprotection_class</b> functional group being protected (i.e. amine,
 alcohol, ...)
    - <b>reaction_smarts</b> the reaction smarts pattern for removing the
 protecting group
    - <b>abbreviation</b> common abbreviation for the protecting group (Boc,
 Fmoc)
    - <b>full_name</b> full name for the protecting group
    - <b> rxn </b> the reaction itself.
*/

struct RDKIT_DEPROTECT_EXPORT DeprotectData {
  std::string deprotection_class;
  std::string reaction_smarts;
  std::string abbreviation;
  std::string full_name;
  std::string example;

  std::shared_ptr<ChemicalReaction>
      rxn;  // so much easier than unique_ptr, sigh...

  DeprotectData(std::string deprotection_class,
                const std::string &reaction_smarts, std::string abbreviation,
                std::string full_name, std::string example = "");

  bool operator==(const DeprotectData &other) const {
    return (deprotection_class == other.deprotection_class &&
            full_name == other.full_name &&
            abbreviation == other.abbreviation &&
            reaction_smarts == other.reaction_smarts &&
            isValid() == other.isValid());
  }
  bool operator!=(const DeprotectData &other) const {
    return !(*this == other);
  }

  //! Returns true if the deprotection is valid
  bool isValid() const {
    return rxn.get() != nullptr && rxn->getNumProductTemplates() == 1;
  }
};

//! Retrieves the built in list of common deprotections
RDKIT_DEPROTECT_EXPORT const std::vector<DeprotectData> &getDeprotections();

//! Deprotect a molecule
/*!
     The resulting molecule is annotated with the deprotections used (property
   DEPROTECTIONS) and the number of deprotections applied (property
   DEPROTECTIION_COUNT)

     \param mol the molecule to deprotect
     \param deprotections - a vector of deprotections to use, defaults to the
   built in deprotections.

     \return The deprotected form of the input molecule
*/
RDKIT_DEPROTECT_EXPORT std::unique_ptr<ROMol> deprotect(
    const ROMol &mol,
    const std::vector<DeprotectData> &deprotections = getDeprotections());
//! Deprotect a molecule in place
/*!
     The molecule is annotated with the deprotections used (property
   DEPROTECTIONS) and the number of deprotections applied (property
   DEPROTECTIION_COUNT)

     \param mol the molecule to deprotect
     \param deprotections - a vector of deprotections to use, defaults to the
   built in deprotections.

     \return whether or not the molecule was changed
*/
RDKIT_DEPROTECT_EXPORT bool deprotectInPlace(
    RWMol &mol,
    const std::vector<DeprotectData> &deprotections = getDeprotections());
}  // namespace Deprotect
}  // namespace RDKit
#endif