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, std::vector<double> &descriptor, int confId = -1);
64 
65 /*!
66  Calculates the ultra-fast shape recognition with CREDO atom types (USRCAT)
67  descriptor
68 
69  Reference: A. M. Schreyer, T. Blundell, J. Cheminf. (2012), 4, 27.
70 
71  Derived from Python implementation Adrian Schreyer:
72  http://hg.adrianschreyer.eu/usrcat/src/70e075d93cd2?at=default
73 
74  \param mol the molecule of interest
75  \param descriptor storage for the computed USR descriptor
76  \param confId the conformer Id
77 
78 */
79 RDKIT_DESCRIPTORS_EXPORT void USRCAT(const ROMol &mol, std::vector<double> &descriptor,
80  std::vector<std::vector<unsigned int>> &atomIds, int confId = -1);
81 /*!
82  Calculates the four distance distributions for the USR descriptor
83 
84  \param coords the atom coordinates
85  \param dist storage for the four distance distributions
86  \param points storage for the four points
87 
88 */
90  std::vector<std::vector<double>> &dist,
91  std::vector<RDGeom::Point3D> &points);
92 
93 /*!
94  Calculates the four distance distributions for the USR descriptor
95 
96  \param coords the atom coordinates
97  \param points vector with the points
98  \param dist storage for the distance distributions
99 
100 */
102  const std::vector<RDGeom::Point3D> &points,
103  std::vector<std::vector<double>> &dist);
104 
105 /*!
106  Calculates the USR descriptor from the four distance distributions
107 
108  \param dist vector with the four distance distributions
109  \param descriptor storage for the computed USR descriptor
110 
111 */
112 RDKIT_DESCRIPTORS_EXPORT void calcUSRFromDistributions(const std::vector<std::vector<double>> &dist,
113  std::vector<double> &descriptor);
114 
115 /*!
116  Calculates the score between two USRCAT descriptors with weights
117 
118  \param d1 descriptor 1
119  \param d2 descriptor 2
120  \param weights the weights for each subset of moments
121 
122  \return the score
123 */
124 RDKIT_DESCRIPTORS_EXPORT double calcUSRScore(const std::vector<double> &d1,
125  const std::vector<double> &d2,
126  const std::vector<double> &weights);
127 
128 } // end of namespace Descriptors
129 } // end of namespace RDKit
130 
131 #endif
RDKIT_DESCRIPTORS_EXPORT void calcUSRFromDistributions(const std::vector< std::vector< double >> &dist, std::vector< double > &descriptor)
RDKIT_DESCRIPTORS_EXPORT double calcUSRScore(const std::vector< double > &d1, const std::vector< double > &d2, const std::vector< double > &weights)
std::vector< const RDGeom::Point3D * > Point3DConstPtrVect
Definition: point.h:504
RDKIT_DESCRIPTORS_EXPORT void USRCAT(const ROMol &mol, std::vector< double > &descriptor, std::vector< std::vector< unsigned int >> &atomIds, int confId=-1)
#define RDKIT_DESCRIPTORS_EXPORT
Definition: export.h:138
RDKIT_DESCRIPTORS_EXPORT void calcUSRDistributionsFromPoints(const RDGeom::Point3DConstPtrVect &coords, const std::vector< RDGeom::Point3D > &points, std::vector< std::vector< double >> &dist)
RDKIT_DESCRIPTORS_EXPORT void USR(const ROMol &mol, std::vector< double > &descriptor, int confId=-1)
Std stuff.
Definition: Atom.h:30
RDKIT_DESCRIPTORS_EXPORT void calcUSRDistributions(const RDGeom::Point3DConstPtrVect &coords, std::vector< std::vector< double >> &dist, std::vector< RDGeom::Point3D > &points)