RDKit
Open-source cheminformatics and machine learning.
USRDescriptor.h
Go to the documentation of this file.
1 //
2 // Copyright (c) 2013, 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 
33 /*! \file USRDescriptor.h
34 
35  \brief Contains the USR descriptor. Use MolDescriptors.h in client code.
36 
37 */
38 #ifndef __RD_USR_H__
39 #define __RD_USR_H__
40 
41 #include <Geometry/point.h>
42 #include <Numerics/Vector.h>
43 
44 namespace RDKit {
45 class ROMol;
46 class Conformer;
47 namespace Descriptors {
48 /*!
49  Calculates the ultra-fast shape recognition (USR) descriptor
50 
51  Reference: P. J. Ballester, W. G. Richards, JCC (2007), 28, 1711 - 1723.
52 
53  Derived from RDKit Python implementation of Jan Domanski
54  who derived his code from Adrian Schreyer's code:
55  http://hg.adrianschreyer.eu/usrcat/src/70e075d93cd2?at=default
56 
57  \param mol the molecule of interest
58  \param descriptor storage for the computed USR descriptor
59  \param confId the conformer Id
60 
61 */
62 void USR(const ROMol &mol, std::vector<double> &descriptor, int confId = -1);
63 
64 /*!
65  Calculates the ultra-fast shape recognition with CREDO atom types (USRCAT)
66  descriptor
67 
68  Reference: A. M. Schreyer, T. Blundell, J. Cheminf. (2012), 4, 27.
69 
70  Derived from Python implementation Adrian Schreyer:
71  http://hg.adrianschreyer.eu/usrcat/src/70e075d93cd2?at=default
72 
73  \param mol the molecule of interest
74  \param descriptor storage for the computed USR descriptor
75  \param confId the conformer Id
76 
77 */
78 void USRCAT(const ROMol &mol, std::vector<double> &descriptor,
79  std::vector<std::vector<unsigned int> > &atomIds, int confId = -1);
80 /*!
81  Calculates the four distance distributions for the USR descriptor
82 
83  \param coords the atom coordinates
84  \param dist storage for the four distance distributions
85  \param points storage for the four points
86 
87 */
89  std::vector<std::vector<double> > &dist,
90  std::vector<RDGeom::Point3D> &points);
91 
92 /*!
93  Calculates the four distance distributions for the USR descriptor
94 
95  \param coords the atom coordinates
96  \param points vector with the points
97  \param dist storage for the distance distributions
98 
99 */
101  const std::vector<RDGeom::Point3D> &points,
102  std::vector<std::vector<double> > &dist);
103 
104 /*!
105  Calculates the USR descriptor from the four distance distributions
106 
107  \param dist vector with the four distance distributions
108  \param descriptor storage for the computed USR descriptor
109 
110 */
111 void calcUSRFromDistributions(const std::vector<std::vector<double> > &dist,
112  std::vector<double> &descriptor);
113 
114 /*!
115  Calculates the score between two USRCAT descriptors with weights
116 
117  \param d1 descriptor 1
118  \param d2 descriptor 2
119  \param weights the weights for each subset of moments
120 
121  \return the score
122 */
123 double calcUSRScore(const std::vector<double> &d1,
124  const std::vector<double> &d2,
125  const std::vector<double> &weights);
126 
127 } // end of namespace Descriptors
128 } // end of namespace RDKit
129 
130 #endif
void USRCAT(const ROMol &mol, std::vector< double > &descriptor, std::vector< std::vector< unsigned int > > &atomIds, int confId=-1)
void calcUSRDistributions(const RDGeom::Point3DConstPtrVect &coords, std::vector< std::vector< double > > &dist, std::vector< RDGeom::Point3D > &points)
void calcUSRFromDistributions(const std::vector< std::vector< double > > &dist, std::vector< double > &descriptor)
std::vector< const RDGeom::Point3D * > Point3DConstPtrVect
Definition: point.h:503
void calcUSRDistributionsFromPoints(const RDGeom::Point3DConstPtrVect &coords, const std::vector< RDGeom::Point3D > &points, std::vector< std::vector< double > > &dist)
double calcUSRScore(const std::vector< double > &d1, const std::vector< double > &d2, const std::vector< double > &weights)
Std stuff.
Definition: Atom.h:29
void USR(const ROMol &mol, std::vector< double > &descriptor, int confId=-1)