RDKit
Open-source cheminformatics and machine learning.
ShapeUtils.h
Go to the documentation of this file.
1 //
2 // Copyright (C) 2005-2006 Rational Discovery LLC
3 //
4 // @@ All Rights Reserved @@
5 // This file is part of the RDKit.
6 // The contents are covered by the terms of the BSD license
7 // which is included in the file license.txt, found at the root
8 // of the RDKit source tree.
9 //
10 #include <RDGeneral/export.h>
11 #ifndef _RD_SHAPE_UTILS_H_20050128_
12 #define _RD_SHAPE_UTILS_H_20050128_
14 #include <vector>
15 
16 namespace RDGeom {
17 class Point3D;
18 class Transform3D;
19 }
20 
21 namespace RDKit {
22 class ROMol;
23 class Conformer;
24 
25 namespace MolShapes {
26 
27 //! Compute the size of the box that can fit the conformation, and offset of the
28 // box
29 //! from the origin
31  RDGeom::Point3D &offSet,
32  const RDGeom::Transform3D *trans = 0,
33  double padding = 2.5);
34 
35 //! Compute the a box that will fit the confomer
36 /*!
37  \param conf The conformer of interest
38  \param leftBottom Storage for one extremity of the box
39  \param rightTop Storage for other extremity of the box
40  \param trans Optional transformation to be applied to the atom
41  coordinates
42  \param padding Padding added on the sides around the conformer
43 */
44 RDKIT_SHAPEHELPERS_EXPORT void computeConfBox(const Conformer &conf, RDGeom::Point3D &leftBottom,
45  RDGeom::Point3D &rightTop,
46  const RDGeom::Transform3D *trans = 0, double padding = 2.5);
47 
48 //! Compute the union of two boxes
50  const RDGeom::Point3D &rightTop1,
51  const RDGeom::Point3D &leftBottom2,
52  const RDGeom::Point3D &rightTop2,
53  RDGeom::Point3D &uLeftBottom, RDGeom::Point3D &uRightTop);
54 
55 //! Compute dimensions of a conformer
56 /*!
57  \param conf Conformer of interest
58  \param padding Padding added to the atom coordinates on all sides
59  \param center Optionally specify the center
60  \param ignoreHs if true, ignore the hydrogen atoms in computing the centroid
61 */
62 RDKIT_SHAPEHELPERS_EXPORT std::vector<double> getConfDimensions(const Conformer &conf,
63  double padding = 2.5,
64  const RDGeom::Point3D *center = 0,
65  bool ignoreHs = true);
66 
67 //! Compute the shape tversky index between two molecule based on a
68 // predefined alignment
69 /*!
70  \param mol1 The first molecule of interest
71  \param mol2 The second molecule of interest
72  \param alpha
73  \param beta
74  \param confId1 Conformer in the first molecule (defaults to first
75  conformer)
76  \param confId2 Conformer in the second molecule (defaults to first
77  conformer)
78  \param gridSpacing resolution of the grid used to encode the molecular shapes
79  \param bitsPerPoint number of bit used to encode the occupancy at each grid
80  point
81  defaults to two bits per grid point
82  \param vdwScale Scaling factor for the radius of the atoms to determine
83  the base radius
84  used in the encoding - grid points inside this sphere
85  carry the maximum occupany
86  \param stepSize thickness of the each layer outside the base radius, the
87  occupancy value is decreased
88  from layer to layer from the maximum value
89  \param maxLayers the maximum number of layers - defaults to the number
90  allowed the number of bits
91  use per grid point - e.g. two bits per grid point will
92  allow 3 layers
93  \param ignoreHs if true, ignore the hydrogen atoms in the shape encoding
94  process
95  */
96 
97 RDKIT_SHAPEHELPERS_EXPORT double tverskyIndex(const ROMol &mol1, const ROMol &mol2, double alpha, double beta, int confId1 = -1,
98  int confId2 = -1, double gridSpacing = 0.5,
99  DiscreteValueVect::DiscreteValueType bitsPerPoint =
100  DiscreteValueVect::TWOBITVALUE,
101  double vdwScale = 0.8, double stepSize = 0.25,
102  int maxLayers = -1, bool ignoreHs = true);
103 
104 //! Compute the shape tversky index between two conformers based on a
105 // predefined alignment
106 
107 /*!
108  \param conf1 The first conformer of interest
109  \param conf2 The second conformer of interest
110  \param alpha
111  \param beta
112  \param gridSpacing resolution of the grid used to encode the molecular shapes
113  \param bitsPerPoint number of bit used to encode the occupancy at each grid
114  point
115  \param vdwScale Scaling factor for the radius of the atoms to determine
116  the base radius
117  used in the encoding - grid points inside this sphere
118  carry the maximum occupany
119  \param stepSize thickness of the each layer outside the base radius, the
120  occupancy value is decreased
121  from layer to layer from the maximum value
122  \param maxLayers the maximum number of layers - defaults to the number
123  allowed the number of bits
124  use per grid point - e.g. two bits per grid point will
125  allow 3 layers
126  \param ignoreHs if true, ignore the hydrogen atoms in the shape encoding
127  process
128  */
129 
130 RDKIT_SHAPEHELPERS_EXPORT double tverskyIndex(const Conformer &conf1, const Conformer &conf2, double alpha, double beta,
131  double gridSpacing = 0.5,
132  DiscreteValueVect::DiscreteValueType bitsPerPoint =
133  DiscreteValueVect::TWOBITVALUE,
134  double vdwScale = 0.8, double stepSize = 0.25,
135  int maxLayers = -1, bool ignoreHs = true);
136 
137 
138 //! Compute the shape tanimoto distance between two molecule based on a
139 // predefined alignment
140 /*!
141  \param mol1 The first molecule of interest
142  \param mol2 The second molecule of interest
143  \param confId1 Conformer in the first molecule (defaults to first
144  conformer)
145  \param confId2 Conformer in the second molecule (defaults to first
146  conformer)
147  \param gridSpacing resolution of the grid used to encode the molecular shapes
148  \param bitsPerPoint number of bit used to encode the occupancy at each grid
149  point
150  defaults to two bits per grid point
151  \param vdwScale Scaling factor for the radius of the atoms to determine
152  the base radius
153  used in the encoding - grid points inside this sphere
154  carry the maximum occupany
155  \param stepSize thickness of the each layer outside the base radius, the
156  occupancy value is decreased
157  from layer to layer from the maximum value
158  \param maxLayers the maximum number of layers - defaults to the number
159  allowed the number of bits
160  use per grid point - e.g. two bits per grid point will
161  allow 3 layers
162  \param ignoreHs if true, ignore the hydrogen atoms in the shape encoding
163  process
164  */
165 
166 RDKIT_SHAPEHELPERS_EXPORT double tanimotoDistance(const ROMol &mol1, const ROMol &mol2, int confId1 = -1,
167  int confId2 = -1, double gridSpacing = 0.5,
168  DiscreteValueVect::DiscreteValueType bitsPerPoint =
169  DiscreteValueVect::TWOBITVALUE,
170  double vdwScale = 0.8, double stepSize = 0.25,
171  int maxLayers = -1, bool ignoreHs = true);
172 
173 //! Compute the shape tanimoto distance between two conformers based on a
174 // predefined alignment
175 /*!
176  \param conf1 The first conformer of interest
177  \param conf2 The second conformer of interest
178  \param gridSpacing resolution of the grid used to encode the molecular shapes
179  \param bitsPerPoint number of bit used to encode the occupancy at each grid
180  point
181  \param vdwScale Scaling factor for the radius of the atoms to determine
182  the base radius
183  used in the encoding - grid points inside this sphere
184  carry the maximum occupany
185  \param stepSize thickness of the each layer outside the base radius, the
186  occupancy value is decreased
187  from layer to layer from the maximum value
188  \param maxLayers the maximum number of layers - defaults to the number
189  allowed the number of bits
190  use per grid point - e.g. two bits per grid point will
191  allow 3 layers
192  \param ignoreHs if true, ignore the hydrogen atoms in the shape encoding
193  process
194  */
195 
196 RDKIT_SHAPEHELPERS_EXPORT double tanimotoDistance(const Conformer &conf1, const Conformer &conf2,
197  double gridSpacing = 0.5,
198  DiscreteValueVect::DiscreteValueType bitsPerPoint =
199  DiscreteValueVect::TWOBITVALUE,
200  double vdwScale = 0.8, double stepSize = 0.25,
201  int maxLayers = -1, bool ignoreHs = true);
202 
203 //! Compute the shape protrusion distance between two molecule based on a
204 // predefined alignment
205 /*!
206  \param mol1 The first molecule of interest
207  \param mol2 The second molecule of interest
208  \param confId1 Conformer in the first molecule (defaults to first
209  conformer)
210  \param confId2 Conformer in the second molecule (defaults to first
211  conformer)
212  \param gridSpacing resolution of the grid used to encode the molecular shapes
213  \param bitsPerPoint number of bit used to encode the occupancy at each grid
214  point
215  defaults to two bits per grid point
216  \param vdwScale Scaling factor for the radius of the atoms to determine
217  the base radius
218  used in the encoding - grid points inside this sphere
219  carry the maximum occupany
220  \param stepSize thickness of the each layer outside the base radius, the
221  occupancy value is decreased
222  from layer to layer from the maximum value
223  \param maxLayers the maximum number of layers - defaults to the number
224  allowed the number of bits
225  use per grid point - e.g. two bits per grid point will
226  allow 3 layers
227  \param ignoreHs if true, ignore the hydrogen atoms in the shape encoding
228  process
229  \param allowReordering if set the order will be automatically updated so that
230  the value calculated
231  is the protrusion of the smaller shape from the larger
232  one.
233  */
234 
235 RDKIT_SHAPEHELPERS_EXPORT double protrudeDistance(const ROMol &mol1, const ROMol &mol2, int confId1 = -1,
236  int confId2 = -1, double gridSpacing = 0.5,
237  DiscreteValueVect::DiscreteValueType bitsPerPoint =
238  DiscreteValueVect::TWOBITVALUE,
239  double vdwScale = 0.8, double stepSize = 0.25,
240  int maxLayers = -1, bool ignoreHs = true,
241  bool allowReordering = true);
242 
243 //! Compute the shape protrusion distance between two conformers based on a
244 // predefined alignment
245 /*!
246  \param conf1 The first conformer of interest
247  \param conf2 The second conformer of interest
248  \param gridSpacing resolution of the grid used to encode the molecular shapes
249  \param bitsPerPoint number of bit used to encode the occupancy at each grid
250  point
251  \param vdwScale Scaling factor for the radius of the atoms to determine
252  the base radius
253  used in the encoding - grid points inside this sphere
254  carry the maximum occupany
255  \param stepSize thickness of the each layer outside the base radius, the
256  occupancy value is decreased
257  from layer to layer from the maximum value
258  \param maxLayers the maximum number of layers - defaults to the number
259  allowed the number of bits
260  use per grid point - e.g. two bits per grid point will
261  allow 3 layers
262  \param ignoreHs if true, ignore the hydrogen atoms in the shape encoding
263  process
264  \param allowReordering if set the order will be automatically updated so that
265  the value calculated
266  is the protrusion of the smaller shape from the larger
267  one.
268  */
269 
270 RDKIT_SHAPEHELPERS_EXPORT double protrudeDistance(const Conformer &conf1, const Conformer &conf2,
271  double gridSpacing = 0.5,
272  DiscreteValueVect::DiscreteValueType bitsPerPoint =
273  DiscreteValueVect::TWOBITVALUE,
274  double vdwScale = 0.8, double stepSize = 0.25,
275  int maxLayers = -1, bool ignoreHs = true,
276  bool allowReordering = true);
277 }
278 }
279 
280 #endif
RDKIT_SHAPEHELPERS_EXPORT void computeUnionBox(const RDGeom::Point3D &leftBottom1, const RDGeom::Point3D &rightTop1, const RDGeom::Point3D &leftBottom2, const RDGeom::Point3D &rightTop2, RDGeom::Point3D &uLeftBottom, RDGeom::Point3D &uRightTop)
Compute the union of two boxes.
#define RDKIT_SHAPEHELPERS_EXPORT
Definition: export.h:567
RDKIT_RDGEOMETRYLIB_EXPORT double tverskyIndex(const GRIDTYPE &grid1, const GRIDTYPE &grid2, double alpha, double beta)
calculate the tversky index between the shapes encoded on two grids
RDKIT_SHAPEHELPERS_EXPORT void computeConfDimsAndOffset(const Conformer &conf, RDGeom::Point3D &dims, RDGeom::Point3D &offSet, const RDGeom::Transform3D *trans=0, double padding=2.5)
Compute the size of the box that can fit the conformation, and offset of the.
RDKIT_SHAPEHELPERS_EXPORT void computeConfBox(const Conformer &conf, RDGeom::Point3D &leftBottom, RDGeom::Point3D &rightTop, const RDGeom::Transform3D *trans=0, double padding=2.5)
Compute the a box that will fit the confomer.
RDKIT_RDGEOMETRYLIB_EXPORT double protrudeDistance(const GRIDTYPE &grid1, const GRIDTYPE &grid2)
calculate the protrude distance between the shapes encoded on two grids
Std stuff.
Definition: Atom.h:30
RDKIT_SHAPEHELPERS_EXPORT std::vector< double > getConfDimensions(const Conformer &conf, double padding=2.5, const RDGeom::Point3D *center=0, bool ignoreHs=true)
Compute dimensions of a conformer.
RDKIT_RDGEOMETRYLIB_EXPORT double tanimotoDistance(const GRIDTYPE &grid1, const GRIDTYPE &grid2)
calculate the tanimoto distance between the shapes encoded on two grids