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