- Reading experimetal logP data
- Model with simple descriptors
- Calculating fingerprints
- Comparing fingerprint models
The octanol-water partition coefficient, or logP, is one of the most important properties for determining a compound’s suitability as a drug. Currently, most of the available regression models for in silico logP prediction are trained on the PHYSPROP database of experimental logP values. However most of the compounds in this database are not highly representative of the drug-like chemical space. Unfortunately, there is currently a lack of publicly available experimental logP datasets for biological compounds which can be used to train better prediction tools.
In this small test, I have decided to use the experimental logP data released in the paper: “Large, chemically diverse dataset of logP measurements for benchmarking studies” by Martel et al1. As this is a preliminary study, we are interested in finding which featurization methods work best for predicting logP.
Most of the popular tools for logP prediction are based on physical descriptors, such as atom type counts, or polar surface area, or on topological descriptors. Here, we will calculate different physical descriptors, as well as structural fingerprints for the molecules, and benchmark their performance using three different regression models: neural network, random forest, and support vector machines.
We first import some libraries including RDKit and scikit-learn tools (The utility script contains custom functions for generating TPATF and TPAPF fingerprints):
The utility script can be found in this Gist.
Reading experimetal logP data
The supplementary pdf file from the Martel et al. paper was converted to csv text format using the Linux pdftotext utility from the Poppler library. The experimental data is read as a csv file, and the SMILES strings are converted to RDKit molecules.
Shape: (707, 7)
Convert SMILES to 2D molecules:
Next, we use RDKit to calculate some physical descriptors:
As a baseline, we calculate the performance of RDKit’s calculated MolLogP vs the experimental logP.
As we can see above, RDKit’s logP predictions have a relatively high mean square error, and a weak coefficient of determination for this dataset. RDKit’s MolLogP implementation is based on atomic contributions. Hence, we will first try to train our own simple logP model using the RDKit physical descriptors that we generated above.
Model with simple descriptors
These are the descriptors that we will use for the model:
For the regression, we will use a Random Forest with the default parameters from scikit-learn, and set aside one third of the data for testing.
The scores of our model are:
As we can see, using these simple descriptors coupled with scikit-learn’s default random forest gets us a higher R2 and MSE performance than the RDKit logP predictor. This, however is likely due to the differences in the training set that we used, versus the one that they used to develop their model. It would be interesting to see how much we can improve the performance by tuning the random forest parameters, and then measure the performance on the PHYSPROP dataset.
Now that we saw the performace of the simple molecular descriptors, we would like to assess the performance of some of the most popular molecular fingerprints. Among the many available methods, we will test Morgan fingerprints (ECFP4 and ECFP6), RDKFingerprints, and topological pharmacophore fingerprints (TPAPF and TPATF), the scripts for which are available from MayaChemTools.
I created a function for parallelizing a DataFrame’s apply() function. This makes TPATF and TPAPF fingerprint calculation much faster. This function has become one of my most useful snippets of code:
Comparing fingerprint models
Finally, here we apply three different types of regression models to estimate the performance of the different fingerprints.
Overall, the TPATF fingerprint performed the best — even outperforming the simple descriptor model. The default random forest had the best performance out of all the regression methods, although it is very possible that this will change after some optimization of the model parameters.
In later works, we will further tune models using simple physical descriptors as well as TPATF fingerprints, and compare their performance to existing logP predictors using this dataset, as well as the PHYSPROP set. It would also be interesting to observe the effects of consensus scoring using several models.
Martel, S., Gillerat, F., Carosati, E., Maiarelli, D., Tetko, I. V., Mannhold, R., & Carrupt, P.-A. (2013). Large, chemically diverse dataset of logP measurements for benchmarking studies. European Journal of Pharmaceutical Sciences, 48(1-2), 21–29. doi: 10.1016/j.ejps.2012.10.019 ↩