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 
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  */
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};
94 };
95 
96 RDKIT_CHEMREACTIONS_EXPORT extern const ReactionFingerprintParams
98 RDKIT_CHEMREACTIONS_EXPORT extern const ReactionFingerprintParams
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 */
120  const ChemicalReaction &rxn,
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 */
143  const ChemicalReaction &rxn,
145 } // namespace RDKit
146 
147 #endif
a class for bit vectors that are densely occupied
This is a class for storing and applying general chemical reactions.
Definition: Reaction.h:121
a class for efficiently storing sparse vectors of ints
Definition: SparseIntVect.h:28
#define RDKIT_CHEMREACTIONS_EXPORT
Definition: export.h:49
Std stuff.
Definition: Abbreviations.h:18
RDKIT_CHEMREACTIONS_EXPORT SparseIntVect< std::uint32_t > * DifferenceFingerprintChemReaction(const ChemicalReaction &rxn, const ReactionFingerprintParams &params=DefaultDifferenceFPParams)
RDKIT_CHEMREACTIONS_EXPORT const ReactionFingerprintParams DefaultStructuralFPParams
RDKIT_CHEMREACTIONS_EXPORT const ReactionFingerprintParams DefaultDifferenceFPParams
RDKIT_CHEMREACTIONS_EXPORT ExplicitBitVect * StructuralFingerprintChemReaction(const ChemicalReaction &rxn, const ReactionFingerprintParams &params=DefaultStructuralFPParams)
ReactionFingerprintParams(bool includeAgents, double bitRatioAgents, unsigned int nonAgentWeight, int agentWeight, unsigned int fpSize, FingerprintType fpType)