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 #ifndef RD_REACTIONFINGERPRINTS_H
33 #define RD_REACTIONFINGERPRINTS_H
34 
37 
38 namespace RDKit {
39 
40 class ChemicalReaction;
41 
48 };
49 
50 //! A struct for storing parameters to manipulate
51 //! the calculation of fingerprints of chemical reactions
52 /*!
53  Different parameters can be chosen to influence the generation
54  of chemical reaction fingerprints. Generally different setting
55  should be used for structural or difference fingerprints.
56 
57  \param includeAgents include the agents of a reaction for fingerprint
58  generation
59  \param bitRatioAgents in structural fingerprints it determines the
60  ratio of bits of
61  the agents in the fingerprint
62  \param nonAgentWeight in difference fingerprints weight factor for
63  reactants and products
64  compared to agents
65  \param agentWeight if agents are included, agents could be weighted
66  compared to reactants
67  and products in difference fingerprints
68  \param fpSize number of bits of the fingerprint
69  \param fpType kind of fingerprint used, e.g AtompairFP. Be
70  aware that only AtompairFP,
71  TopologicalTorsion and MorganFP were supported in
72  the difference fingerprint.
73  */
76  : includeAgents(false),
77  bitRatioAgents(0.2),
78  nonAgentWeight(10),
79  agentWeight(1),
80  fpSize(2048),
81  fpType(AtomPairFP) {}
82 
84  unsigned int nonAgentWeight, int agentWeight,
85  unsigned int fpSize, FingerprintType fpType)
86  : includeAgents(includeAgents),
87  bitRatioAgents(bitRatioAgents),
88  nonAgentWeight(nonAgentWeight),
89  agentWeight(agentWeight),
90  fpSize(fpSize),
91  fpType(fpType) {}
92 
95  unsigned int nonAgentWeight;
97  unsigned int fpSize;
99 };
100 
101 const ReactionFingerprintParams DefaultStructuralFPParams(true, 0.2, 1, 1, 4096,
102  PatternFP);
104  2048, AtomPairFP);
105 
106 //! Generates a structural fingerprint for a reaction
107 //! to use in screening
108 /*!
109  A structural fingerprint is generated as an ExplicitBitVect to use for
110  searching
111  e.g. substructure in reactions. By default the fingerprint is generated as
112  4096 BitVect
113  using a PatternFP for reactants and products and tentatively agents which
114  were finally concatenated
115 
116  \param rxn: the reaction to be fingerprinted
117  \param params: specific settings to manipulate fingerprint generation
118 
119  \return the reaction fingerprint, as an ExplicitBitVect
120 
121  <b>Notes:</b>
122  - the caller is responsible for <tt>delete</tt>ing the result
123 */
125  const ChemicalReaction &rxn,
127 
128 //! Generates a difference fingerprint for a reaction
129 //! to use in similarity search of reactions
130 /*!
131  A difference fingerprint is generated as a SparseIntVect to use for
132  similarity search of reactions. By default the fingerprint is generated as
133  2048 bit
134  hashed fingerprint subtracting AtompairFP of the reactants from the products'
135  AtompairFP
136  and tentatively the agent AtompairFP is added
137 
138  \param rxn: the reaction to be fingerprinted
139  \param params: specific settings to manipulate fingerprint generation
140 
141  \return the reaction fingerprint, as an SparseIntVec
142 
143  <b>Notes:</b>
144  - the caller is responsible for <tt>delete</tt>ing the result
145 */
147  const ChemicalReaction &rxn,
149 }
150 
151 #endif
SparseIntVect< boost::uint32_t > * DifferenceFingerprintChemReaction(const ChemicalReaction &rxn, const ReactionFingerprintParams &params=DefaultDifferenceFPParams)
const ReactionFingerprintParams DefaultStructuralFPParams(true, 0.2, 1, 1, 4096, PatternFP)
This is a class for storing and applying general chemical reactions.
Definition: Reaction.h:116
const ReactionFingerprintParams DefaultDifferenceFPParams(true, 0.0, 10, 1, 2048, AtomPairFP)
ReactionFingerprintParams(bool includeAgents, double bitRatioAgents, unsigned int nonAgentWeight, int agentWeight, unsigned int fpSize, FingerprintType fpType)
Includes a bunch of functionality for handling Atom and Bond queries.
Definition: Atom.h:29
a class for efficiently storing sparse vectors of ints
Definition: SparseIntVect.h:27
a class for bit vectors that are densely occupied
ExplicitBitVect * StructuralFingerprintChemReaction(const ChemicalReaction &rxn, const ReactionFingerprintParams &params=DefaultStructuralFPParams)