RDKit
Open-source cheminformatics and machine learning.
RGroupDecomp.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2017 Novartis Institutes for BioMedical Research
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 RDKIT_RGROUPDECOMP_H
12 #define RDKIT_RGROUPDECOMP_H
13 
14 #include "../RDKitBase.h"
16 
17 namespace RDKit {
18 
19 //! Compute the isomporphic degenerative points in the
20 //! molecule. These are points that are symmetrically
21 //! equivalent.
22 /*!
23  \param mol Molecule to compute the degenerative points
24 
25  \return the set of degenerative points (set<unsigned int>)
26 */
27 
28 typedef enum {
29  IsotopeLabels = 0x01,
30  AtomMapLabels = 0x02,
34  DummyAtomLabels = 0x20, // These are rgroups but will get relabelled
35  AutoDetect = 0xFF,
36 } RGroupLabels;
37 
38 typedef enum {
39  Greedy = 0x01,
40  GreedyChunks = 0x02,
41  Exhaustive = 0x04, // not really useful for large sets
43 
44 typedef enum {
45  AtomMap = 0x01,
46  Isotope = 0x02,
47  MDLRGroup = 0x04,
49 
50 typedef enum {
51  None = 0x0,
52  MCS = 0x01,
54 
56  unsigned int labels;
57  unsigned int matchingStrategy;
58  unsigned int rgroupLabelling;
59  unsigned int alignment;
60 
61  unsigned int chunkSize;
65 
67  unsigned int strategy = GreedyChunks,
68  unsigned int labelling = AtomMap | MDLRGroup,
69  unsigned int alignment = MCS,
70  unsigned int chunkSize = 5,
71  bool matchOnlyAtRGroups = false,
72  bool removeHydrogenOnlyGroups = true,
73  bool removeHydrogensPostMatch = true)
74  : labels(labels),
75  matchingStrategy(strategy),
76  rgroupLabelling(labelling),
77  alignment(alignment),
78  chunkSize(chunkSize),
79  onlyMatchAtRGroups(matchOnlyAtRGroups),
80  removeAllHydrogenRGroups(removeHydrogenOnlyGroups),
81  removeHydrogensPostMatch(removeHydrogensPostMatch),
82  indexOffset(-1) {}
83 
84  // Determine how to assign the rgroup labels from the given core
85  unsigned int autoGetLabels(const RWMol &);
86 
87  // Prepare the core for substructure searching and rgroup assignment
88  bool prepareCore(RWMol &, const RWMol *alignCore);
89 
90  private:
91  int indexOffset;
92 };
93 
94 typedef std::map<std::string, boost::shared_ptr<ROMol>> RGroupRow;
95 typedef std::vector<boost::shared_ptr<ROMol>> RGroupColumn;
96 
97 typedef std::vector<RGroupRow> RGroupRows;
98 typedef std::map<std::string, RGroupColumn> RGroupColumns;
99 
100 struct RGroupDecompData;
102  RGroupDecompData *data; // implementation details
103  RGroupDecomposition(const RGroupDecomposition &); // no copy construct
104  RGroupDecomposition &operator=(
105  const RGroupDecomposition &); // Prevent assignment
106 
107  public:
108  RGroupDecomposition(const ROMol &core,
109  const RGroupDecompositionParameters &params =
111  RGroupDecomposition(const std::vector<ROMOL_SPTR> &cores,
112  const RGroupDecompositionParameters &params =
114 
116 
117  int add(const ROMol &mol);
118  bool process();
119 
120  //! return the current group labels
121  std::vector<std::string> getRGroupLabels() const;
122 
123  //! return rgroups in row order group[row][attachment_point] = ROMol
124  RGroupRows getRGroupsAsRows() const;
125  //! return rgroups in column order group[attachment_point][row] = ROMol
126  RGroupColumns getRGroupsAsColumns() const;
127 };
128 
130  const std::vector<ROMOL_SPTR> &cores, const std::vector<ROMOL_SPTR> &mols,
131  RGroupRows &rows, std::vector<unsigned int> *unmatched = nullptr,
132  const RGroupDecompositionParameters &options =
134 
136  const std::vector<ROMOL_SPTR> &cores, const std::vector<ROMOL_SPTR> &mols,
137  RGroupColumns &columns, std::vector<unsigned int> *unmatched = nullptr,
138  const RGroupDecompositionParameters &options =
140 } // namespace RDKit
141 
142 #endif
RDKit::RGroupCoreAlignment
RGroupCoreAlignment
Definition: RGroupDecomp.h:50
RDKit::RGroupDecompositionParameters::removeHydrogensPostMatch
bool removeHydrogensPostMatch
Definition: RGroupDecomp.h:64
RDKit::RGroupLabels
RGroupLabels
Definition: RGroupDecomp.h:28
RDKit::IsotopeLabels
@ IsotopeLabels
Definition: RGroupDecomp.h:29
RDKit::RGroupDecomposition
Definition: RGroupDecomp.h:101
RDKit::AtomMap
@ AtomMap
Definition: RGroupDecomp.h:45
RDKit::RGroupDecompositionParameters::chunkSize
unsigned int chunkSize
Definition: RGroupDecomp.h:61
RDKit::RGroupDecompositionParameters
Definition: RGroupDecomp.h:55
RDKit::RWMol
RWMol is a molecule class that is intended to be edited.
Definition: RWMol.h:31
RDKit::DummyAtomLabels
@ DummyAtomLabels
Definition: RGroupDecomp.h:34
RDKit::Exhaustive
@ Exhaustive
Definition: RGroupDecomp.h:41
RDKit::AtomMapLabels
@ AtomMapLabels
Definition: RGroupDecomp.h:30
RDKit::RGroupRows
std::vector< RGroupRow > RGroupRows
Definition: RGroupDecomp.h:97
RDKit::RGroupDecompositionParameters::alignment
unsigned int alignment
Definition: RGroupDecomp.h:59
RDKit::ROMol
Definition: ROMol.h:171
RDKit::RGroupDecompositionParameters::RGroupDecompositionParameters
RGroupDecompositionParameters(unsigned int labels=AutoDetect, unsigned int strategy=GreedyChunks, unsigned int labelling=AtomMap|MDLRGroup, unsigned int alignment=MCS, unsigned int chunkSize=5, bool matchOnlyAtRGroups=false, bool removeHydrogenOnlyGroups=true, bool removeHydrogensPostMatch=true)
Definition: RGroupDecomp.h:66
RDKit::RelabelDuplicateLabels
@ RelabelDuplicateLabels
Definition: RGroupDecomp.h:32
RDKit::RGroupColumns
std::map< std::string, RGroupColumn > RGroupColumns
Definition: RGroupDecomp.h:98
RDKit::RGroupDecompose
RDKIT_RGROUPDECOMPOSITION_EXPORT unsigned int RGroupDecompose(const std::vector< ROMOL_SPTR > &cores, const std::vector< ROMOL_SPTR > &mols, RGroupRows &rows, std::vector< unsigned int > *unmatched=nullptr, const RGroupDecompositionParameters &options=RGroupDecompositionParameters())
RDKit::MCS
@ MCS
Definition: RGroupDecomp.h:52
RDKit::None
@ None
Definition: RGroupDecomp.h:51
RDKit::RGroupColumn
std::vector< boost::shared_ptr< ROMol > > RGroupColumn
Definition: RGroupDecomp.h:95
RDKit::RGroupDecompositionParameters::onlyMatchAtRGroups
bool onlyMatchAtRGroups
Definition: RGroupDecomp.h:62
RDKit::RGroupLabelling
RGroupLabelling
Definition: RGroupDecomp.h:44
RDKit::RGroupDecompositionParameters::removeAllHydrogenRGroups
bool removeAllHydrogenRGroups
Definition: RGroupDecomp.h:63
RDKit::AutoDetect
@ AutoDetect
Definition: RGroupDecomp.h:35
RDKit::RGroupDecompositionParameters::rgroupLabelling
unsigned int rgroupLabelling
Definition: RGroupDecomp.h:58
RDKit::RGroupMatching
RGroupMatching
Definition: RGroupDecomp.h:38
RDKit::RGroupRow
std::map< std::string, boost::shared_ptr< ROMol > > RGroupRow
Definition: RGroupDecomp.h:94
RDKit::Isotope
@ Isotope
Definition: RGroupDecomp.h:46
RDKit::Greedy
@ Greedy
Definition: RGroupDecomp.h:39
RDKit
Std stuff.
Definition: Atom.h:30
RDKit::MDLRGroupLabels
@ MDLRGroupLabels
Definition: RGroupDecomp.h:33
RDKIT_RGROUPDECOMPOSITION_EXPORT
#define RDKIT_RGROUPDECOMPOSITION_EXPORT
Definition: export.h:554
RDKit::RGroupDecompositionParameters::labels
unsigned int labels
Definition: RGroupDecomp.h:56
RDKit::MDLRGroup
@ MDLRGroup
Definition: RGroupDecomp.h:47
RDKit::AtomIndexLabels
@ AtomIndexLabels
Definition: RGroupDecomp.h:31
RDKit::RGroupDecompositionParameters::matchingStrategy
unsigned int matchingStrategy
Definition: RGroupDecomp.h:57
SubstructMatch.h
RDKit::GreedyChunks
@ GreedyChunks
Definition: RGroupDecomp.h:40
export.h