RDKit
Open-source cheminformatics and machine learning.
Toggle main menu visibility
Loading...
Searching...
No Matches
ReactionFingerprints.h
Go to the documentation of this file.
1
//
2
// Copyright (c) 2014, Novartis Institutes for BioMedical Research Inc.
3
// All rights reserved.
4
//
5
// Redistribution and use in source and binary forms, with or without
6
// modification, are permitted provided that the following conditions are
7
// met:
8
//
9
// * Redistributions of source code must retain the above copyright
10
// notice, this list of conditions and the following disclaimer.
11
// * Redistributions in binary form must reproduce the above
12
// copyright notice, this list of conditions and the following
13
// disclaimer in the documentation and/or other materials provided
14
// with the distribution.
15
// * Neither the name of Novartis Institutes for BioMedical Research Inc.
16
// nor the names of its contributors may be used to endorse or promote
17
// products derived from this software without specific prior written
18
// permission.
19
//
20
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
//
32
#include <
RDGeneral/export.h
>
33
#ifndef RD_REACTIONFINGERPRINTS_H
34
#define RD_REACTIONFINGERPRINTS_H
35
36
#include <
DataStructs/SparseIntVect.h
>
37
#include <
DataStructs/ExplicitBitVect.h
>
38
39
namespace
RDKit
{
40
41
class
ChemicalReaction
;
42
43
enum class
FingerprintType
{
44
AtomPairFP
= 1,
45
TopologicalTorsionFP
,
46
MorganFP
,
47
RDKitFP
,
48
PatternFP
49
};
50
51
//! A struct for storing parameters to manipulate
52
//! the calculation of fingerprints of chemical reactions
53
/*!
54
Different parameters can be chosen to influence the generation
55
of chemical reaction fingerprints. Generally different setting
56
should be used for structural or difference fingerprints.
57
58
\param includeAgents include the agents of a reaction for fingerprint
59
generation
60
\param bitRatioAgents in structural fingerprints it determines the
61
ratio of bits of
62
the agents in the fingerprint
63
\param nonAgentWeight in difference fingerprints weight factor for
64
reactants and products
65
compared to agents
66
\param agentWeight if agents are included, agents could be weighted
67
compared to reactants
68
and products in difference fingerprints
69
\param fpSize number of bits of the fingerprint
70
\param fpType kind of fingerprint used, e.g AtompairFP. Be
71
aware that only AtompairFP,
72
TopologicalTorsion and MorganFP were supported in
73
the difference fingerprint.
74
*/
75
struct
RDKIT_CHEMREACTIONS_EXPORT
ReactionFingerprintParams
{
76
ReactionFingerprintParams
() {}
77
78
ReactionFingerprintParams
(
bool
includeAgents
,
double
bitRatioAgents
,
79
unsigned
int
nonAgentWeight
,
int
agentWeight
,
80
unsigned
int
fpSize
,
FingerprintType
fpType
)
81
:
includeAgents
(
includeAgents
),
82
bitRatioAgents
(
bitRatioAgents
),
83
nonAgentWeight
(
nonAgentWeight
),
84
agentWeight
(
agentWeight
),
85
fpSize
(
fpSize
),
86
fpType
(
fpType
) {}
87
88
bool
includeAgents
{
false
};
89
double
bitRatioAgents
{0.2};
90
unsigned
int
nonAgentWeight
{10};
91
int
agentWeight
{1};
92
unsigned
int
fpSize
{2048};
93
FingerprintType
fpType
{
FingerprintType::AtomPairFP
};
94
};
95
96
RDKIT_CHEMREACTIONS_EXPORT
extern
const
ReactionFingerprintParams
97
DefaultStructuralFPParams
;
98
RDKIT_CHEMREACTIONS_EXPORT
extern
const
ReactionFingerprintParams
99
DefaultDifferenceFPParams
;
100
101
//! Generates a structural fingerprint for a reaction
102
//! to use in screening
103
/*!
104
A structural fingerprint is generated as an ExplicitBitVect to use for
105
searching
106
e.g. substructure in reactions. By default the fingerprint is generated as
107
4096 BitVect
108
using a PatternFP for reactants and products and tentatively agents which
109
were finally concatenated
110
111
\param rxn: the reaction to be fingerprinted
112
\param params: specific settings to manipulate fingerprint generation
113
114
\return the reaction fingerprint, as an ExplicitBitVect
115
116
<b>Notes:</b>
117
- the caller is responsible for <tt>delete</tt>ing the result
118
*/
119
RDKIT_CHEMREACTIONS_EXPORT
ExplicitBitVect
*
StructuralFingerprintChemReaction
(
120
const
ChemicalReaction
&rxn,
121
const
ReactionFingerprintParams
¶ms =
DefaultStructuralFPParams
);
122
123
//! Generates a difference fingerprint for a reaction
124
//! to use in similarity search of reactions
125
/*!
126
A difference fingerprint is generated as a SparseIntVect to use for
127
similarity search of reactions. By default the fingerprint is generated as
128
2048 bit
129
hashed fingerprint subtracting AtompairFP of the reactants from the products'
130
AtompairFP
131
and tentatively the agent AtompairFP is added
132
133
\param rxn: the reaction to be fingerprinted
134
\param params: specific settings to manipulate fingerprint generation
135
136
\return the reaction fingerprint, as an SparseIntVec
137
138
<b>Notes:</b>
139
- the caller is responsible for <tt>delete</tt>ing the result
140
*/
141
RDKIT_CHEMREACTIONS_EXPORT
SparseIntVect<std::uint32_t>
*
142
DifferenceFingerprintChemReaction
(
143
const
ChemicalReaction
&rxn,
144
const
ReactionFingerprintParams
¶ms =
DefaultDifferenceFPParams
);
145
}
// namespace RDKit
146
147
#endif
ExplicitBitVect.h
SparseIntVect.h
ExplicitBitVect
a class for bit vectors that are densely occupied
Definition
ExplicitBitVect.h:29
RDKit::ChemicalReaction
This is a class for storing and applying general chemical reactions.
Definition
Reaction.h:122
RDKit::SparseIntVect
a class for efficiently storing sparse vectors of ints
Definition
SparseIntVect.h:28
export.h
RDKIT_CHEMREACTIONS_EXPORT
#define RDKIT_CHEMREACTIONS_EXPORT
Definition
export.h:71
RDKit::RDKitFP
Definition
RDKitFPGenerator.h:18
RDKit
Std stuff.
Definition
Abbreviations.h:19
RDKit::StructuralFingerprintChemReaction
RDKIT_CHEMREACTIONS_EXPORT ExplicitBitVect * StructuralFingerprintChemReaction(const ChemicalReaction &rxn, const ReactionFingerprintParams ¶ms=DefaultStructuralFPParams)
RDKit::DifferenceFingerprintChemReaction
RDKIT_CHEMREACTIONS_EXPORT SparseIntVect< std::uint32_t > * DifferenceFingerprintChemReaction(const ChemicalReaction &rxn, const ReactionFingerprintParams ¶ms=DefaultDifferenceFPParams)
RDKit::DefaultStructuralFPParams
RDKIT_CHEMREACTIONS_EXPORT const ReactionFingerprintParams DefaultStructuralFPParams
RDKit::DefaultDifferenceFPParams
RDKIT_CHEMREACTIONS_EXPORT const ReactionFingerprintParams DefaultDifferenceFPParams
RDKit::FingerprintType
FingerprintType
Definition
ReactionFingerprints.h:43
RDKit::FingerprintType::TopologicalTorsionFP
@ TopologicalTorsionFP
Definition
ReactionFingerprints.h:45
RDKit::FingerprintType::MorganFP
@ MorganFP
Definition
ReactionFingerprints.h:46
RDKit::FingerprintType::PatternFP
@ PatternFP
Definition
ReactionFingerprints.h:48
RDKit::FingerprintType::AtomPairFP
@ AtomPairFP
Definition
ReactionFingerprints.h:44
RDKit::ReactionFingerprintParams
Definition
ReactionFingerprints.h:75
RDKit::ReactionFingerprintParams::bitRatioAgents
double bitRatioAgents
Definition
ReactionFingerprints.h:89
RDKit::ReactionFingerprintParams::ReactionFingerprintParams
ReactionFingerprintParams()
Definition
ReactionFingerprints.h:76
RDKit::ReactionFingerprintParams::includeAgents
bool includeAgents
Definition
ReactionFingerprints.h:88
RDKit::ReactionFingerprintParams::ReactionFingerprintParams
ReactionFingerprintParams(bool includeAgents, double bitRatioAgents, unsigned int nonAgentWeight, int agentWeight, unsigned int fpSize, FingerprintType fpType)
Definition
ReactionFingerprints.h:78
RDKit::ReactionFingerprintParams::fpType
FingerprintType fpType
Definition
ReactionFingerprints.h:93
RDKit::ReactionFingerprintParams::fpSize
unsigned int fpSize
Definition
ReactionFingerprints.h:92
RDKit::ReactionFingerprintParams::nonAgentWeight
unsigned int nonAgentWeight
Definition
ReactionFingerprints.h:90
RDKit::ReactionFingerprintParams::agentWeight
int agentWeight
Definition
ReactionFingerprints.h:91
GraphMol
ChemReactions
ReactionFingerprints.h
Generated on
for RDKit by
1.17.0