Skip to content

Create-source1/idp-molprop

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IDP-MolProp

A small cheminformatics pipeline that links ML-based molecular property prediction to lightweight conformational sampling of short peptides — a bridge between small-molecule drug design and the biophysics of intrinsically disordered proteins (IDPs).

Python 3.10+ License: MIT RDKit


Motivation

Most cheminformatics packages stop at the small molecule. Most IDP / biophysics tools start at the full-length protein. The space in between — short peptides, floppy linkers, drug-like fragments that engage disordered targets — is where a lot of interesting chemistry happens, and where a quick "what does this look like in terms of property space and conformational space, side by side?" tool is genuinely useful.

IDP-MolProp does exactly that. Paste in a SMILES and get RDKit descriptors plus a Random-Forest prediction of logS and BBB permeability. Paste in a peptide sequence and get a Ramachandran-based ensemble with the Rg distribution that groups like Dr. Mondal's (and others working on IDP biophysics) routinely use as the headline observable for ensemble compactness.

It is intentionally lightweight: a single pip install away, no GPU, no forcefields, no external services. The peptide sampler is a statistical-coil model (residue-specific Ramachandran basins → NeRF reconstruction), not a substitute for MD — it's the kind of fast prior you want to look at before deciding whether a longer simulation is worth the compute.

Background

I'm a medicinal chemist by training who moved into software engineering, so this project sits squarely in my "I want to keep one foot in chemistry" territory. The pipeline reflects that: ML predictions and descriptors that a med-chemist actually uses (Ro5, logS, BBB), and a conformational sampler that speaks the language of the IDP literature (Rg histograms, Flory exponent, Ramachandran basins).


Modules

1. Molecular Property Predictor (idp_molprop.property_predictor)

Input: SMILES → RDKit descriptors + ML predictions.

  • Descriptors (RDKit): molecular weight, logP (Crippen), H-bond donors/acceptors, rotatable bonds, TPSA, ring count, Lipinski Ro5 compliance.
  • ML predictions: aqueous solubility (logS, Random Forest regressor on Morgan / ECFP4 fingerprints) and BBB permeability probability (Random Forest classifier). Both models train on small built-in curated sets on first use and cache to models/, so the pipeline is fully self-contained.
  • Visualisation: a normalised drug-likeness radar plot vs the Ro5 limit.

Drug-likeness radar charts for aspirin, ibuprofen, caffeine

from idp_molprop import MolecularPropertyPredictor
from idp_molprop.property_predictor import radar_chart

pred = MolecularPropertyPredictor(predict_bbb=True)
props = pred.predict("CC(=O)Oc1ccccc1C(=O)O")  # aspirin
print(props.to_summary())
fig = radar_chart(props, title="Aspirin")
fig.savefig("aspirin.png", dpi=150, bbox_inches="tight")

2. Peptide Conformational Sampler (idp_molprop.peptide_sampler)

Input: 1-letter amino acid sequence (5–40 residues) → ensemble of backbone conformations + observables.

  • Residue-specific Ramachandran basins (αR, β, PPII, αL) with proper distributions for glycine (broad, both halves of φ space) and proline (restricted to φ ≈ −60°).
  • 3D backbone reconstruction via NeRF (Natural Extension Reference Frame).
  • Per-conformation radius of gyration (Rg, CA-only mass-weighted) and end-to-end distance.
  • Built-in scaling fit returning the Flory exponent ν.
  • Plotters for Rg histograms (with Flory random-coil reference overlay) and pooled Ramachandran scatter.

Rg histograms for polyA, polyG, polyP, and a mixed sequence Rg distributions across model sequences. PolyP collapses to the tightest, narrowest distribution (rigid PPII), polyA is broader, polyG even more so. The green dashed line is the Kohn et al. random-coil reference Rg = 2.49·N0.509.

from idp_molprop import PeptideConformationalSampler
from idp_molprop.peptide_sampler import plot_rg_histogram

sampler = PeptideConformationalSampler(seed=42)
ens = sampler.sample("GSDEKSPGNS", n_conformations=1500)
print(f"<Rg> = {ens.rg_mean:.2f} ± {ens.rg_std:.2f} A")
print(f"Flory exponent  = {ens.flory_exponent():.2f}")
fig = plot_rg_histogram(ens)
fig.savefig("ensemble.png", dpi=150, bbox_inches="tight")

# Export the first 20 conformations as a multi-model PDB for PyMOL / ChimeraX
sampler.to_pdb(ens, "GSDEKSPGNS.pdb", max_models=20)

Rg histogram + Ramachandran scatter for GSDEKSPGNS Per-ensemble detail: Rg distribution (left) and pooled Ramachandran scatter (right). The four basins — αR, β, PPII (upper-left), αL — are clearly resolved, with the glycine-only mirror points visible in the φ > 0 region.

3. Streamlit Web Interface (app.py)

Pick a module from the sidebar, paste a SMILES or a sequence, get the predictions and plots inline. Downloads available for PDB and CSV outputs.

Streamlit UI screenshot


Installation

git clone https://github.com/Create-source1/idp-molprop.git
cd idp-molprop
python -m venv .venv
source .venv/bin/activate          # on Windows: .venv\Scripts\activate
pip install -r requirements.txt
pip install -e .

RDKit is the only dependency that occasionally surprises users — if pip can't resolve it, fall back to conda:

conda install -c conda-forge rdkit
pip install -r requirements.txt

Quick start

# Module 1 — CLI
python -m idp_molprop.property_predictor "CC(=O)Oc1ccccc1C(=O)O" --plot aspirin.png

# Module 2 — CLI
python -m idp_molprop.peptide_sampler "GSDEKSPGNS" -n 1500 --plot rg.png --pdb ens.pdb

# Module 3 — web app
streamlit run app.py

# End-to-end demo (writes figures + PDB into assets/)
python examples/demo.py

# Tests
pytest tests/ -v

Deploying the Streamlit app

The app is set up to deploy on Streamlit Community Cloud out of the box. Push the repo to GitHub, connect Streamlit Cloud to it, set the entry point to app.py, and you're live.


Project layout

idp-molprop/
├── idp_molprop/
│   ├── __init__.py
│   ├── property_predictor.py     # Module 1 — RDKit descriptors + RF models
│   └── peptide_sampler.py        # Module 2 — Ramachandran sampler + NeRF
├── tests/
│   └── test_pipeline.py
├── examples/
│   └── demo.py                   # End-to-end demo
├── assets/                       # Generated figures + sample PDB
├── models/                       # Cached RF models (auto-generated)
├── app.py                        # Module 3 — Streamlit UI
├── requirements.txt
├── setup.py
├── LICENSE
└── README.md

Validation of the conformational sampler

The NeRF backbone-builder reproduces canonical geometry exactly: bond angles of 111° / 116.2° / 121.7° (within machine precision), trans peptide bond ω = 180°, CA–CA distance of 3.80 Å. A 10-residue polyalanine helix (φ, ψ = −63°, −42°) gives an end-to-end CA–CA distance of 14.6 Å, matching the expected ~5.4 Å rise per turn × 2.78 turns.

Ensemble-level numbers for 10-residue homopolymers (n = 600 conformations):

Sequence ⟨Rg⟩ (Å) σ(Rg) ⟨Ree⟩ (Å) ν (Flory) Kohn ref. (Å)
polyA 6.95 1.13 17.7 0.77 8.04
polyG 6.13 1.07 14.7 0.67 8.04
polyP 6.18 0.88 15.1 0.70 8.04
GSDEKSPGNS 6.42 1.13 17.0 0.72 8.04

These are CA-only Rg values; the slight under-prediction relative to the all-atom Kohn et al. random-coil reference is the expected geometric offset. The sampler does not include side chains or excluded volume, so it should be read as a fast statistical-coil prior — not a substitute for MD.


Notes and limitations

  • The built-in training sets for the logS and BBB models are tiny (~35 and ~25 compounds respectively) and exist mainly so the pipeline is self-contained and runs offline. For serious use, swap in ESOL / AqSolDB for logS and the MoleculeNet BBBP set for BBB — the _train_*_model functions in property_predictor.py show exactly where.
  • The peptide sampler has no excluded volume and no side chains. Conformations can self-clash. The output is intended as a quick ensemble visualisation and a baseline distribution to compare more rigorous simulations against, not a final geometry.
  • The ESMFold "one structure" stretch goal from the original spec is left as a future addition (it adds a heavyweight torch + transformers dependency that hurts the "small, runs anywhere" feel of the pipeline). If you need it, ESMFold's HuggingFace checkpoint slots in cleanly as an optional third method on PeptideConformationalSampler.

About

Cheminformatics pipeline: molecular property prediction + peptide conformational sampling for IDPs.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages