RDKit
Open-source cheminformatics and machine learning.
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 
18 namespace RDKit {
19 
20 typedef enum {
21  IsotopeLabels = 0x01,
22  AtomMapLabels = 0x02,
26  DummyAtomLabels = 0x20, // These are rgroups but will get relabelled
27  AutoDetect = 0xFF,
28 } RGroupLabels;
29 
30 typedef enum {
31  Greedy = 0x01,
32  GreedyChunks = 0x02,
33  Exhaustive = 0x04, // not really useful for large sets
35  GA = 0x10,
37 
38 typedef enum {
39  AtomMap = 0x01,
40  Isotope = 0x02,
41  MDLRGroup = 0x04,
43 
44 typedef enum {
45  // DEPRECATED, remove the following line in release 2021.03
46  None = 0x0,
47  NoAlignment = 0x0,
48  MCS = 0x01,
50 
51 typedef enum {
52  Match = 0x1,
54 } RGroupScore;
55 
57  unsigned int labels = AutoDetect;
58  unsigned int matchingStrategy = GreedyChunks;
59  unsigned int scoreMethod = Match;
60  unsigned int rgroupLabelling = AtomMap | MDLRGroup;
61  unsigned int alignment = MCS;
62 
63  unsigned int chunkSize = 5;
64  //! only allow rgroup decomposition at the specified rgroups
65  bool onlyMatchAtRGroups = false;
66  //! remove all user-defined rgroups that only have hydrogens
67  bool removeAllHydrogenRGroups = true;
68  //! remove all user-defined rgroups that only have hydrogens,
69  //! and also remove the corresponding labels from the core
70  bool removeAllHydrogenRGroupsAndLabels = true;
71  //! remove all hydrogens from the output molecules
72  bool removeHydrogensPostMatch = true;
73  //! allow labelled Rgroups of degree 2 or more
74  bool allowNonTerminalRGroups = false;
75  // unlabelled core atoms can have multiple rgroups
76  bool allowMultipleRGroupsOnUnlabelled = false;
77 
78  double timeout = -1.0; ///< timeout in seconds. <=0 indicates no timeout
79 
80  // Determine how to assign the rgroup labels from the given core
81  unsigned int autoGetLabels(const RWMol &);
82 
83  // Prepare the core for substructure searching and rgroup assignment
84  bool prepareCore(RWMol &, const RWMol *alignCore);
85 
86  // Add r groups to unlabelled atoms if allowMultipleRGroupsOnUnlabelled is set
88 
89  // Parameters specific to GA
90 
91  // GA population size or -1 to use best guess
92  int gaPopulationSize = -1;
93  // GA maximum number of operations or -1 to use best guess
94  int gaMaximumOperations = -1;
95  // GA number of operations permitted without improvement before exiting (-1
96  // for best guess)
97  int gaNumberOperationsWithoutImprovement = -1;
98  // GA random number seed (-1 for default, -2 for random seed)
99  int gaRandomSeed = -1;
100  // Number of runs
101  int gaNumberRuns = 1;
102  // Sequential or parallel runs?
103 #ifdef RDK_BUILD_THREADSAFE_SSS
104  bool gaParallelRuns = true;
105 #else
106  bool gaParallelRuns = false;
107 #endif
108  // Controls the way substructure matching with the core is done
110 
111  RGroupDecompositionParameters() { substructmatchParams.useChirality = true; }
112 
113  private:
114  int indexOffset{-1};
115  void checkNonTerminal(const Atom &atom) const;
116 };
117 
118 } // namespace RDKit
119 
120 #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:401
Std stuff.
Definition: Abbreviations.h:19
@ FingerprintVariance
@ RelabelDuplicateLabels
void addDummyAtomsToUnlabelledCoreAtoms(RWMol &core)
unsigned int autoGetLabels(const RWMol &)
bool prepareCore(RWMol &, const RWMol *alignCore)
SubstructMatchParameters substructmatchParams