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  {}
79 
80  ReactionFingerprintParams(bool includeAgents, double bitRatioAgents,
81  unsigned int nonAgentWeight, int agentWeight,
82  unsigned int fpSize, FingerprintType fpType)
83  : includeAgents(includeAgents),
84  bitRatioAgents(bitRatioAgents),
85  nonAgentWeight(nonAgentWeight),
86  agentWeight(agentWeight),
87  fpSize(fpSize),
88  fpType(fpType) {}
89 
90  bool includeAgents{false};
91  double bitRatioAgents{0.2};
92  unsigned int nonAgentWeight{10};
93  int agentWeight{1};
94  unsigned int fpSize{2048};
96 };
97 
98 RDKIT_CHEMREACTIONS_EXPORT extern const ReactionFingerprintParams
100 RDKIT_CHEMREACTIONS_EXPORT extern const ReactionFingerprintParams
102 
103 //! Generates a structural fingerprint for a reaction
104 //! to use in screening
105 /*!
106  A structural fingerprint is generated as an ExplicitBitVect to use for
107  searching
108  e.g. substructure in reactions. By default the fingerprint is generated as
109  4096 BitVect
110  using a PatternFP for reactants and products and tentatively agents which
111  were finally concatenated
112 
113  \param rxn: the reaction to be fingerprinted
114  \param params: specific settings to manipulate fingerprint generation
115 
116  \return the reaction fingerprint, as an ExplicitBitVect
117 
118  <b>Notes:</b>
119  - the caller is responsible for <tt>delete</tt>ing the result
120 */
122  const ChemicalReaction &rxn,
124 
125 //! Generates a difference fingerprint for a reaction
126 //! to use in similarity search of reactions
127 /*!
128  A difference fingerprint is generated as a SparseIntVect to use for
129  similarity search of reactions. By default the fingerprint is generated as
130  2048 bit
131  hashed fingerprint subtracting AtompairFP of the reactants from the products'
132  AtompairFP
133  and tentatively the agent AtompairFP is added
134 
135  \param rxn: the reaction to be fingerprinted
136  \param params: specific settings to manipulate fingerprint generation
137 
138  \return the reaction fingerprint, as an SparseIntVec
139 
140  <b>Notes:</b>
141  - the caller is responsible for <tt>delete</tt>ing the result
142 */
145  const ChemicalReaction &rxn,
147 } // namespace RDKit
148 
149 #endif
a class for bit vectors that are densely occupied
This is a class for storing and applying general chemical reactions.
Definition: Reaction.h:119
a class for efficiently storing sparse vectors of ints
Definition: SparseIntVect.h:28
#define RDKIT_CHEMREACTIONS_EXPORT
Definition: export.h:86
Std stuff.
Definition: Abbreviations.h:17
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)