RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
RGroupDecompParams.h
Go to the documentation of this file.
1//
2// Copyright (c) 2017-2023, Novartis Institutes for BioMedical Research Inc.
3// and other RDKit 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
12#ifndef RDKIT_RGROUPDECOMPPARAMS_H
13#define RDKIT_RGROUPDECOMPPARAMS_H
14
15#include "../RDKitBase.h"
17
18namespace RDKit {
19
20#define RGROUPLABELS_ENUM_ITEMS \
21 RGD_ENUM_ITEM(IsotopeLabels, 1 << 0) \
22 RGD_ENUM_ITEM(AtomMapLabels, 1 << 1) \
23 RGD_ENUM_ITEM(AtomIndexLabels, 1 << 2) \
24 RGD_ENUM_ITEM(RelabelDuplicateLabels, 1 << 3) \
25 RGD_ENUM_ITEM(MDLRGroupLabels, 1 << 4) \
26 RGD_ENUM_ITEM(DummyAtomLabels, \
27 1 << 5) /* These are rgroups but will get relabelled */ \
28 RGD_ENUM_ITEM(AutoDetect, 0xFF)
29
30#define RGROUPMATCHING_ENUM_ITEMS \
31 RGD_ENUM_ITEM(Greedy, 1 << 0) \
32 RGD_ENUM_ITEM(GreedyChunks, 1 << 1) \
33 RGD_ENUM_ITEM(Exhaustive, 1 << 2) /* not really useful for large sets */ \
34 RGD_ENUM_ITEM(NoSymmetrization, 1 << 3) \
35 RGD_ENUM_ITEM(GA, 1 << 4)
36
37#define RGROUPLABELLING_ENUM_ITEMS \
38 RGD_ENUM_ITEM(AtomMap, 1 << 0) \
39 RGD_ENUM_ITEM(Isotope, 1 << 1) \
40 RGD_ENUM_ITEM(MDLRGroup, 1 << 2)
41
42#define RGROUPCOREALIGNMENT_ENUM_ITEMS \
43 RGD_ENUM_ITEM(NoAlignment, 0) \
44 RGD_ENUM_ITEM(MCS, 1 << 0)
45
46#define RGROUPSCORE_ENUM_ITEMS \
47 RGD_ENUM_ITEM(Match, 1 << 0) \
48 RGD_ENUM_ITEM(FingerprintVariance, 1 << 2)
49
50#define RGD_ENUM_ITEM(k, v) k = v,
52
54
56
58
60#undef RGD_ENUM_ITEM
61#define RGD_STD_MAP_ITEM(k) {#k, k},
62#define RGD_ENUM_ITEM(k, v) RGD_STD_MAP_ITEM(k)
63
65 unsigned int labels = AutoDetect;
66 unsigned int matchingStrategy = GreedyChunks;
67 unsigned int scoreMethod = Match;
68 unsigned int rgroupLabelling = AtomMap | MDLRGroup;
69 unsigned int alignment = MCS;
70
71 unsigned int chunkSize = 5;
72 //! only allow rgroup decomposition at the specified rgroups
73 bool onlyMatchAtRGroups = false;
74 //! remove all user-defined rgroups that only have hydrogens
75 bool removeAllHydrogenRGroups = true;
76 //! remove all user-defined rgroups that only have hydrogens,
77 //! and also remove the corresponding labels from the core
78 bool removeAllHydrogenRGroupsAndLabels = true;
79 //! remove all hydrogens from the output molecules
80 bool removeHydrogensPostMatch = true;
81 //! allow labelled Rgroups of degree 2 or more
82 bool allowNonTerminalRGroups = false;
83 //! unlabelled core atoms can have multiple rgroups
84 bool allowMultipleRGroupsOnUnlabelled = false;
85 // extended query settings for core matching
86 bool doTautomers = false;
87 bool doEnumeration = false;
88 //! include target molecule (featuring explicit hydrogens where they
89 //! coincide with R groups in the core) into RGD results,
90 //! and set _rgroupTargetAtoms and _rgroupTargetBonds properties
91 //! on R groups and core as vectors of target atom and bond indices
92 //! to enable highlighting for SAR analysis (see
93 //! https://greglandrum.github.io/rdkit-blog/posts/2021-08-07-rgd-and-highlighting.html)
94 bool includeTargetMolInResults = false;
95
96 double timeout = -1.0; ///< timeout in seconds. <=0 indicates no timeout
97
98 // Determine how to assign the rgroup labels from the given core
99 unsigned int autoGetLabels(const RWMol &);
100
101 // Prepare the core for substructure searching and rgroup assignment
102 bool prepareCore(RWMol &, const RWMol *alignCore);
103
104 // Add r groups to unlabelled atoms if allowMultipleRGroupsOnUnlabelled is set
106
107 // Parameters specific to GA
108
109 // GA population size or -1 to use best guess
110 int gaPopulationSize = -1;
111 // GA maximum number of operations or -1 to use best guess
112 int gaMaximumOperations = -1;
113 // GA number of operations permitted without improvement before exiting (-1
114 // for best guess)
115 int gaNumberOperationsWithoutImprovement = -1;
116 // GA random number seed (-1 for default, -2 for random seed)
117 int gaRandomSeed = -1;
118 // Number of runs
119 int gaNumberRuns = 1;
120 // Sequential or parallel runs?
121#ifdef RDK_BUILD_THREADSAFE_SSS
122 bool gaParallelRuns = true;
123#else
124 bool gaParallelRuns = false;
125#endif
126 // Controls the way substructure matching with the core is done
128
129 RGroupDecompositionParameters() { substructmatchParams.useChirality = true; }
130
131 private:
132 int indexOffset{-1};
133 void checkNonTerminal(const Atom &atom) const;
134};
135
137 RGroupDecompositionParameters &params, const std::string &details_json);
139 RGroupDecompositionParameters &params, const char *details_json);
140
141} // namespace RDKit
142
143#endif // RDKIT_RGROUPDECOMPPARAMS_H
RWMol is a molecule class that is intended to be edited.
Definition RWMol.h:32
#define RDKIT_RGROUPDECOMPOSITION_EXPORT
Definition export.h:433
Std stuff.
@ RGROUPSCORE_ENUM_ITEMS
@ RGROUPCOREALIGNMENT_ENUM_ITEMS
@ RGROUPMATCHING_ENUM_ITEMS
bool rdvalue_is(const RDValue_cast_t)
@ RGROUPLABELS_ENUM_ITEMS
@ RGROUPLABELLING_ENUM_ITEMS
void updateRGroupDecompositionParametersFromJSON(RGroupDecompositionParameters &params, const std::string &details_json)
void addDummyAtomsToUnlabelledCoreAtoms(RWMol &core)
unsigned int autoGetLabels(const RWMol &)
bool prepareCore(RWMol &, const RWMol *alignCore)
SubstructMatchParameters substructmatchParams