OBSpectrophore Class Reference
Class to compute Spectrophores™. More...
#include <openbabel/spectrophore.h>
Public Types  
enum  AccuracyOption { AngStepSize1, AngStepSize2, AngStepSize5, AngStepSize10, AngStepSize15, AngStepSize20, AngStepSize30, AngStepSize36, AngStepSize45, AngStepSize60 } 
enum  NormalizationOption { NoNormalization, NormalizationTowardsZeroMean, NormalizationTowardsUnitStd, NormalizationTowardsZeroMeanAndUnitStd } 
enum  StereoOption { NoStereoSpecificProbes, UniqueStereoSpecificProbes, MirrorStereoSpecificProbes, AllStereoSpecificProbes } 
Public Member Functions  
Structors  
OBSpectrophore (void)  
OBSpectrophore (const OBSpectrophore &sphore)  
virtual  ~OBSpectrophore (void) 
Overloaded operators  
OBSpectrophore &  operator= (const OBSpectrophore &sphore) 
Set methods  
void  SetResolution (const double r=3.0) 
void  SetAccuracy (const AccuracyOption a=AngStepSize20) 
void  SetStereo (const StereoOption s=NoStereoSpecificProbes) 
void  SetNormalization (const NormalizationOption n=NoNormalization) 
Get methods  
AccuracyOption  GetAccuracy (void) const 
double  GetResolution (void) const 
StereoOption  GetStereo (void) const 
NormalizationOption  GetNormalization (void) const 
std::vector< double >  GetSpectrophore (OpenBabel::OBMol *mol) 
Protected Member Functions  
void  _getMoleculeData (OpenBabel::OBMol *) 
void  _orient (void) 
void  _getBox (double **) 
void  _setBox (void) 
void  _getEnergies (double **, double *) 
void  _initiateSpectrophore (double *, double *) 
void  _rotateX (double **, double **, const double, const double) 
void  _rotateY (double **, double **, const double, const double) 
void  _rotateZ (double **, double **, const double, const double) 
void  _updateSpectrophore (double *, double *) 
void  _calculateProperties (OpenBabel::OBMol *) 
void  _solveMatrix (double **, double *, unsigned int) 
void  _luDecompose (double **, std::vector< int > &, unsigned int) 
void  _luSolve (double **, std::vector< int > &, double *, unsigned int) 
void  _swapRows (double *, unsigned int, unsigned int) 
void  _swapRows (double **, unsigned int, unsigned int, unsigned int) 
Protected Attributes  
double  _resolution 
AccuracyOption  _accuracy 
StereoOption  _stereoFlag 
NormalizationOption  _normalization 
std::vector< int >  _rotationStepList 
unsigned int  _nAtoms 
double **  _property 
double *  _radii 
double **  _oricoor 
double **  _coor 
unsigned int  _beginProbe 
unsigned int  _endProbe 
unsigned int  _numberOfProbes 
std::vector< double >  _spectro 
struct {  
int value [12]  
}  _probe [48] 
struct {  
double x  
double y  
double z  
double v [N_PROPERTIES]  
}  _boxPoint [12] 
Detailed Description
Class to compute Spectrophores™.
 Since:
 Version 2.3
Introduction
Spectrophores™ are onedimensional descriptors generated from the property fields surrounding the molecules. The technology allows the accurate description of molecules in terms of their surface properties or fields. Comparison of molecules’ property fields provides a robust structureindependent method of aligning actives from different chemical classes. When applied to molecules such as ligands and drugs, Spectrophores™ can be used as powerful molecular descriptors in the fields of chemoinformatics, virtual screening, and QSAR modeling.
The computation of Spectrophores™ is independent of the position and orientation of the molecule and this enables easy and fast comparison of Spectrophores™ between different molecules. Molecules having similar threedimensional properties and shapes always yield similar Spectrophores™.
A Spectrophore™ is calculated by surrounding the threedimensional conformation of the molecule by a threedimensional arrangement of points, followed by calculating the interaction between each of the atom properties and the surrounding the points. The threedimensional arrangement of the points surrounding the molecule can be regarded as an ‘artificial’ cage or receptor, and the interaction calculated between the molecule and the cage can be regarded as an artificial representation of an affinity value between molecule and cage. Because the calculated interaction is dependent on the relative orientation of the molecule within the cage, the molecule is rotated in discrete angles and the most favorable interaction value is kept as final result. The angular stepsize at which the molecule is rotated along its three axis can be specified by the user and influences the accuracy of the method.
Atomic properties
The calculation of a Spectrophore™ starts by calculating the atomic contributions of each property from which one wants to calculate a Spectrophore™ from. In the current implementation, four atomic properties are converted into a Spectrophore™; these four properties include the atomic partial charges, the atomic lipohilicities, the atomic shape deviations and the atomic electrophilicities.
The atomic partial charges and atomic electrophilicity properties are calculated using the electronegativity equalisation method (EEM) as described by Bultinck and coworkers (J. Phys. Chem. 2002, A106, 78957901; J. Chem. Inf. Comput. Sci. 2003, 43, 422428). The following table lists the atomic electronegativity and hardness parameters that are used in the current implementation of the EEM method:
Atom symbol  Atomic electronegativity  Atomic hardness 
H  
C  
N  
O  
F  
S  
Cl  
Br  
I  
Default 
Atomic lipophilic potential parameters are calculated using a rulebased method using parameters from the following table. These parameters were obtained by fitting against the logP values of 10,881 molecules.
Atom  Lipophilicity parameter 
H bound to C  
H bound to heteroatom  
C  
N  
O  
F  
S  
Cl  
Br  
I  
Default 
Finally, the atomic shape deviation is generated by calculating, for each atom, the atom’s deviation from the average molecular radius. This is done in a four steps process:
 The molecular center of geometry (COG) is calculated;
 The distances between each atom and the molecular COG are calculated;
 The average molecular radius is calculated by averaging all the atomic distances.
 The distances between each atom and the COG are then divided by the average molecular radius and centered on zero.
Interaction between the atoms and cage points
Following the calculation of all required atomic properties, the next step in the calculation of a Spectrophore™ consists of determining the total interaction value V(c,p) between each of the atomic contributions of property p with a set of interaction points on an artificial cage c surrounding the molecular conformation. For this purpose, each of these interaction points i on cage c is assigned a value P(c,i) which is either +1 or 1, with the constraint that the sum of all interaction points on a particular cage should be zero. In a typical Spectrophore™ calculation, a cage is represented as a rectangular box encompassing the molecular conformation in all three dimensions, with the centers of the box edges being the interaction points. Such a configuration gives twelve interaction points per cage, and, in the case of a nonstereospecific distribution of the interaction points, leads to 12 different cages. Although there are no particular requirements as to the dimensions of the rectangular cage, the distance between the interaction points and the geometrical extremes of the molecule should be such that a meaningful interaction value between each cage point and the molecular entity can be calculated. In this respect, the default dimensions of the cage are constantly adjusted to enclose the molecule at a minimum distance of 3 Å along all dimensions. This cage size can be modified by the user and influences the resolution of the Spectrophore™.
Schematic representation of a molecule surrounded by the artifical cage
The total interaction value V(c,p) between the atomic contribution values A(j,p) of property p for a given molecular conformation and the cage interaction values P(c,i) for a given cage c is calculated according a standard interaction energy equation. It takes into account the Euclidean distance between each atom and each cage point. This total interaction V(c,p) for a given property p and cage c for a given molecular conformation is minimized by sampling the molecular orientation along the three axis in angular steps and the calculation of the interaction value for each orientation within the cage. The final total interaction V(c,p) for a given cage c and property p corresponds to the lowest interaction value obtained this way, and corresponds to the c’th value in the onedimensional Spectrophore™ vector calculated for molecular property p. As a result, a Spectrophore™ is organized as a vector of minimized interaction values V, each of these organized in order of cages and property values. Since for a typical Spectrophore™ implementation twelve different cages are used, the total length of a Spectrophore™ vector equals to 12 times the number of properties. Since four different properties are used in the current implementation (electrostatic, lipophilic, electrophilic potentials, and an additional shape index as described before), this leads to a total Spectrophore™ length of 48 real values per molecular conformation.
Since Spectrophore™ descriptors are dependent on the actual threedimensional conformation of the molecule, a typical analysis includes the calculation of Spectrophores™ from a reasonable set of different conformations. It is then up to the user to decide on the most optimal strategy for processing the different Spectrophore™ vectors. In a typical virtual screening application, calculating the average Spectrophore™ vector from all conformations of a single molecule may be a good strategy; other applications have benefit from calculating a weighted average or the minimal values.
Accuracy
As already mentioned, the total interaction between cage and molecule for a given property is minimized by sampling the molecular orientation in angular steps of a certain magnitude. As a typical angular step size, 20º was found to be the best compromise between accuracy and computer speed. Larger steps sizes are faster to calculate but have the risk of missing the global interaction energy minimum, while smaller angular steps sizes do sample the rotational space more thoroughly but at a significant computational cost. The accuracy can be specified by the user using the OBSpectrophore::SetAccuracy(const OBSpectrophore::AccuracyOption) method.
Resolution
Spectrophores™ capture information about the property fields surrounding the molecule, and the amount of detail that needs to be captured can be regulated by the user. This is done by altering the minimal distance between the molecule and the surrounding cage. The resolution can be specified by the user with the OBSpectrophore::SetResolution(const double) method. The default distance along all dimensions is 3.0 Å. The larger the distance, the lower the resolution. With a higher resolution, more details of the property fields surrounding the molecule are contained by the Spectrophore™. On the contrary, low resolution settings may lead to a more general representation of the property fields, with little or no emphasis on small local variations within the fields. Using a low resolution can be the method of choice during the initial virtual screening experiments in order to get an initial, but not so discriminative, first selection. This initial selection can then further be refined during subsequent virtual screening steps using a higher resolution. In this setting, small local differences in the fields between pairs of molecules will be picked up much more easily.
The absolute values of the individual Spectrophore™ data points are dependent on the used resolution. Low resolution values lead to small values of the calculated individual Spectrophore™ data points, while high resolutions will lead to larger data values. It is therefore only meaningful to compare only Spectrophores™ that have been generated using the same resolution settings or after some kind of normalization is performed.
Computation time is not influenced by the specified resolution, hence the computation time is identical for all different resolution settings.
Stereospecificity
Some of the cages that are used to calculated Spectrophores™ have a stereospecific distribution of the interaction points. The resulting interaction valus resulting from these cages are therefore sensitive to the enantiomeric configuration of the molecule within the cage. The fact that both stereoselective as well as stereo nonselective cages can be used makes it possible to include or exclude stereospecificity in the virtual screening search. Depending on the desired output, the stereospecificity of Spectrophores™ can be specified by the user:
 No stereospecificity (default). Spectrophores™ are generated using cages that are not stereospecific. For most applications, these Spectrophores™ will suffice.
 Unique stereospecificity. Spectrophores™ are generated using unique stereospecific cages.
 Mirror stereospecificity. Mirror stereospecific Spectrophores™ are Spectrophores™ resulting from the mirror enantiomeric form of the input molecules.
The stereospecificity can be specified by the user using the OBSpectrophore::SetStereo(const OBSpectrophore::StereoOption) method.
The differences between the corresponding data points of unique and mirror stereospecific Spectrophores™ are very small and require very long calculation times to obtain a sufficiently high quality level. This increased quality level is triggered by the accuracy setting and will result in calculation times being increased by at least a factor 100. As a consequence, it is recommended to apply this increased accuracy only in combination with a limited number of molecules, and when the small differences between the stereospecific Spectrophores™ are really critical. However, for the vast majority of virtual screening applications, this increased accuracy is not required as long as it is not the intention to draw conclusions about differences in the underlying molecular stereoselectivity. Nonstereospecific Spectrophores™ will therefore suffice for most applications.
Normalisation
It may sometimes be desired to focus on the relative differences between the Spectrophore™ data points rather than focussing on the absolute differences. In these cases, normalization of Spectrophores™ may be required. The current implementation offers with the OBSpectrophore::SetNormalization(const OBSpectrophore::NormalizationOption) method the possibility to normalize in four different ways:
 No normalization (default);
 Normalization towards zero mean;
 Normalization towards standard deviation;
 Normalization towards zero mean and unit standard deviation.
In all these cases, normalization is performed on a ‘perproperty’ basis, which means that the data points belonging to the same property set are treated as a single set and that normalization is only performed on the data points within each of these sets and not across all data points.
Normalization may be important when comparing the Spectrophores™ of charged molecules with those of neutral molecules. For molecules carrying a global positive charge, the resulting Spectrophore™ data points of the charge and electrophilicity properties will both be shifted in absolute value compared to the corresponding data points of the respective neutral species. Normalization of the Spectrophores™ removes the original magnitude differences for the data points corresponding to the charge and electrophilicity properties of charged and neutral species. Therefore, if the emphasis of the virtual screening consists of the identification of molecules with similar property fields without taking into account differences in absolute charge, then Spectrophores™ should be normalized towards zero mean. However, if absolute charge differences should be taken into account to differentiate between molecules, unnormalized Spectrophores™ are recommended.
 Since:
 version 2.3
Member Enumeration Documentation
enum AccuracyOption 
enum NormalizationOption 
enum StereoOption 
Constructor & Destructor Documentation
OBSpectrophore  (  void  ) 
Default constructor to create an OBSpectrophore object.
OBSpectrophore  (  const OBSpectrophore &  sphore  ) 
Copy constructor to create an OBSpectrophore object by taking a copy from another OBSpectrophore object.
 Parameters:

sphore A reference to the source OBSpectrophore object
~OBSpectrophore  (  void  )  [virtual] 
Default destructor object
Member Function Documentation
OBSpectrophore & operator=  (  const OBSpectrophore &  sphore  ) 
Assignment operator that assigns a source OBSpectrophore object to the target OBSpectrophore object.
 Parameters:

sphore A reference to the source OBSpectrophore object
 Returns:
 A reference to the new target OBSpectrophore object
void SetResolution  (  const double  r = 3.0 
) 
Method to set the resolution at which Spectrophores™ will be calculated.
Sets the resolution at which Spectrophores™ are calculated. The resolution is an arbitrary positive number larger than 0.0, and is used to increase the box size for the calculation of Spectrophores™ in all directions. For example, a resolution of 3 means that the box size will be increased by a value of 3 Å in all directions. Smaller values for the resolution have the effect that small differences in the atomic properties will result in more enhanced differences in the resulting Spectrophores™, while larger resolution values will result in the smoothing of local property differences. All values <= 0.0 are automatically reset to the default value of 3.0.
 Parameters:

r The desired resolution expressed as a double number
void SetAccuracy  (  const AccuracyOption  a = AngStepSize20 
) 
Method to set the accuracy at which Spectrophores™ will be calculated.
Sets the accuracy by which Spectrophores™ are calculated. The accuracy is linked to the angular step increment that is used to calculate Spectrophores™. The accuracy parameter is an enumeration type defined by OBSpectrophore::AccuracyOption. should be a number ranging between 0 and 9 (inclusive), where a value of 9 means a very high accuracy, and 0 means no accuracy at all. Values between 26 are a good compromise between accuracy and speed. The following table provides the link between the parameter value and the angular step size:
Accuracy  OBSpectrophore::AccuracyOption parameter  Minimal angular steps size 
Extremely high  
Extremely high  
Very High  
Very high  
High  
Default  
Low  
Very low  
Extremely low  
Extremely low 
 Parameters:

a The desired accuracy expressed as an OBSpectrophore::AccuracyOption enumeration type
Referenced by OBSpectrophore::OBSpectrophore(), and OBSpectrophore::operator=().
void SetStereo  (  const StereoOption  s = NoStereoSpecificProbes 
) 
Method to set the required stereoselectivity of the resulting Spectrophores™.
Sets the stereoselectivity of the generated Spectrophores™. This is achieved by selecting the appropriate probes for the calculation. In the default case that no stereoselectivity is required, only nonstereospecific probes are used in the calculation. Stereospecific differences between enantiomers are only captured in combination with a very high accuracy, hence leading to very long computation times. The following table provides the link between the parameter value and the desired stereochemical treatment:
Stereo treatment  OBSpectrophore::StereoOption parameter 
Nonstereospecific probes (default)  
Only the mirror stereospecific probes  
Only the unique stereospecific probes  
All stereospecific probes (unique and mirror) 
 Parameters:

s The desired stereospecificity treatment expressed as an OBSpectrophore::StereoOption enumeration type
Referenced by OBSpectrophore::OBSpectrophore(), and OBSpectrophore::operator=().
void SetNormalization  (  const NormalizationOption  n = NoNormalization 
) 
Method to set the desired normalization treatment of the calculated Spectrophores™.
The following table provides the link between the parameter value and the desired normalization treatment:
Normalization treatment  OBSpectrophore::NormalizationOption parameter 
No normalisation (default)  
Normalization towards zero mean  
Normalization towards unit standard deviation  
Normalization towards zero mean and unit standard deviation 
 Parameters:

n The desired normalization treatment expressed as an OBSpectrophore::NormalizationOption enumeration type
Referenced by OBSpectrophore::OBSpectrophore(), and OBSpectrophore::operator=().
OBSpectrophore::AccuracyOption GetAccuracy  (  void  )  const 
Returns the accuracy at which Spectrophores™ will be calculated.
 Returns:
 The accuracy expressed as an OBSpectrophore::AccuracyOption enumeration type. For a link between the returned value and the angular step size, see the OBSpectrophore::SetAccuracy(const OBSpectrophore::AccuracyOption) method.
Referenced by OBSpectrophore::OBSpectrophore(), and OBSpectrophore::operator=().
double GetResolution  (  void  )  const 
Returns the resolution at which Spectrophores™ will be calculated.
 Returns:
 The resolution in Å units
OBSpectrophore::StereoOption GetStereo  (  void  )  const 
Returns the stereoselectivity setting at which Spectrophores™ will be calculated.
 Returns:
 The level of stereospecificity expressed as an OBSpectrophore::StereoOption enumeration type. For a link between the returned value and the stereoselectivity treatment, see the OBSpectrophore::SetStereo(const OBSpectrophore::StereoOption) method.
Referenced by OBSpectrophore::OBSpectrophore(), and OBSpectrophore::operator=().
OBSpectrophore::NormalizationOption GetNormalization  (  void  )  const 
Returns the normalization settings at which Spectrophores™ will be calculated.
 Returns:
 The normalization treatmet expressed as an OBSpectrophore::NormalizationOption enumeration type. For a link between the returned value and the normalization treatment, see the OBSpectrophore::SetNormalization(const OBSpectrophore::NormalizationOption) method.
Referenced by OBSpectrophore::OBSpectrophore(), and OBSpectrophore::operator=().
std::vector< double > GetSpectrophore  (  OpenBabel::OBMol *  mol  ) 
Calling this method starts the calculation of the Spectrophore™. After succesful calculation, the Spectrophore™ is returned as a standard vector of 48 doubles. The 48 doubles are organised into 4 sets of 12 doubles each:
 numbers 0111: Spectrophore™ values calculated from the atomic partial charges;
 numbers 1324: Spectrophore™ values calculated from the atomic lipophilicity properties;
 numbers 2536: Spectrophore™ values calculated from the atomic shape deviations;
 numbers 3748: Spectrophore™ values calculated from the atomic electrophilicity properties;
OpenBabel::OBConversion obconversion; obconversion.SetInFormat("sdf"); OpenBabel::OBMol mol; OpenBabel::OBSpectrophore s; s.SetAccuracy(OpenBabel::OBSpectrophore::AngStepSize20); // Default s.SetResolution(3.0); // Default s.SetStereo(OpenBabel::OBSpectrophore::NoStereoSpecificProbes); // Default s.SetNormalization(OpenBabel::OBSpectrophore::NoNormalization); // Default std::ifstream ifs; ifs.open(argv[1]); while (obconversion.Read(&mol, &ifs)) { std::vector<double> result = s.GetSpectrophore(&mol); for (unsigned int i(0); i < result.size(); ++i) { if (!(i%12)) std::cerr << std::endl; std::cerr << result[i] << " "; } std::cerr << std::endl; mol.Clear(); }
 Parameters:

mol Pointer to the OBMol object from which to calculate a Spectrophore™. For proper functioning, the input molecule should have all explicit hydrogens assigned and the molecule should have a threedimensional conformation assigned. It is the responsability of the programmer to make sure that the molecule is in the desired protonation state.
 Returns:
 The calculated Spectrophore™ as a standard vector of 48 doubles. An empty vector of doubles is returned in case an error occurred during the calculation. For example, this could happen in the case that the molecule contains less than three atoms. It is therefore up to the user to check the size of the returned vector to capture errors.
void _getMoleculeData  (  OpenBabel::OBMol *  mol  )  [protected] 
Referenced by OBSpectrophore::GetSpectrophore().
void _orient  (  void  )  [protected] 
Referenced by OBSpectrophore::GetSpectrophore().
void _getBox  (  double **  c  )  [protected] 
Referenced by OBSpectrophore::GetSpectrophore().
void _setBox  (  void  )  [protected] 
Referenced by OBSpectrophore::SetStereo().
void _getEnergies  (  double **  c,  
double *  e  
)  [protected] 
Referenced by OBSpectrophore::GetSpectrophore().
void _initiateSpectrophore  (  double *  e,  
double *  s  
)  [protected] 
Referenced by OBSpectrophore::GetSpectrophore().
void _rotateX  (  double **  oc,  
double **  nc,  
const double  c,  
const double  s  
)  [protected] 
Referenced by OBSpectrophore::GetSpectrophore().
void _rotateY  (  double **  oc,  
double **  nc,  
const double  c,  
const double  s  
)  [protected] 
Referenced by OBSpectrophore::GetSpectrophore().
void _rotateZ  (  double **  oc,  
double **  nc,  
const double  c,  
const double  s  
)  [protected] 
Referenced by OBSpectrophore::GetSpectrophore().
void _updateSpectrophore  (  double *  ENERGY,  
double *  SPHORE  
)  [protected] 
Referenced by OBSpectrophore::GetSpectrophore().
void _calculateProperties  (  OpenBabel::OBMol *  mol  )  [protected] 
Referenced by OBSpectrophore::GetSpectrophore().
void _solveMatrix  (  double **  A,  
double *  B,  
unsigned int  dim  
)  [protected] 
Referenced by OBSpectrophore::_calculateProperties().
void _luDecompose  (  double **  A,  
std::vector< int > &  I,  
unsigned int  dim  
)  [protected] 
Referenced by OBSpectrophore::_solveMatrix().
void _luSolve  (  double **  A,  
std::vector< int > &  I,  
double *  B,  
unsigned int  dim  
)  [protected] 
Referenced by OBSpectrophore::_solveMatrix().
void _swapRows  (  double *  _pMatrix,  
unsigned int  i,  
unsigned int  j  
)  [protected] 
Referenced by OBSpectrophore::_luDecompose(), and OBSpectrophore::_luSolve().
void _swapRows  (  double **  _pMatrix,  
unsigned int  i,  
unsigned int  j,  
unsigned int  nCols  
)  [protected] 
Member Data Documentation
double _resolution [protected] 
AccuracyOption _accuracy [protected] 
Referenced by OBSpectrophore::GetAccuracy(), OBSpectrophore::operator=(), and OBSpectrophore::SetAccuracy().
StereoOption _stereoFlag [protected] 
Referenced by OBSpectrophore::_setBox(), OBSpectrophore::GetStereo(), and OBSpectrophore::SetStereo().
NormalizationOption _normalization [protected] 
std::vector<int> _rotationStepList [protected] 
Referenced by OBSpectrophore::GetSpectrophore(), and OBSpectrophore::SetAccuracy().
unsigned int _nAtoms [protected] 
double** _property [protected] 
double* _radii [protected] 
double** _oricoor [protected] 
double** _coor [protected] 
unsigned int _beginProbe [protected] 
Referenced by OBSpectrophore::_getEnergies(), OBSpectrophore::_setBox(), and OBSpectrophore::operator=().
unsigned int _endProbe [protected] 
Referenced by OBSpectrophore::_getEnergies(), OBSpectrophore::_setBox(), and OBSpectrophore::operator=().
unsigned int _numberOfProbes [protected] 
std::vector<double> _spectro [protected] 
Referenced by OBSpectrophore::GetSpectrophore(), and OBSpectrophore::operator=().
int value[12] 
struct { ... } _probe[48] [protected] 
Referenced by OBSpectrophore::_getEnergies(), and OBSpectrophore::_setBox().
double x 
Referenced by OBSpectrophore::_orient().
double y 
Referenced by OBSpectrophore::_orient().
double z 
Referenced by OBSpectrophore::_orient().
double v[N_PROPERTIES] 
struct { ... } _boxPoint[12] [protected] 
Referenced by OBSpectrophore::_getBox(), and OBSpectrophore::_getEnergies().
The documentation for this class was generated from the following files: