RDKit
Open-source cheminformatics and machine learning.
Loading...
Searching...
No Matches
Synthon.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#ifndef RDKIT_REAGENT_H
12#define RDKIT_REAGENT_H
13
14#include <string>
15
16#include <RDGeneral/export.h>
17
18namespace RDKit {
19class Atom;
20class ROMol;
21class RWMol;
22
23namespace SynthonSpaceSearch {
24
25// These are the numbers of bits used in the internal fingerprints.
26// The user is not restricted to these numbers for the search.
27inline constexpr unsigned int PATT_FP_NUM_BITS = 1024;
28
29// This class holds a Synthon that will be part of a SynthonSet.
31 public:
32 Synthon() = default;
33 Synthon(const std::string &smi);
34 Synthon(const Synthon &other);
35 Synthon(Synthon &&other) = default;
36 Synthon &operator=(const Synthon &other);
37 Synthon &operator=(Synthon &&other) = default;
38
39 const std::string &getSmiles() const { return d_smiles; }
40 const std::unique_ptr<ROMol> &getOrigMol() const;
41 const std::unique_ptr<ROMol> &getSearchMol() const;
42 const std::unique_ptr<ExplicitBitVect> &getPattFP() const;
43 const std::unique_ptr<ExplicitBitVect> &getFP() const;
44 const std::vector<std::shared_ptr<ROMol>> &getConnRegions() const;
45 void setSearchMol(std::unique_ptr<ROMol> mol);
46 void setFP(std::unique_ptr<ExplicitBitVect> fp);
47
48 // Writes to/reads from a binary stream.
49 void writeToDBStream(std::ostream &os) const;
50 void readFromDBStream(std::istream &is);
51
52 private:
53 std::string d_smiles;
54
55 // Keep 2 copies of the molecule. The first is as passed in, which
56 // will be used for building products. The second will have its
57 // atoms and bonds fiddled with to make them match the product (the
58 // aliphatic precursor to aromatic product issue). The search mol
59 // doesn't always work with product building.
60 std::unique_ptr<ROMol> dp_origMol{nullptr};
61 std::unique_ptr<ROMol> dp_searchMol{nullptr};
62 // The pattern fingerprint, used for substructure search screening.
63 std::unique_ptr<ExplicitBitVect> dp_pattFP{nullptr};
64 // The fingerprint of the dp_searchMol, used in fingerprint similarity
65 // searching. Its type is known by the SynthonSpace that holds the
66 // Synthon.
67 std::unique_ptr<ExplicitBitVect> dp_FP{nullptr};
68 // SMILES strings of any connector regions. Normally there will only
69 // be 1 or 2. These are derived from the search mol.
70 std::vector<std::shared_ptr<ROMol>> d_connRegions;
71
72 // Once the search molecule has been added, get the connector regions,
73 // connector fingerprint etc.
74 void finishInitialization();
75};
76
77} // namespace SynthonSpaceSearch
78} // namespace RDKit
79
80#endif // RDKIT_REAGENT_H
void writeToDBStream(std::ostream &os) const
Synthon & operator=(const Synthon &other)
const std::unique_ptr< ExplicitBitVect > & getPattFP() const
Synthon(const Synthon &other)
const std::unique_ptr< ExplicitBitVect > & getFP() const
const std::unique_ptr< ROMol > & getSearchMol() const
Synthon(const std::string &smi)
const std::unique_ptr< ROMol > & getOrigMol() const
void setFP(std::unique_ptr< ExplicitBitVect > fp)
void setSearchMol(std::unique_ptr< ROMol > mol)
Synthon & operator=(Synthon &&other)=default
Synthon(Synthon &&other)=default
const std::string & getSmiles() const
Definition Synthon.h:39
const std::vector< std::shared_ptr< ROMol > > & getConnRegions() const
void readFromDBStream(std::istream &is)
#define RDKIT_SYNTHONSPACESEARCH_EXPORT
Definition export.h:545
constexpr unsigned int PATT_FP_NUM_BITS
Definition Synthon.h:27
Std stuff.