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// This class holds a Synthon that will be part of a SynthonSet.
27 public:
28 Synthon() = default;
29 Synthon(const std::string &smi, const std::string &id);
30 Synthon(const Synthon &other);
31 Synthon(Synthon &&other) = default;
32 Synthon &operator=(const Synthon &other);
33 Synthon &operator=(Synthon &&other) = default;
34
35 const std::string &getSmiles() const { return d_smiles; }
36 const std::string &getId() const { return d_id; }
37 const std::unique_ptr<ROMol> &getOrigMol() const;
38 const std::unique_ptr<ROMol> &getSearchMol() const;
39 const std::unique_ptr<ExplicitBitVect> &getPattFP() const;
40 const std::vector<std::shared_ptr<ROMol>> &getConnRegions() const;
41 void setSearchMol(std::unique_ptr<RWMol> mol);
42
43 // Writes to/reads from a binary stream.
44 void writeToDBStream(std::ostream &os) const;
45 void readFromDBStream(std::istream &is);
46
47 // Tag each atom and bond with the given molecule number and its index,
48 // so we can find them again in a product if necessary.
49 void tagAtomsAndBonds(int molNum) const;
50
51 private:
52 std::string d_smiles;
53 std::string d_id;
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 std::unique_ptr<ExplicitBitVect> dp_pattFP{nullptr};
63 // SMILES strings of any connector regions. Normally there will only
64 // be 1 or 2. These are derived from the search mol.
65 std::vector<std::shared_ptr<ROMol>> d_connRegions;
66
67 // One the search molecule has been added, get the connector regions,
68 // connector fingerprint etc.
69 void finishInitialization();
70};
71
72// Return a molecule containing the portions of the molecule starting at
73// each dummy atom and going out up to 3 bonds. There may be more than
74// 1 fragment if there are dummy atoms more than 3 bonds apart, and there
75// may be fragments with more than 1 dummy atom if their fragments fall
76// within 3 bonds of each other. E.g. the molecule [1*]CN(C[2*])Cc1ccccc1
77// will give [1*]CN(C)C[1*]. The 2 dummy atoms are 4 bonds apart, but the
78// fragments overlap. All dummy atoms given isotope 1 whatever they had before.
80 const ROMol &mol);
81
82} // namespace SynthonSpaceSearch
83} // namespace RDKit
84
85#endif // RDKIT_REAGENT_H
void setSearchMol(std::unique_ptr< RWMol > mol)
void writeToDBStream(std::ostream &os) const
Synthon & operator=(const Synthon &other)
const std::unique_ptr< ExplicitBitVect > & getPattFP() const
const std::string & getId() const
Definition Synthon.h:36
Synthon(const Synthon &other)
const std::unique_ptr< ROMol > & getSearchMol() const
const std::unique_ptr< ROMol > & getOrigMol() const
Synthon & operator=(Synthon &&other)=default
Synthon(Synthon &&other)=default
const std::string & getSmiles() const
Definition Synthon.h:35
Synthon(const std::string &smi, const std::string &id)
void tagAtomsAndBonds(int molNum) const
const std::vector< std::shared_ptr< ROMol > > & getConnRegions() const
void readFromDBStream(std::istream &is)
#define RDKIT_SYNTHONSPACESEARCH_EXPORT
Definition export.h:545
RDKIT_SYNTHONSPACESEARCH_EXPORT std::unique_ptr< ROMol > getConnRegion(const ROMol &mol)
Std stuff.