RDKit
Open-source cheminformatics and machine learning.
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 
38 
39 namespace RDKit {
40 
41 class ChemicalReaction;
42 
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  */
77  : includeAgents(false),
78  bitRatioAgents(0.2),
79  nonAgentWeight(10),
80  agentWeight(1),
81  fpSize(2048),
82  fpType(AtomPairFP) {}
83 
84  ReactionFingerprintParams(bool includeAgents, double bitRatioAgents,
85  unsigned int nonAgentWeight, int agentWeight,
86  unsigned int fpSize, FingerprintType fpType)
87  : includeAgents(includeAgents),
88  bitRatioAgents(bitRatioAgents),
89  nonAgentWeight(nonAgentWeight),
90  agentWeight(agentWeight),
91  fpSize(fpSize),
92  fpType(fpType) {}
93 
96  unsigned int nonAgentWeight;
98  unsigned int fpSize;
100 };
101 
106 
107 //! Generates a structural fingerprint for a reaction
108 //! to use in screening
109 /*!
110  A structural fingerprint is generated as an ExplicitBitVect to use for
111  searching
112  e.g. substructure in reactions. By default the fingerprint is generated as
113  4096 BitVect
114  using a PatternFP for reactants and products and tentatively agents which
115  were finally concatenated
116 
117  \param rxn: the reaction to be fingerprinted
118  \param params: specific settings to manipulate fingerprint generation
119 
120  \return the reaction fingerprint, as an ExplicitBitVect
121 
122  <b>Notes:</b>
123  - the caller is responsible for <tt>delete</tt>ing the result
124 */
126  const ChemicalReaction &rxn,
128 
129 //! Generates a difference fingerprint for a reaction
130 //! to use in similarity search of reactions
131 /*!
132  A difference fingerprint is generated as a SparseIntVect to use for
133  similarity search of reactions. By default the fingerprint is generated as
134  2048 bit
135  hashed fingerprint subtracting AtompairFP of the reactants from the products'
136  AtompairFP
137  and tentatively the agent AtompairFP is added
138 
139  \param rxn: the reaction to be fingerprinted
140  \param params: specific settings to manipulate fingerprint generation
141 
142  \return the reaction fingerprint, as an SparseIntVec
143 
144  <b>Notes:</b>
145  - the caller is responsible for <tt>delete</tt>ing the result
146 */
149  const ChemicalReaction &rxn,
151 } // namespace RDKit
152 
153 #endif
RDKit::ReactionFingerprintParams::ReactionFingerprintParams
ReactionFingerprintParams()
Definition: ReactionFingerprints.h:76
RDKit::RDKitFP
@ RDKitFP
Definition: ReactionFingerprints.h:47
RDKit::TopologicalTorsion
@ TopologicalTorsion
Definition: ReactionFingerprints.h:45
RDKit::AtomPairFP
@ AtomPairFP
Definition: ReactionFingerprints.h:44
RDKit::ReactionFingerprintParams::includeAgents
bool includeAgents
Definition: ReactionFingerprints.h:94
RDKit::PatternFP
@ PatternFP
Definition: ReactionFingerprints.h:48
RDKit::ReactionFingerprintParams::bitRatioAgents
double bitRatioAgents
Definition: ReactionFingerprints.h:95
ExplicitBitVect.h
RDKit::DefaultDifferenceFPParams
const RDKIT_CHEMREACTIONS_EXPORT ReactionFingerprintParams DefaultDifferenceFPParams
RDKit::ReactionFingerprintParams::ReactionFingerprintParams
ReactionFingerprintParams(bool includeAgents, double bitRatioAgents, unsigned int nonAgentWeight, int agentWeight, unsigned int fpSize, FingerprintType fpType)
Definition: ReactionFingerprints.h:84
RDKit::DifferenceFingerprintChemReaction
RDKIT_CHEMREACTIONS_EXPORT SparseIntVect< std::uint32_t > * DifferenceFingerprintChemReaction(const ChemicalReaction &rxn, const ReactionFingerprintParams &params=DefaultDifferenceFPParams)
RDKit::StructuralFingerprintChemReaction
RDKIT_CHEMREACTIONS_EXPORT ExplicitBitVect * StructuralFingerprintChemReaction(const ChemicalReaction &rxn, const ReactionFingerprintParams &params=DefaultStructuralFPParams)
RDKit::ChemicalReaction
This is a class for storing and applying general chemical reactions.
Definition: Reaction.h:119
RDKit::ReactionFingerprintParams::nonAgentWeight
unsigned int nonAgentWeight
Definition: ReactionFingerprints.h:96
RDKit::MorganFP
@ MorganFP
Definition: ReactionFingerprints.h:46
RDKit::DefaultStructuralFPParams
const RDKIT_CHEMREACTIONS_EXPORT ReactionFingerprintParams DefaultStructuralFPParams
RDKit::ReactionFingerprintParams
Definition: ReactionFingerprints.h:75
RDKit
Std stuff.
Definition: Atom.h:30
RDKIT_CHEMREACTIONS_EXPORT
#define RDKIT_CHEMREACTIONS_EXPORT
Definition: export.h:60
SparseIntVect.h
RDKit::ReactionFingerprintParams::fpSize
unsigned int fpSize
Definition: ReactionFingerprints.h:98
RDKit::ReactionFingerprintParams::agentWeight
int agentWeight
Definition: ReactionFingerprints.h:97
RDKit::FingerprintType
FingerprintType
Definition: ReactionFingerprints.h:43
RDKit::ReactionFingerprintParams::fpType
FingerprintType fpType
Definition: ReactionFingerprints.h:99
RDKit::SparseIntVect
a class for efficiently storing sparse vectors of ints
Definition: SparseIntVect.h:28
ExplicitBitVect
a class for bit vectors that are densely occupied
Definition: ExplicitBitVect.h:29
export.h