RDKit
Open-source cheminformatics and machine learning.
Toggle main menu visibility
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
#include <memory>
14
#include <vector>
15
16
#include <string>
17
18
#include <
RDGeneral/export.h
>
19
#include <
GraphMol/SynthonSpaceSearch/SynthonShapeInput.h
>
20
#include <
GraphMol/SynthonSpaceSearch/SynthonSpaceSearchHelpers.h
>
21
22
class
ExplicitBitVect
;
23
24
namespace
RDKit
{
25
class
Atom
;
26
class
ROMol
;
27
class
RWMol
;
28
29
namespace
SynthonSpaceSearch
{
30
31
// These are the numbers of bits used in the internal fingerprints.
32
// The user is not restricted to these numbers for the search.
33
inline
constexpr
unsigned
int
PATT_FP_NUM_BITS
= 1024;
34
35
// This class holds a Synthon that will be part of a SynthonSet.
36
class
RDKIT_SYNTHONSPACESEARCH_EXPORT
Synthon
{
37
public
:
38
Synthon
() =
default
;
39
Synthon
(
const
std::string &smi);
40
Synthon
(
const
Synthon
&other);
41
Synthon
(
Synthon
&&other) =
default
;
42
Synthon
&
operator=
(
const
Synthon
&other);
43
Synthon
&
operator=
(
Synthon
&&other) =
default
;
44
45
const
std::string &
getSmiles
()
const
{
return
d_smiles; }
46
const
std::unique_ptr<ROMol> &
getOrigMol
()
const
;
47
const
std::unique_ptr<ROMol> &
getSearchMol
()
const
;
48
const
std::unique_ptr<ExplicitBitVect> &
getPattFP
()
const
;
49
const
std::unique_ptr<ExplicitBitVect> &
getFP
()
const
;
50
const
std::vector<std::shared_ptr<ROMol>> &
getConnRegions
()
const
;
51
void
setSearchMol
(std::unique_ptr<ROMol> mol);
52
void
setFP
(std::unique_ptr<ExplicitBitVect> fp);
53
unsigned
int
getNumDummies
()
const
{
return
d_numDummies; }
54
unsigned
int
getNumHeavyAtoms
()
const
{
return
d_numHeavyAtoms; }
55
unsigned
int
getNumChiralAtoms
()
const
{
return
d_numChiralAtoms; }
56
unsigned
int
getNumChiralAtomsExcDummies
()
const
{
57
return
d_numChiralAtomsExcDummies;
58
}
59
double
getMolWt
()
const
{
return
d_molWt; }
60
void
updateMaxSynthonSetSize
(
unsigned
int
newVal);
61
unsigned
int
getMaxSynthonSetSize
()
const
{
return
d_maxSynthonSetSize; }
62
void
clearShapes
();
63
void
setShapes
(std::unique_ptr<SynthonShapeInput> shapes);
64
const
std::unique_ptr<SynthonShapeInput> &
getShapes
()
const
;
65
// Writes to/reads from a binary stream.
66
void
writeToDBStream
(std::ostream &os)
const
;
67
void
readFromDBStream
(std::istream &is, std::uint32_t version);
68
69
private
:
70
std::string d_smiles;
71
72
// Keep 2 copies of the molecule. The first is as passed in, which
73
// will be used for building products. The second will have its
74
// atoms and bonds fiddled with to make them match the product (the
75
// aliphatic precursor to aromatic product issue). The search mol
76
// doesn't always work with product building.
77
std::unique_ptr<ROMol> dp_origMol{
nullptr
};
78
std::unique_ptr<ROMol> dp_searchMol{
nullptr
};
79
// The pattern fingerprint, used for substructure search screening.
80
std::unique_ptr<ExplicitBitVect> dp_pattFP{
nullptr
};
81
// The fingerprint of the dp_searchMol, used in fingerprint similarity
82
// searching. Its type is known by the SynthonSpace that holds the
83
// Synthon.
84
std::unique_ptr<ExplicitBitVect> dp_FP{
nullptr
};
85
std::unique_ptr<SynthonShapeInput> dp_shapes;
86
87
// SMILES strings of any connector regions. Normally there will only
88
// be 1 or 2. These are derived from the search mol.
89
std::vector<std::shared_ptr<ROMol>> d_connRegions;
90
91
unsigned
int
d_numDummies{0};
92
unsigned
int
d_numHeavyAtoms{0};
93
// As calculated by details::countChiralAtoms().
94
unsigned
int
d_numChiralAtoms{0};
95
// This is the number of chiral atoms excluding those that have 2 or
96
// more dummies attached.
97
unsigned
int
d_numChiralAtomsExcDummies{0};
98
double
d_molWt{0.0};
99
// The smallest SynthonSet size this synthon is in, where the SynthonSet
100
// size is the number of Synthons in 1 reaction, so 2-4 probably.
101
unsigned
int
d_maxSynthonSetSize{0};
102
103
// Once the search molecule has been added, get the connector regions,
104
// connector fingerprint etc.
105
void
finishInitialization();
106
// Calculate the number of dummy atoms etc.
107
void
calcProperties();
108
};
109
110
}
// namespace SynthonSpaceSearch
111
}
// namespace RDKit
112
113
#endif
// RDKIT_REAGENT_H
SynthonShapeInput.h
SynthonSpaceSearchHelpers.h
ExplicitBitVect
a class for bit vectors that are densely occupied
Definition
ExplicitBitVect.h:29
RDKit::Atom
The class for representing atoms.
Definition
Atom.h:75
RDKit::ROMol
Definition
ROMol.h:344
RDKit::RWMol
RWMol is a molecule class that is intended to be edited.
Definition
RWMol.h:32
RDKit::SynthonSpaceSearch::Synthon::writeToDBStream
void writeToDBStream(std::ostream &os) const
RDKit::SynthonSpaceSearch::Synthon::operator=
Synthon & operator=(const Synthon &other)
RDKit::SynthonSpaceSearch::Synthon::getPattFP
const std::unique_ptr< ExplicitBitVect > & getPattFP() const
RDKit::SynthonSpaceSearch::Synthon::getMolWt
double getMolWt() const
Definition
Synthon.h:59
RDKit::SynthonSpaceSearch::Synthon::Synthon
Synthon(const Synthon &other)
RDKit::SynthonSpaceSearch::Synthon::setShapes
void setShapes(std::unique_ptr< SynthonShapeInput > shapes)
RDKit::SynthonSpaceSearch::Synthon::getFP
const std::unique_ptr< ExplicitBitVect > & getFP() const
RDKit::SynthonSpaceSearch::Synthon::clearShapes
void clearShapes()
RDKit::SynthonSpaceSearch::Synthon::getNumHeavyAtoms
unsigned int getNumHeavyAtoms() const
Definition
Synthon.h:54
RDKit::SynthonSpaceSearch::Synthon::getSearchMol
const std::unique_ptr< ROMol > & getSearchMol() const
RDKit::SynthonSpaceSearch::Synthon::readFromDBStream
void readFromDBStream(std::istream &is, std::uint32_t version)
RDKit::SynthonSpaceSearch::Synthon::Synthon
Synthon(const std::string &smi)
RDKit::SynthonSpaceSearch::Synthon::getMaxSynthonSetSize
unsigned int getMaxSynthonSetSize() const
Definition
Synthon.h:61
RDKit::SynthonSpaceSearch::Synthon::getNumChiralAtomsExcDummies
unsigned int getNumChiralAtomsExcDummies() const
Definition
Synthon.h:56
RDKit::SynthonSpaceSearch::Synthon::getNumDummies
unsigned int getNumDummies() const
Definition
Synthon.h:53
RDKit::SynthonSpaceSearch::Synthon::updateMaxSynthonSetSize
void updateMaxSynthonSetSize(unsigned int newVal)
RDKit::SynthonSpaceSearch::Synthon::getOrigMol
const std::unique_ptr< ROMol > & getOrigMol() const
RDKit::SynthonSpaceSearch::Synthon::getNumChiralAtoms
unsigned int getNumChiralAtoms() const
Definition
Synthon.h:55
RDKit::SynthonSpaceSearch::Synthon::setFP
void setFP(std::unique_ptr< ExplicitBitVect > fp)
RDKit::SynthonSpaceSearch::Synthon::setSearchMol
void setSearchMol(std::unique_ptr< ROMol > mol)
RDKit::SynthonSpaceSearch::Synthon::operator=
Synthon & operator=(Synthon &&other)=default
RDKit::SynthonSpaceSearch::Synthon::Synthon
Synthon(Synthon &&other)=default
RDKit::SynthonSpaceSearch::Synthon::getSmiles
const std::string & getSmiles() const
Definition
Synthon.h:45
RDKit::SynthonSpaceSearch::Synthon::getShapes
const std::unique_ptr< SynthonShapeInput > & getShapes() const
RDKit::SynthonSpaceSearch::Synthon::getConnRegions
const std::vector< std::shared_ptr< ROMol > > & getConnRegions() const
RDKit::SynthonSpaceSearch::Synthon::Synthon
Synthon()=default
export.h
RDKIT_SYNTHONSPACESEARCH_EXPORT
#define RDKIT_SYNTHONSPACESEARCH_EXPORT
Definition
export.h:731
RDKit::SynthonSpaceSearch
Definition
MemoryMappedFileReader.h:19
RDKit::SynthonSpaceSearch::PATT_FP_NUM_BITS
constexpr unsigned int PATT_FP_NUM_BITS
Definition
Synthon.h:33
RDKit
Std stuff.
Definition
Abbreviations.h:19
GraphMol
SynthonSpaceSearch
Synthon.h
Generated on
for RDKit by
1.17.0