/MoleculeACE

A tool for evaluating the predictive performance on activity cliff compounds of machine learning models

Primary LanguagePythonMIT LicenseMIT

MolDox logo

repo version python version license

Molecule Activity Cliff Estimation (MoleculeACE) is a tool for evaluating the predictive performance on activity cliff compounds of machine learning models.

MoleculeACE can be used to:

  1. Analyze and compare the performance on activity cliffs of machine learning methods typically employed in QSAR.
  2. Identify best practices to enhance a model’s predictivity in the presence of activity cliffs.
  3. Design guidelines to consider when developing novel QSAR approaches.

📖 Table of Contents

Table of Contents
  1. ➤ Benchmark study
  2. ➤ Tool
  3. ➤ Prerequisites
  4. ➤ Installation
  5. ➤ Getting started
  6. ➤ How to cite
  7. ➤ Licence

Benchmark study

In a benchmark study we collected and curated bioactivity data on 30 macromolecular targets, which were used to evaluate the performance of many machine learning algorithms on activity cliffs. We used classical machine learning methods combined with common molecular descriptors and neural networks based on unstructured molecular data like molecular graphs or SMILES strings.

Activity cliffs are molecules with small differences in structure but large differences in potency. Activity cliffs play an important role in drug discovery, but the bioactivity of activity cliff compounds are notoriously difficult to predict.

Activity cliff example Example of an activity cliff on the Dopamine D3 receptor, D3R

Tool

Any regression model can be evaluated on activity cliff performance using MoleculeACE on third party data or the 30 included molecular bioactivity data sets. All 24 machine learning strategies covered in our benchmark study can be used out of the box.

MolDox logo

Prerequisites

MoleculeACE currently supports Python 3.8. Some required deep learning packages are not included in the pip install.

Installation

Pip installation

MoleculeACE can be installed as

pip install MoleculeACE

Manual installation

git clone https://github.com/derekvantilborg/MoleculeACE

pip install rdkit-pypi pandas numpy pandas chembl_webresource_client scikit-learn matplotlib tqdm python-Levenshtein

Getting started

Train an out-of-the-box model on one of the many included datasets

from MoleculeACE import MPNN, Data, Descriptors, calc_rmse, calc_cliff_rmse, get_benchmark_config

dataset = 'CHEMBL2034_Ki'
descriptor = Descriptors.GRAPH
algorithm = MPNN

# Load data
data = Data(dataset)

# Get the already optimized hyperparameters
hyperparameters = get_benchmark_config(dataset, algorithm, descriptor)

# Featurize SMILES strings with a specific method
data(descriptor)

# Train and a model
model = algorithm(**hyperparameters)
model.train(data.x_train, data.y_train)
y_hat = model.predict(data.x_test)

# Evaluate your model on activity cliff compounds
rmse = calc_rmse(data.y_test, y_hat)
rmse_cliff = calc_cliff_rmse(y_test_pred=y_hat, y_test=data.y_test, cliff_mols_test=data.cliff_mols_test)

print(f"rmse: {rmse}")
print(f"rmse_cliff: {rmse_cliff}")

Evaluate the performance of your own model

from MoleculeACE import calc_rmse, calc_cliff_rmse

# Train your own model
model = ...
y_hat = model.predict(...)

# Evaluate your model on activity cliff compounds
rmse = calc_rmse(y_test, y_hat)
# You need to provide both the predicted and true values of the test set + train labels + the train and test molecules
# Activity cliffs are calculated on the fly
rmse_cliff = calc_cliff_rmse(y_test_pred=y_hat, y_test=y_test, smiles_test=smiles_test, y_train=y_train, 
                             smiles_train=smiles_train, in_log10=True, similarity=0.9, potency_fold=10)

print(f"rmse: {rmse}")
print(f"rmse_cliff: {rmse_cliff}")

How to cite

You can currently cite our pre-print:

van Tilborg et al. (2022). Exposing the limitations of molecular machine learning with activity cliffs. ChemRxiv.

License

MoleculeACE is under MIT license. For use of specific models, please refer to the model licenses found in the original packages.