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 permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 //
31 #ifndef RD_REACTIONFINGERPRINTS_H
32 #define RD_REACTIONFINGERPRINTS_H
33 
36 
37 namespace RDKit{
38 
39  class ChemicalReaction;
40 
47  };
48 
49  //! A struct for storing parameters to manipulate
50  //! the calculation of fingerprints of chemical reactions
51  /*!
52  Different parameters can be chosen to influence the generation
53  of chemical reaction fingerprints. Generally different setting
54  should be used for structural or difference fingerprints.
55 
56  \param includeAgents include the agents of a reaction for fingerprint generation
57  \param bitRatioAgents in structural fingerprints it determines the ratio of bits of
58  the agents in the fingerprint
59  \param nonAgentWeight in difference fingerprints weight factor for reactants and products
60  compared to agents
61  \param agentWeight if agents are included, agents could be weighted compared to reactants
62  and products in difference fingerprints
63  \param fpSize number of bits of the fingerprint
64  \param fpType kind of fingerprint used, e.g AtompairFP. Be aware that only AtompairFP,
65  TopologicalTorsion and MorganFP were supported in the difference fingerprint.
66  */
68 
70  includeAgents(false),
71  bitRatioAgents(0.2),
72  nonAgentWeight(10),
73  agentWeight(1),
74  fpSize(2048),
76 
78  unsigned int nonAgentWeight, int agentWeight,
79  unsigned int fpSize,FingerprintType fpType):
80  includeAgents(includeAgents),
81  bitRatioAgents(bitRatioAgents),
82  nonAgentWeight(nonAgentWeight),
83  agentWeight(agentWeight),
84  fpSize(fpSize),
85  fpType(fpType){}
86 
89  unsigned int nonAgentWeight;
91  unsigned int fpSize;
93  };
94 
96  const ReactionFingerprintParams DefaultDifferenceFPParams(true, 0.0, 10, 1, 2048, AtomPairFP);
97 
98  //! Generates a structural fingerprint for a reaction
99  //! to use in screening
100  /*!
101  A structural fingerprint is generated as an ExplicitBitVect to use for searching
102  e.g. substructure in reactions. By default the fingerprint is generated as 4096 BitVect
103  using a PatternFP for reactants and products and tentatively agents which
104  were finally concatenated
105 
106  \param rxn: the reaction to be fingerprinted
107  \param params: specific settings to manipulate fingerprint generation
108 
109  \return the reaction fingerprint, as an ExplicitBitVect
110 
111  <b>Notes:</b>
112  - the caller is responsible for <tt>delete</tt>ing the result
113  */
116 
117 
118  //! Generates a difference fingerprint for a reaction
119  //! to use in similarity search of reactions
120  /*!
121  A difference fingerprint is generated as a SparseIntVect to use for
122  similarity search of reactions. By default the fingerprint is generated as 2048 bit
123  hashed fingerprint subtracting AtompairFP of the reactants from the products' AtompairFP
124  and tentatively the agent AtompairFP is added
125 
126  \param rxn: the reaction to be fingerprinted
127  \param params: specific settings to manipulate fingerprint generation
128 
129  \return the reaction fingerprint, as an SparseIntVec
130 
131  <b>Notes:</b>
132  - the caller is responsible for <tt>delete</tt>ing the result
133  */
136 
137 }
138 
139 #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:113
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:28
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)