RDKit: RGroupDecompParams.h Source File

| 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"
16#include <GraphMol/Substruct/SubstructMatch.h>
17#include <RDGeneral/BetterEnums.h>
18
19namespace RDKit {
20
21 BETTER_ENUM(
22 RGroupLabels, unsigned int, IsotopeLabels = 0x01, AtomMapLabels = 0x02,
23 AtomIndexLabels = 0x04, RelabelDuplicateLabels = 0x08,
24 MDLRGroupLabels = 0x10,
25 DummyAtomLabels = 0x20, // These are rgroups but will get relabelled
26 AutoDetect = 0xFF);
27
28 BETTER_ENUM(RGroupMatching, unsigned int, Greedy = 0x01, GreedyChunks = 0x02,
29 Exhaustive = 0x04, // not really useful for large sets
30 NoSymmetrization = 0x08, GA = 0x10);
31
32 BETTER_ENUM(RGroupLabelling, unsigned int, AtomMap = 0x01, Isotope = 0x02,
33 MDLRGroup = 0x04);
34
35 BETTER_ENUM(RGroupCoreAlignment, unsigned int, NoAlignment = 0x0, MCS = 0x01);
36
37 BETTER_ENUM(RGroupScore, unsigned int, Match = 0x1, FingerprintVariance = 0x4);
38
39 struct RDKIT_RGROUPDECOMPOSITION_EXPORT RGroupDecompositionParameters {
40 unsigned int labels = RGroupLabels::AutoDetect;
41 unsigned int matchingStrategy = RGroupMatching::GreedyChunks;
42 unsigned int scoreMethod = RGroupScore::Match;
43 unsigned int rgroupLabelling =
44 RGroupLabelling::AtomMap | RGroupLabelling::MDLRGroup;
45 unsigned int alignment = RGroupCoreAlignment::MCS;
46
47 unsigned int chunkSize = 5;
48 //! only allow rgroup decomposition at the specified rgroups
49 bool onlyMatchAtRGroups = false;
50 //! remove all user-defined rgroups that only have hydrogens
51 bool removeAllHydrogenRGroups = true;
52 //! remove all user-defined rgroups that only have hydrogens,
53 //! and also remove the corresponding labels from the core
54 bool removeAllHydrogenRGroupsAndLabels = true;
55 //! remove all hydrogens from the output molecules
56 bool removeHydrogensPostMatch = true;
57 //! allow labelled Rgroups of degree 2 or more
58 bool allowNonTerminalRGroups = false;
59 //! unlabelled core atoms can have multiple rgroups
60 bool allowMultipleRGroupsOnUnlabelled = false;
61 //! Permit a core to match more than once in the same molecule if the sets of
62 // matched atoms are not equal.
63 bool allowMultipleCoresInSameMol = false;
64 // extended query settings for core matching
65 bool doTautomers = false;
66 bool doEnumeration = false;
67 //! include target molecule (featuring explicit hydrogens where they
68 //! coincide with R groups in the core) into RGD results,
69 //! and set _rgroupTargetAtoms and _rgroupTargetBonds properties
70 //! on R groups and core as vectors of target atom and bond indices
71 //! to enable highlighting for SAR analysis (see
72 //! https://greglandrum.github.io/rdkit-blog/posts/2021-08-07-rgd-and-highlighting.html)
73 bool includeTargetMolInResults = false;
74
75 double timeout = -1.0; ///< timeout in seconds. <=0 indicates no timeout
76
77 // Determine how to assign the rgroup labels from the given core
78 unsigned int autoGetLabels(const RWMol &);
79
80 // Prepare the core for substructure searching and rgroup assignment
81 bool prepareCore(RWMol &, const RWMol *alignCore);
82
83 // Add r groups to unlabelled atoms if allowMultipleRGroupsOnUnlabelled is set
84 void addDummyAtomsToUnlabelledCoreAtoms(RWMol &core);
85
86 // Parameters specific to GA
87
88 // GA population size or -1 to use best guess
89 int gaPopulationSize = -1;
90 // GA maximum number of operations or -1 to use best guess
91 int gaMaximumOperations = -1;
92 // GA number of operations permitted without improvement before exiting (-1
93 // for best guess)
94 int gaNumberOperationsWithoutImprovement = -1;
95 // GA random number seed (-1 for default, -2 for random seed)
96 int gaRandomSeed = -1;
97 // Number of runs
98 int gaNumberRuns = 1;
99 // Sequential or parallel runs?
100#ifdef RDK_BUILD_THREADSAFE_SSS
101 bool gaParallelRuns = true;
102#else
103 bool gaParallelRuns = false;
104#endif
105 // Controls the way substructure matching with the core is done
106 SubstructMatchParameters substructmatchParams;
107
108 RGroupDecompositionParameters() { substructmatchParams.useChirality = true; }
109
110 private:
111 int indexOffset{-1};
112 void checkNonTerminal(const Atom &atom) const;
113};
114
115} // namespace RDKit
116
117#endif // RDKIT_RGROUPDECOMPPARAMS_H
BetterEnums.h
BETTER_ENUM
#define BETTER_ENUM(Enum, Underlying,...)
Definition BetterEnums.h:17
RDKitBase.h
pulls in the core RDKit functionality
SubstructMatch.h
RDKit::RWMol
RWMol is a molecule class that is intended to be edited.
Definition RWMol.h:32
RDKIT_RGROUPDECOMPOSITION_EXPORT
#define RDKIT_RGROUPDECOMPOSITION_EXPORT
Definition export.h:473
RDKit
Std stuff.
Definition Abbreviations.h:19
RDKit::RGroupDecompositionParameters::removeAllHydrogenRGroupsAndLabels
bool removeAllHydrogenRGroupsAndLabels
Definition RGroupDecompParams.h:54
RDKit::RGroupDecompositionParameters::gaNumberRuns
int gaNumberRuns
Definition RGroupDecompParams.h:98
RDKit::RGroupDecompositionParameters::allowNonTerminalRGroups
bool allowNonTerminalRGroups
allow labelled Rgroups of degree 2 or more
Definition RGroupDecompParams.h:58
RDKit::RGroupDecompositionParameters::gaPopulationSize
int gaPopulationSize
Definition RGroupDecompParams.h:89
RDKit::RGroupDecompositionParameters::matchingStrategy
unsigned int matchingStrategy
Definition RGroupDecompParams.h:41
RDKit::RGroupDecompositionParameters::gaRandomSeed
int gaRandomSeed
Definition RGroupDecompParams.h:96
RDKit::RGroupDecompositionParameters::allowMultipleRGroupsOnUnlabelled
bool allowMultipleRGroupsOnUnlabelled
unlabelled core atoms can have multiple rgroups
Definition RGroupDecompParams.h:60
RDKit::RGroupDecompositionParameters::addDummyAtomsToUnlabelledCoreAtoms
void addDummyAtomsToUnlabelledCoreAtoms(RWMol &core)
RDKit::RGroupDecompositionParameters::labels
unsigned int labels
Definition RGroupDecompParams.h:40
RDKit::RGroupDecompositionParameters::onlyMatchAtRGroups
bool onlyMatchAtRGroups
only allow rgroup decomposition at the specified rgroups
Definition RGroupDecompParams.h:49
RDKit::RGroupDecompositionParameters::removeAllHydrogenRGroups
bool removeAllHydrogenRGroups
remove all user-defined rgroups that only have hydrogens
Definition RGroupDecompParams.h:51
RDKit::RGroupDecompositionParameters::gaMaximumOperations
int gaMaximumOperations
Definition RGroupDecompParams.h:91
RDKit::RGroupDecompositionParameters::alignment
unsigned int alignment
Definition RGroupDecompParams.h:45
RDKit::RGroupDecompositionParameters::doEnumeration
bool doEnumeration
Definition RGroupDecompParams.h:66
RDKit::RGroupDecompositionParameters::autoGetLabels
unsigned int autoGetLabels(const RWMol &)
RDKit::RGroupDecompositionParameters::timeout
double timeout
timeout in seconds. <=0 indicates no timeout
Definition RGroupDecompParams.h:75
RDKit::RGroupDecompositionParameters::removeHydrogensPostMatch
bool removeHydrogensPostMatch
remove all hydrogens from the output molecules
Definition RGroupDecompParams.h:56
RDKit::RGroupDecompositionParameters::chunkSize
unsigned int chunkSize
Definition RGroupDecompParams.h:47
RDKit::RGroupDecompositionParameters::includeTargetMolInResults
bool includeTargetMolInResults
Definition RGroupDecompParams.h:73
RDKit::RGroupDecompositionParameters::gaNumberOperationsWithoutImprovement
int gaNumberOperationsWithoutImprovement
Definition RGroupDecompParams.h:94
RDKit::RGroupDecompositionParameters::allowMultipleCoresInSameMol
bool allowMultipleCoresInSameMol
Permit a core to match more than once in the same molecule if the sets of.
Definition RGroupDecompParams.h:63
RDKit::RGroupDecompositionParameters::scoreMethod
unsigned int scoreMethod
Definition RGroupDecompParams.h:42
RDKit::RGroupDecompositionParameters::rgroupLabelling
unsigned int rgroupLabelling
Definition RGroupDecompParams.h:43
RDKit::RGroupDecompositionParameters::doTautomers
bool doTautomers
Definition RGroupDecompParams.h:65
RDKit::RGroupDecompositionParameters::prepareCore
bool prepareCore(RWMol &, const RWMol *alignCore)
RDKit::RGroupDecompositionParameters::RGroupDecompositionParameters
RGroupDecompositionParameters()
Definition RGroupDecompParams.h:108
RDKit::RGroupDecompositionParameters::substructmatchParams
SubstructMatchParameters substructmatchParams
Definition RGroupDecompParams.h:106
RDKit::RGroupDecompositionParameters::gaParallelRuns
bool gaParallelRuns
Definition RGroupDecompParams.h:103
RDKit::SubstructMatchParameters
Definition SubstructMatch.h:42