RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
FMCS.h
Go to the documentation of this file.
1//
2// Copyright (C) 2014 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#pragma once
12#include <vector>
13#include <string>
14#include <stdexcept>
15#include "../RDKitBase.h"
16#include "Graph.h"
17
18namespace RDKit {
19struct MCSParameters;
20
27
33
39
41 bool MatchValences = false;
42 bool MatchChiralTag = false;
43 bool MatchFormalCharge = false;
44 bool RingMatchesRingOnly = false;
45 bool CompleteRingsOnly = false;
46 bool MatchIsotope = false;
47 double MaxDistance = -1.0;
48};
49
51 bool RingMatchesRingOnly = false;
52 bool CompleteRingsOnly = false;
53 bool MatchFusedRings = false;
54 bool MatchFusedRingsStrict = false;
55 bool MatchStereo = false;
56};
57
59 const std::uint32_t c1[], const std::uint32_t c2[], const ROMol& mol1,
60 const FMCS::Graph& query, const ROMol& mol2, const FMCS::Graph& target,
61 const MCSParameters* p);
63 const ROMol& mol1, unsigned int atom1,
64 const ROMol& mol2, unsigned int atom2,
65 void* userData);
67 const ROMol& mol1, unsigned int bond1,
68 const ROMol& mol2, unsigned int bond2,
69 void* userData);
70
71// Some predefined functors:
73 const ROMol& mol1, unsigned int atom1,
74 const ROMol& mol2,
75 unsigned int atom2);
77 const ROMol& mol1, unsigned int atom1,
78 const ROMol& mol2, unsigned int atom2);
80 const ROMol& mol1, unsigned int atom1,
81 const ROMol& mol2,
82 unsigned int atom2);
84 const ROMol& mol1, unsigned int atom1,
85 const ROMol& mol2, unsigned int atom2);
86
88 const ROMol& mol1, unsigned int atom1,
89 const ROMol& mol2, unsigned int atom2,
90 void* userData);
92 const MCSAtomCompareParameters& p, const ROMol& mol1, unsigned int atom1,
93 const ROMol& mol2, unsigned int atom2, void* userData);
94
96 const MCSAtomCompareParameters& p, const ROMol& mol1, unsigned int atom1,
97 const ROMol& mol2, unsigned int atom2, void* userData);
99 const MCSAtomCompareParameters& p, const ROMol& mol1, unsigned int atom1,
100 const ROMol& mol2, unsigned int atom2, void* userData);
101
103 const ROMol& mol1, unsigned int bond1,
104 const ROMol& mol2, unsigned int bond2);
106 const ROMol& mol1, unsigned int bond1,
107 const ROMol& mol2, unsigned int bond2,
109
111 const ROMol& mol1, unsigned int bond1,
112 const ROMol& mol2, unsigned int bond2,
113 void* userData);
115 const MCSBondCompareParameters& p, const ROMol& mol1, unsigned int bond1,
116 const ROMol& mol2, unsigned int bond2,
117 void* userData); // ignore Aromatization
119 const MCSBondCompareParameters& p, const ROMol& mol1, unsigned int bond1,
120 const ROMol& mol2, unsigned int bond2, void* userData);
121
123 unsigned NumAtoms{0};
124 unsigned NumBonds{0};
125 unsigned SeedProcessed{0};
126
127 public:
129};
130
132 const MCSParameters& params,
133 void* userData);
135 const MCSParameters& params,
136 void* userData);
137
139 bool MaximizeBonds = true;
140 double Threshold = 1.0; // match all molecules
141 unsigned Timeout = -1; // in seconds
142 bool Verbose = false;
147 void* CompareFunctionsUserData = nullptr;
148 MCSProgressCallback ProgressCallback =
149 nullptr; // return false to interrupt execution
150 void* ProgressCallbackUserData = nullptr;
151 MCSFinalMatchCheckFunction FinalMatchChecker =
152 nullptr; // FinalMatchCheckFunction() to check chirality and ring fusion
153 std::string InitialSeed = ""; // user defined or empty string (default)
155 void setMCSAtomTyperFromConstChar(const char* atomComp);
157 void setMCSBondTyperFromConstChar(const char* bondComp);
158};
159
161 unsigned NumAtoms{0};
162 unsigned NumBonds{0};
163 std::string SmartsString;
164 bool Canceled{false}; // interrupted by timeout or user defined progress
165 // callback. Contains valid current MCS !
167
168 public:
170 bool isCompleted() const { return !Canceled; }
171};
172
174 MCSParameters* params);
175
176RDKIT_FMCS_EXPORT MCSResult findMCS(const std::vector<ROMOL_SPTR>& mols,
177 const MCSParameters* params = nullptr);
178RDKIT_FMCS_EXPORT MCSResult findMCS_P(const std::vector<ROMOL_SPTR>& mols,
179 const char* params_json);
180
182 const std::vector<ROMOL_SPTR>& mols, bool maximizeBonds, double threshold,
183 unsigned timeout, bool verbose, bool matchValences,
187findMCS(const std::vector<ROMOL_SPTR>& mols, bool maximizeBonds,
188 double threshold = 1.0, unsigned timeout = 3600, bool verbose = false,
189 bool matchValences = false, bool ringMatchesRingOnly = false,
190 bool completeRingsOnly = false, bool matchChiralTag = false,
193
194} // namespace RDKit
#define RDKIT_FMCS_EXPORT
Definition export.h:153
Std stuff.
bool(* MCSAtomCompareFunction)(const MCSAtomCompareParameters &p, const ROMol &mol1, unsigned int atom1, const ROMol &mol2, unsigned int atom2, void *userData)
Definition FMCS.h:62
RDKIT_FMCS_EXPORT MCSResult findMCS_P(const std::vector< ROMOL_SPTR > &mols, const char *params_json)
RDKIT_FMCS_EXPORT bool MCSAtomCompareAnyHeavyAtom(const MCSAtomCompareParameters &p, const ROMol &mol1, unsigned int atom1, const ROMol &mol2, unsigned int atom2, void *userData)
AtomComparator
Definition FMCS.h:21
@ AtomCompareElements
Definition FMCS.h:23
@ AtomCompareAnyHeavyAtom
Definition FMCS.h:25
@ AtomCompareAny
Definition FMCS.h:22
@ AtomCompareIsotopes
Definition FMCS.h:24
bool rdvalue_is(const RDValue_cast_t)
BondComparator
Definition FMCS.h:28
@ BondCompareOrderExact
Definition FMCS.h:31
@ BondCompareAny
Definition FMCS.h:29
@ BondCompareOrder
Definition FMCS.h:30
RDKIT_FMCS_EXPORT bool MCSAtomCompareElements(const MCSAtomCompareParameters &p, const ROMol &mol1, unsigned int atom1, const ROMol &mol2, unsigned int atom2, void *userData)
RDKIT_FMCS_EXPORT bool checkAtomDistance(const MCSAtomCompareParameters &p, const ROMol &mol1, unsigned int atom1, const ROMol &mol2, unsigned int atom2)
RDKIT_FMCS_EXPORT bool checkBondStereo(const MCSBondCompareParameters &p, const ROMol &mol1, unsigned int bond1, const ROMol &mol2, unsigned int bond2)
RDKIT_FMCS_EXPORT void parseMCSParametersJSON(const char *json, MCSParameters *params)
RDKIT_FMCS_EXPORT bool MCSBondCompareAny(const MCSBondCompareParameters &p, const ROMol &mol1, unsigned int bond1, const ROMol &mol2, unsigned int bond2, void *userData)
RDKIT_FMCS_EXPORT MCSResult findMCS(const std::vector< ROMOL_SPTR > &mols, const MCSParameters *params=nullptr)
RDKIT_FMCS_EXPORT bool MCSAtomCompareAny(const MCSAtomCompareParameters &p, const ROMol &mol1, unsigned int atom1, const ROMol &mol2, unsigned int atom2, void *userData)
RDKIT_FMCS_EXPORT bool MCSBondCompareOrder(const MCSBondCompareParameters &p, const ROMol &mol1, unsigned int bond1, const ROMol &mol2, unsigned int bond2, void *userData)
RDKIT_FMCS_EXPORT bool checkAtomRingMatch(const MCSAtomCompareParameters &p, const ROMol &mol1, unsigned int atom1, const ROMol &mol2, unsigned int atom2)
RingComparator
Definition FMCS.h:34
@ StrictRingFusion
Definition FMCS.h:37
@ IgnoreRingFusion
Definition FMCS.h:35
@ PermissiveRingFusion
Definition FMCS.h:36
RDKIT_FMCS_EXPORT bool checkAtomCharge(const MCSAtomCompareParameters &p, const ROMol &mol1, unsigned int atom1, const ROMol &mol2, unsigned int atom2)
RDKIT_FMCS_EXPORT bool MCSAtomCompareIsotopes(const MCSAtomCompareParameters &p, const ROMol &mol1, unsigned int atom1, const ROMol &mol2, unsigned int atom2, void *userData)
RDKIT_FMCS_EXPORT bool checkBondRingMatch(const MCSBondCompareParameters &p, const ROMol &mol1, unsigned int bond1, const ROMol &mol2, unsigned int bond2, void *v_ringMatchMatrixSet)
boost::shared_ptr< ROMol > ROMOL_SPTR
bool(* MCSBondCompareFunction)(const MCSBondCompareParameters &p, const ROMol &mol1, unsigned int bond1, const ROMol &mol2, unsigned int bond2, void *userData)
Definition FMCS.h:66
RDKIT_FMCS_EXPORT bool checkAtomChirality(const MCSAtomCompareParameters &p, const ROMol &mol1, unsigned int atom1, const ROMol &mol2, unsigned int atom2)
bool(* MCSProgressCallback)(const MCSProgressData &stat, const MCSParameters &params, void *userData)
Definition FMCS.h:131
RDKIT_FMCS_EXPORT bool MCSProgressCallbackTimeout(const MCSProgressData &stat, const MCSParameters &params, void *userData)
bool(* MCSFinalMatchCheckFunction)(const std::uint32_t c1[], const std::uint32_t c2[], const ROMol &mol1, const FMCS::Graph &query, const ROMol &mol2, const FMCS::Graph &target, const MCSParameters *p)
Definition FMCS.h:58
RDKIT_FMCS_EXPORT bool MCSBondCompareOrderExact(const MCSBondCompareParameters &p, const ROMol &mol1, unsigned int bond1, const ROMol &mol2, unsigned int bond2, void *userData)
void setMCSBondTyperFromEnum(BondComparator bondComp)
void setMCSBondTyperFromConstChar(const char *bondComp)
void setMCSAtomTyperFromConstChar(const char *atomComp)
void setMCSAtomTyperFromEnum(AtomComparator atomComp)
MCSAtomCompareParameters AtomCompareParameters
Definition FMCS.h:143
MCSBondCompareParameters BondCompareParameters
Definition FMCS.h:144
ROMOL_SPTR QueryMol
Definition FMCS.h:166
std::string SmartsString
Definition FMCS.h:163
bool isCompleted() const
Definition FMCS.h:170