pKaPredict
📦 Overview
pKaPredict is a cheminformatics tool that predicts the acid dissociation constant (pKa) of chemical compounds from their SMILES strings. The package is designed to be easily pip-installable and modular, making it ideal for cheminformatics applications. The package combines RDKit generated molecular descriptors with a pre-trained LGBMRegressor model for fast, reproducible predictions. The workflow includes training data preprocessing, descriptor generation, model loading, prediction, and result visualization.
💡 Main Functions :
Functions used to train the machine learning model on a training dataset
→ download_raw_dataset Downloads a CSV file from a given URL and saves it in the specific data directory.
→ preview_data Loads and previews the raw pKa dataset from a relative file path.
→ clean_and_visualize_pka Cleans the training dataset by removing duplicates and missing values; also provides basic visualizations for data exploration.
→ RDKit_descriptors Transforms a DataFrame of SMILES into molecular descriptors, used for training the model.
→ plot_data Creates scatter plots comparing predicted vs. experimental pKa values to evaluate model performance and choose the most adapted model for this usage.
→ plot_k_vs_r2_ET and LGBMplot_k_vs_r2 Plots R² scores versus number of selected features (k) and saves the plot for the two machine learning models tested.
Core functions for predicting pKa from user-provided SMILES inputs
→ load_model Loads the pre-trained LightGBM model optimized for pKa prediction.
→ smiles_to_rdkit_descriptors Converts a user-provided SMILES input into a vector of RDKit molecular descriptors.
→ predict_pKa Takes molecular descriptors as input and returns predicted pKa values using the loaded model.
👩💻 Installation
- Clone the repository:
git clone https://github.com/anastasiafloris/pKaPredict.git
cd pKaPredict
- Create and activate the conda environnement:
conda create -n pkapredict_env python=3.10 -y
conda activate pkapredict_env
- Install the package:
pip install pKaPredict
🍏 For macOS users (⚠ required for LightGBM to work):
- Install the system library libomp:
brew install libomp
If brew is not installed, follow the instructions here: https://brew.sh
- Navigate to the script folder of the package in your terminal:
cd script
- The package is yours 🎁:
Run the runpackage.py file in your terminal to predict the pKa of a molecule of your choice, using its SMILES string:
python runpackage.py
🪪 License
This project is licensed under the MIT License.
You are free to use, modify, and distribute it with proper attribution.
📗 References
The dataset used in this project is the test_acids_bases_descfinal_nozwitterions.csv file from the cbio3lab repository.
It was originally extracted from the Harvard Dataverse.
👯♀️ Authors
This project was completed as part of the EPFL course Practical Programming in Chemistry.
Metadata
Release files for pKaPredict 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pkapredict-0.2.0.tar.gz | 4.9 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pkapredict-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 5.1 MB
Release files / pkapredict-0.2.0.tar.gz
| Download URL | pkapredict-0.2.0.tar.gz |
|---|---|
| Size | 4.9 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b37e5226cf275d1820e13b6d593aa786e60f758739cfff507aa645bd9df58ae9
|
|
BLAKE2b-256 checksum How to use checksums |
c48ac18e3a7c4b7978f15d090307f40344b05e4d1a56eb171a5d37b9fecaad6d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / pkapredict-0.2.0-py3-none-any.whl
| Download URL | pkapredict-0.2.0-py3-none-any.whl |
|---|---|
| Size | 147.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50571f79e2200ad6f3b987d6b480e42db80bb477fb5e3e1eab5ce01cfde23f57
|
|
BLAKE2b-256 checksum How to use checksums |
1cea5f5c97be25707f555f483ab0adc64b09f3c15d5b6d0247f6e988efd054ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|