Table of Contents
This project evaluates the impact of additional feature incorporation into molecular models. We compare:
- ProteoChemometric Models (PCM)
- Proteochemometric Assay-aware Models (PCAM)
We recommend using a virtual environment (e.g. conda) to manage dependencies.
- Conda (Miniconda or Anaconda)
- Python ≥ 3.8
- PyTorch ≥ 2.0
- RDKit
- Weights & Biases (wandb)
- scikit-learn, numpy, pandas, seaborn, matplotlib
Create and activate the Conda environment: To replicate this work, install dependencies using Conda
conda env create --file=environments/environment_linux.yml
conda activate pcam-env
# Optional: enforce pip trusted hosts via pip.conf
export PIP_CONFIG_FILE=$(pwd)/environments/pip.conf- Please choose the correct file depending on your operating system
- If the file environment_{OS}.yml gives you an error, please use the ones with "*_conda" suffix.
- If any issues arise here, please raise an issue following the guidelines in CONTRIBUTING.md file.
- src/: Source code including data preprocessing, models, configurations, and feature utilities.
- notebooks/: Jupyter notebooks for exploratory analysis and results.
- logs/: Storage for training logs.
- figures/: Output figures for analysis.
- tests/: Unit tests for model performance and feature extraction.
project_root/
│── src/ # Source Code Directory
│ ├── data/
│ │ ├── data_papyrus.py
│ │ ├── ..
│ ├── models/
│ │ ├── pnn.py
│ │ ├── ..
│ ├── config/
│ │ ├── pnn.json
│ │ ├── papyrus.json
│ │ ├── ..
│ ├── logs/
│ ├── figures/
│── notebooks/ # Jupyter Notebooks for Exploratory Analysis
│ ├── data_analysis.ipynb
│ ├── model_performance.ipynb
│── docs/ # Documentation
│── tests/
│── LICENSE
│── README.md
│── CONTRIBUTING.md
│── environments/ # Conda environment YAML files
│ ├── environment_linux.yml
│ ├── environment_linux_conda.yml
│ ├── environment_windows.yml
│ ├── environment_windows_conda.yml
│ ├── environment_linux_118.yml
│── .gitignore
The datasets used in this work are publicly available at:
Download the datasets and place them in the data/ directory.
For Papyrus dataset, the latest version will be downloaded automatically by the data_papyrus.py script.
Run the following scripts to preprocess the datasets:
python -m src.data.data_papyrus
python -m src.data.data_chemblThis will generate the preprocessed datasets in the data/ directory.
As an example to use data_papyrus.py:
python -m src.data.data_papyrus --activity xc50 --descriptor_protein ankh-large --descriptor_chemical ecfp2048 --split_type time --n_targets -1 --file_ext pkl --sanitizeAs an example to calculate assay embeddings with data_papyrus.py:
python -m src.data.data_papyrus --activity xc50 --descriptor_protein ankh-base --descriptor_chemical ecfp2048 --descriptor_assay BioBERT --recalculate --split_type random --n_targets -1 --file_ext pkl --sanitizeAs an example to load embeddings from precalculated embeddings file in src/data/dataset/embeddings with data_papyrus.py:
python -m src.data.data_papyrus --activity xc50 --descriptor_protein ankh-large --descriptor_chemical ecfp2048 --descriptor_assay BioBERT --recalculate --split_type random --n_targets -1 --file_ext pkl --sanitize --from_filefor more information on the json embedding file, check the src/data/dataset/embeddings/ankh-large.json example file.
If you would like to calculate all descriptors and all splits of Papyrus, run the following: For xc50 dataset:
python -m src.data.data_papyrus --activity xc50 --all_descriptors --split_type all --n_targets -1 --file_ext pkl --sanitizeFor kx dataset:
python -m src.data.data_papyrus --activity kx --all_descriptors --split_type all --n_targets -1 --file_ext pkl --sanitize An example to prepare the max_curated dataset from data_chembl.py:
For the IC50 dataset including the assay descriptors:
python -m src.data.data_chembl --data_name max_curated --activity IC50 --descriptor_protein ankh-base --descriptor_chemical ecfp2048 --descriptor_assay BioBERT --recalculate --split_type random --n_targets -1 --file_ext pkl --sanitizeTo test model training for this dataset:
python -m src.models.model_parser --model pnn --data_name max_curated --n_targets -1 --activity_type IC50 --descriptor_protein ankh-large --descriptor_chemical ecfp2048 --descriptor_assay BioBERT --split_type random --ext pkl --task_type regression --wandb_project_name pnn-maxchembl-testAn example to prepare the all_gpcr dataset from data_chembl.py:
python -m src.data.data_chembl --data_name all_gpcr --activity all --descriptor_protein ankh-large --descriptor_chemical ecfp2048 --descriptor_assay BioBERT --recalculate --split_type random --n_targets -1 --file_ext pkl --sanitize To test model training for this dataset:
python -m src.models.model_parser --model pnn --data_name all_gpcr --n_targets -1 --activity_type all --descriptor_protein ankh-large --descriptor_chemical ecfp2048 --descriptor_assay BioBERT --split_type random --ext pkl --task_type regression --wandb_project_name pnn-maxchembl-test=======
The data_*.py script allows you to specify various options for data preprocessing.
The following options are available:
--activity: Activity type--all_descriptors: A flag to Calculate all (pairs) of descriptor combinations--descriptor_protein: Protein descriptor--descriptor_chemical: Chemical descriptor--split_type: Split type--n_targets: Number of top targets--recalculate: Recalculate descriptors--splits: Split proportions (e.g., 0.7,0.15,0.15)--file_ext: File extension--batch_size: Batch size--max_k_clusters: Max k clusters--optimal_k: Optimal k--min_datapoints: Min datapoints--min_actives: Min actives--active_threshold: Active threshold--only_normal: Consider only normal activity values--stratify_by: Stratify by column--sanitize: Standardize and Sanitize SMILES
TODO
The package provides several scripts to train and test different models. The main entry point is the model_parser.py
script, which allows you to specify various options for data, model, and training configuration.
To train and test the PNN (baseline) model, use the following command:
python -m src.models.model_parser --model pnn --data_name papyrus --n_targets -1 --activity_type xc50 --descriptor_protein ankh-large --descriptor_chemical ecfp2048 --split_type random --ext pkl --task_type regression --wandb_project_name pnn-testTo train and test the ensemble model, use the following command:
python -m src.models.model_parser --model ensemble --ensemble_size 100 --data_name papyrus --n_targets -1 --activity_type xc50 --descriptor_protein ankh-large --descriptor_chemical ecfp2048 --split_type random --ext pkl --task_type regression --wandb_project_name ensemble-test
To train and test the MC-Dropout model, use the following command:
python -m src.models.model_parser --model mcdropout --num_mc_samples 100 --data_name papyrus --n_targets -1 --activity_type xc50 --descriptor_protein ankh-large --descriptor_chemical ecfp2048 --split_type random --ext pkl --task_type regression --wandb_project_name mcdp-testTo train and test the Evidential model, use the following command:
python -m src.models.model_parser --model evidential --data_name papyrus --n_targets -1 --activity_type xc50 --descriptor_protein ankh-large --descriptor_chemical ecfp2048 --split_type random --ext pkl --task_type regression --wandb_project_name evidential-testIf you want to try any of those models with max_curated, change the --data-name argument to
To test model training for this dataset:
python -m src.models.model_parser --model pnn --data_name max_curated --n_targets -1 --activity_type IC50 --descriptor_protein ankh-large --descriptor_chemical ecfp2048 --split_type random --ext pkl --task_type regression --wandb_project_name pnn-maxchembl-testThe model_parser.py script allows you to specify various options for data, model, and training configuration. The
following options are available:
--model: Model type (pnn, ensemble, mcdropout, evidential)--data_name: Dataset name (papyrus, max_curated)--n_targets: Number of targets to train on (-1 for all targets)--activity_type: Activity type (xc50, kx)--descriptor_protein: Protein descriptor type (ankh-large, ankh-small, unirep, )--descriptor_chemical: Chemical descriptor type (ecfp2048, ecfp1024, , )--split_type: Split type (random, scaffold, time)--ext: File extension (pkl, parquet, csv)--task_type: Task type (regression, classification)--wandb_project_name: Weights and Biases project name for logging--ensemble_size: Ensemble size for ensemble models--num_mc_samples: Number of MC samples for MC-Dropout models--seed: Random seed for reproducibility--epochs: Number of epochs for training--batch_size: Batch size for training--lr: Learning rate for training--seed: Random seed for reproducibility--device: Device for training (cpu, cuda)
This project is licensed under the MIT License—see the LICENSE file for details.
B.K. acknowledges funding from the European Union’s Horizon 2020 research and innovation programme under the Marie Skłodowska-Curie grant agreement No. 955879. DRUGTrain. B.K., N.D., and H.V.V. are affiliated with Janssen Pharmaceutica, a Johnson and Johnson company. The content of this research project has been conducted for academic purposes only.
If you use this work in your research, please cite the following paper:
@article{pcam2025,
title={PCAM: Proteochemometric Assay-aware Modeling for bioactivity modelling},
author={Khalil, Bola and Schoenmaker, Linde and Araripe, David Alencar and Dyubankova, Natalia and van Vlijmen, Herman W T and van Westen, Gerard J P},
journal={},
volume={},
pages={},
year={},
publisher={}
}
We welcome contributions! Please see our CONTRIBUTING.md file for guidelines on how to contribute to this project.
For any queries, please contact us at
Bola Khalil: b.a.a.khalil@lacdr.leidenuniv.nl
Linde Schoenmaker: l.schoenmaker@lacdr.leidenuniv.nl
David Araripe: d.figueiredo.vidal@lacdr.leidenuniv.nl