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 
104 
105 //! Generates a structural fingerprint for a reaction
106 //! to use in screening
107 /*!
108  A structural fingerprint is generated as an ExplicitBitVect to use for
109  searching
110  e.g. substructure in reactions. By default the fingerprint is generated as
111  4096 BitVect
112  using a PatternFP for reactants and products and tentatively agents which
113  were finally concatenated
114 
115  \param rxn: the reaction to be fingerprinted
116  \param params: specific settings to manipulate fingerprint generation
117 
118  \return the reaction fingerprint, as an ExplicitBitVect
119 
120  <b>Notes:</b>
121  - the caller is responsible for <tt>delete</tt>ing the result
122 */
124  const ChemicalReaction &rxn,
125  const ReactionFingerprintParams &params = DefaultStructuralFPParams);
126 
127 //! Generates a difference fingerprint for a reaction
128 //! to use in similarity search of reactions
129 /*!
130  A difference fingerprint is generated as a SparseIntVect to use for
131  similarity search of reactions. By default the fingerprint is generated as
132  2048 bit
133  hashed fingerprint subtracting AtompairFP of the reactants from the products'
134  AtompairFP
135  and tentatively the agent AtompairFP is added
136 
137  \param rxn: the reaction to be fingerprinted
138  \param params: specific settings to manipulate fingerprint generation
139 
140  \return the reaction fingerprint, as an SparseIntVec
141 
142  <b>Notes:</b>
143  - the caller is responsible for <tt>delete</tt>ing the result
144 */
146  const ChemicalReaction &rxn,
147  const ReactionFingerprintParams &params = DefaultDifferenceFPParams);
148 }
149 
150 #endif
RDKIT_CHEMREACTIONS_EXPORT ExplicitBitVect * StructuralFingerprintChemReaction(const ChemicalReaction &rxn, const ReactionFingerprintParams &params=DefaultStructuralFPParams)
RDKIT_CHEMREACTIONS_EXPORT const ReactionFingerprintParams DefaultStructuralFPParams
This is a class for storing and applying general chemical reactions.
Definition: Reaction.h:118
ReactionFingerprintParams(bool includeAgents, double bitRatioAgents, unsigned int nonAgentWeight, int agentWeight, unsigned int fpSize, FingerprintType fpType)
Std stuff.
Definition: Atom.h:30
RDKIT_CHEMREACTIONS_EXPORT SparseIntVect< boost::uint32_t > * DifferenceFingerprintChemReaction(const ChemicalReaction &rxn, const ReactionFingerprintParams &params=DefaultDifferenceFPParams)
#define RDKIT_CHEMREACTIONS_EXPORT
Definition: export.h:60
a class for efficiently storing sparse vectors of ints
Definition: SparseIntVect.h:28
RDKIT_CHEMREACTIONS_EXPORT const ReactionFingerprintParams DefaultDifferenceFPParams
a class for bit vectors that are densely occupied