Predicting molecular toxicity and drug solubility from SMILES structures using cheminformatics and machine learning.
Drug toxicity assessment is one of the most expensive and time-consuming bottlenecks in pharmaceutical development. Traditional wet-lab testing for thousands of candidate compounds requires significant resources. This project applies machine learning to the Tox21 and ESOL benchmark datasets to predict molecular toxicity and aqueous solubility directly from a compound's SMILES string — enabling faster early-stage filtering of drug candidates.
SMILES Input
│
▼
Feature Engineering (RDKit)
├── Morgan Fingerprints (radius=3, 4096 bits)
├── Physicochemical Descriptors (MW, LogP, TPSA, HBD/HBA)
└── Additional Molecular Descriptors
│
▼
Model Training
├── Random Forest Classifier/Regressor
├── XGBoost
└── DeepChem Neural Models
│
▼
Evaluation
├── Scaffold-Based Cross-Validation (realistic generalization split)
├── AUROC / AUPRC (toxicity classification)
└── RMSE / R² (solubility regression)
│
▼
Streamlit Web App → drug-toxi-prediction.streamlit.app
| Dataset | Task | Size | Source |
|---|---|---|---|
| Tox21 | Multi-label toxicity classification (12 endpoints) | ~8,000 compounds | MoleculeNet |
| ESOL | Aqueous solubility regression | ~1,100 compounds | MoleculeNet |
Why scaffold-based splits? Random train/test splits can leak structural information between sets. Scaffold splitting groups compounds by their core chemical skeleton, giving a more honest estimate of how the model generalizes to structurally novel compounds — the scenario that matters in real drug discovery.
| Category | Tools |
|---|---|
| Language | Python 3.9+ |
| Cheminformatics | RDKit, DeepChem |
| Feature Extraction | Morgan Fingerprints, physicochemical descriptors (MW, LogP, TPSA, HBD/HBA) |
| ML Models | scikit-learn, XGBoost |
| Evaluation | AUROC, AUPRC, RMSE, R² |
| Deployment | Streamlit |
| Data | pandas, NumPy |
| Visualization | matplotlib, seaborn |
internship_project/
├── app.py # Streamlit web application
├── config.py # Configuration and constants
├── requirements.txt # Dependencies
├── data/ # Raw and processed datasets
├── notebooks/ # Exploratory analysis and model training notebooks
├── src/ # Source modules (feature engineering, training, evaluation)
├── models/ # Saved model artifacts
└── reports/figures/ # Output plots and evaluation figures
python >= 3.9git clone https://github.com/blank26-10/internship_project.git
cd internship_project
pip install -r requirements.txtstreamlit run app.pyOr visit the live deployment: drug-toxi-prediction.streamlit.app
Feature Engineering with RDKit
Morgan fingerprints encode the local chemical environment of each atom up to a defined radius (r=3), producing a 2048-bit binary vector. Combined with physicochemical properties (molecular weight, lipophilicity, polar surface area), these features give the model a rich view of each compound.
Scaffold-Based Cross-Validation
Using Bemis-Murcko scaffold decomposition to partition the dataset — the model never sees a scaffold during training that it will be evaluated on. This mimics the real-world drug discovery challenge of predicting activity for truly novel scaffolds.
Evaluation Metrics
- AUROC: Measures the model's ability to rank toxic compounds above non-toxic ones across all thresholds.
- AUPRC: Particularly relevant for imbalanced toxicity datasets where positive (toxic) examples are rare.
| Task | Model | Metric | Score |
|---|---|---|---|
| Toxicity (Tox21) | Random Forest | AUROC | >0.82 |
| Toxicity (Tox21) | XGBoost | AUROC | >0.78 |
This project was developed as part of a Data Science & AI/ML internship through the ERA Foundation's ComedKares initiative, completing the full pipeline from raw data to deployed application. The work covers molecular featurization, model development, evaluation under realistic generalization conditions, and web deployment.
MIT License — see LICENSE for details.