RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
SynthonSpaceSubstructureSearcher.h
Go to the documentation of this file.
1//
2// Copyright (C) David Cosgrove 2024.
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
11// This file declares a concrete class derived from SynthonSpaceSearcher
12// that does substructure searching of the SynthonSpace.
13
14#ifndef SYNTHONSPACESUBSTRUCTURESEARCHER_H
15#define SYNTHONSPACESUBSTRUCTURESEARCHER_H
16
17#include <RDGeneral/export.h>
19
21
22// Concrete class that does substructure searching using a query
23// molecule.
25 public:
28 const SubstructMatchParameters &matchParams,
29 const SynthonSpaceSearchParams &params,
30 SynthonSpace *space)
31 : SynthonSpaceSearcher(query, params, space),
32 d_matchParams(matchParams) {}
33
34 std::vector<std::unique_ptr<SynthonSpaceHitSet>> searchFragSet(
35 const std::vector<std::shared_ptr<ROMol>> &fragSet,
36 const SynthonSet &reaction) const override;
37
38 bool verifyHit(ROMol &hit, const std::string &rxnId,
39 const std::vector<const std::string *> &synthNames) override;
40
41 protected:
42 // In this case, it's just the number of atoms in the query
43 // divided by the number of atoms in the product.
45 const std::vector<size_t> &synthNums) const override;
46
47 private:
48 // These are the pattern fingerprints for the fragments in this
49 // search. They are used for screening the fragments prior to
50 // a substructure search. The pool contains the unique pattern
51 // fingerprints for all the unique fragments (based on SMILES) in
52 // the query fragment set.
53 std::vector<std::unique_ptr<ExplicitBitVect>> d_pattFPsPool;
54 std::vector<std::pair<void *, ExplicitBitVect *>> d_pattFPs;
55 SubstructMatchParameters d_matchParams;
56
57 // Likewise, the connector regions and connector region
58 // fingerprints.
59 std::vector<std::vector<std::unique_ptr<ROMol>>> d_connRegsPool;
60 std::vector<std::pair<void *, std::vector<std::unique_ptr<ROMol>> *>>
61 d_connRegs;
62 std::vector<std::vector<std::string>> d_connRegSmisPool;
63 std::vector<std::pair<void *, std::vector<std::string> *>> d_connRegSmis;
64 std::vector<std::vector<std::unique_ptr<ExplicitBitVect>>> d_connRegFPsPool;
65 std::vector<
66 std::pair<void *, std::vector<std::unique_ptr<ExplicitBitVect>> *>>
67 d_connRegFPs;
68
69 bool extraSearchSetup(
70 std::vector<std::vector<std::shared_ptr<ROMol>>> &fragSets,
71 const TimePoint *endTime) override;
72 unsigned int getNumQueryFragmentsRequired() override;
73
74 void getConnectorRegions(
75 const std::vector<std::shared_ptr<ROMol>> &molFrags,
76 std::vector<std::vector<ROMol *>> &connRegs,
77 std::vector<std::vector<const std::string *>> &connRegSmis,
78 std::vector<std::vector<ExplicitBitVect *>> &connRegFPs) const;
79};
80
81} // namespace RDKit::SynthonSpaceSearch
82
83#endif // SYNTHONSPACESUBSTRUCTURESEARCHER_H
std::chrono::time_point< Clock > TimePoint
double approxSimilarity(const SynthonSpaceHitSet *hitset, const std::vector< size_t > &synthNums) const override
bool verifyHit(ROMol &hit, const std::string &rxnId, const std::vector< const std::string * > &synthNames) override
std::vector< std::unique_ptr< SynthonSpaceHitSet > > searchFragSet(const std::vector< std::shared_ptr< ROMol > > &fragSet, const SynthonSet &reaction) const override
SynthonSpaceSubstructureSearcher(const ROMol &query, const SubstructMatchParameters &matchParams, const SynthonSpaceSearchParams &params, SynthonSpace *space)