RDKit: RGroupDecomp.h Source File

| RDKit Open-source cheminformatics and machine learning.

- Main Page
- Namespaces
- Classes
- Files

- File List
- File Members

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