CoolFace
Apppublic

wenqi-yue/peptide-screening-tool

sourceHugging Facemitupdated 3mo agoView on Hugging Face
0likes
App README

<!-- The block above is Hugging Face Spaces configuration. It tells the Space to run app.py as a Streamlit app. Leave it in place when deploying to HF. -->

Peptide Screening Tool

A molecular-engineering engine that screens, optimizes, and (next) discovers peptides for cell-membrane permeability under a strict, non-toxic safety profile.

Run it locally (one command)

bash
# one-time setup (creates .venv and installs runtime deps):
python3 -m venv .venv && source .venv/bin/activate && pip install -r requirements.txt

# launch the dashboard — the screening engine runs in-process, no backend needed:
streamlit run app.py        # → http://localhost:8501

Then open http://localhost:8501 and click Analyze next to any example peptide.

What each file does

FileRole
app.pyStreamlit dashboard and entry point — runs the screening engine in-process
processor.pyBiophysical features + DBAASP-inspired safety filter (Safe / Review / Unsafe)
optimizer.pyPermeability score (trained model, heuristic fallback) + safe optimization search
train_models.pyTrains the permeability model → models/permeability_model.joblib
models/Trained model shipped with the app (commit this so the Space can load it)
main.pyOptional standalone FastAPI backend (not required by the app anymore)
fetch_data.pyPulls the basic CPP benchmark dataset
harvest_advanced_data.pyBuilds the two-label data/advanced_peptide_space.csv (permeability + toxicity)
data/Downloaded + processed datasets (needed to retrain, not to run the app)
requirements.txtRuntime dependencies for the deployed app
requirements-dev.txtFull dev / retraining / data-harvesting / FastAPI dependencies

The permeability model

The permeability score is a trained Random Forest (models/permeability_model.joblib) learned from 5,651 labeled sequences (pLM4CPPs + KELM CPP / non-CPP), using 8 biophysical features from processor.py. On a held-out 20% test split it scores ROC-AUC ≈ 0.94, versus 0.84 for the previous hand-tuned heuristic — a real improvement. If the model file is absent, optimizer.permeability_score() transparently falls back to the heuristic.

Retrain any time with:

bash
pip install -r requirements-dev.txt
python train_models.py

Honest limits. (1) The score is a CPP-likelihood proxy, validated in-silico only — it can misjudge out-of-distribution inputs (e.g. homopolymers). (2) Safety is NOT a trained model: the bundled toxicity labels (ToxinPred2) are length-confounded and contain almost no short non-toxic peptides, so the app keeps its transparent rule-based hemolysis/lytic filter instead. A proper safety model needs short-peptide hemolysis data (HemoPI / HAPPENN).

Deploy it free on Hugging Face Spaces

  1. 1.Create a new Space at <https://huggingface.co/new-space> → SDK: Streamlit.
  2. 2.Push this repo to the Space (the frontmatter above wires it up to app.py).
  3. 3.The Space builds from requirements.txt and serves a public URL.

The deployed app is fully self-contained — the screening engine runs inside the Streamlit process, so there is no separate backend to start.

Data status

data/advanced_peptide_space.csv — 22,117 sequences with two independent labels: cpp_label (permeability) and tox_label (safety). Product target = permeable and safe.

Safety note

Screening and optimization are research triage aids — not a substitute for wet-lab validation.