CoolFace
Apppublic

psriya1807/se3af-protac-docker

sourceHugging Faceupdated 4mo agoView on Hugging Face
0likes
App README

SE3AF v3.8.1 — SE(3)-Equivariant PROTAC Activity Predictor

SE3AF v3.8.1 — SE(3)-Equivariant PROTAC Activity Predictor

Research-Grade PROTAC Degradation Prediction Platform Audited and Fixed by Principal AI Research Scientist


Overview

SE3AF predicts PROTAC (PROteolysis TArgeting Chimera) activity using:

  • SE(3)-equivariant graph transformers for 3D molecular geometry
  • ESM-2 protein language model (1280-dim) for target/E3 ligase sequences
  • AlphaFold structural features with pLDDT confidence weighting
  • Random Forest stacker ensemble on Morgan fingerprints
  • Calibrated probabilities via temperature scaling

Quick Start

bash
# 1. Install dependencies
pip install -r requirements.txt

# 2. Build molecular graph cache
python rebuild_cache.py

# 3. Train
python main.py train --config configs/train_config.json --data data/

# 4. Evaluate
python main.py evaluate --checkpoint checkpoints/best_model.pt --data data/

# 5. Predict single PROTAC
python main.py predict \
    --checkpoint checkpoints/best_model.pt \
    --smiles-target "CC1=CC=C(C=C1)C1=CC(=NO1)..." \
    --smiles-e3 "NC1=CC=CC2=C1C(=O)N(...)..." \
    --smiles-linker "CCOCCOCCOC..." \
    --calibrate

# 6. Batch predictions
python main.py predict \
    --checkpoint checkpoints/best_model.pt \
    --data data/test.csv \
    --out predictions.csv \
    --calibrate

# 7. Launch Web UI
python app.py   # http://localhost:5000

For Better Generalization: Scaffold Split

The default train/val/test split has chemical and protein leakage. For honest evaluation:

bash
# Generate scaffold-based split (no chemical overlap)
python scaffold_split.py --data data/ --out data/split/ --strategy scaffold

# Train on clean split
python main.py train \
    --config configs/train_config.json \
    --data data/split/

# Or use pre-split files
python main.py train \
    --config configs/train_config.json \
    --train-data data/split/train.csv \
    --val-data   data/split/val.csv \
    --test-data  data/split/test.csv

Available Commands

CommandDescription
trainTrain SE3AF on labelled PROTAC data
evaluateEvaluate model with bootstrap 95% CIs
predictRun inference (batch CSV or single SMILES)
cacheRebuild molecular graph feature cache
ablationComponent contribution analysis
exportExport to TorchScript or ONNX

Configuration

All settings in GLOBAL_CONFIG.py (single source of truth).

Key settings:

python
BACKEND = "se3"        # "se3" (SE3 equivariant) or "lite" (faster)
TRAINING_MODE = "fresh" # "fresh" (new) or "continue" (resume)
USE_ALPHAFOLD = True   # AlphaFold structural features
USE_RF = True          # Random Forest stacker ensemble
EPOCHS = 80
LEARNING_RATE = 3e-4
GRAD_ACCUM_STEPS = 4   # effective batch = BATCH_SIZE × 4

Dataset Format

Input CSV columns: | Column | Required | Description | |--------|----------|-------------| | warhead_smiles | Yes | Target-binding ligand SMILES | | linker_smiles | Yes | PEG/alkyl linker SMILES | | e3_ligase_smiles | Yes | E3 ligase binder SMILES | | target_sequence | Optional | Protein amino acid sequence | | e3_ligase_sequence | Optional | E3 ligase amino acid sequence | | target_uniprot | Optional | UniProt ID (for AlphaFold lookup) | | label | Yes (training) | Binary activity (0=inactive, 1=active) |


Architecture

Input:  3 SMILES (warhead, linker, E3 ligand) + 2 protein sequences
          │
          ▼
Graph Encoder × 3 (SE3GraphTransformer or Lite3DEncoder)
[3D coords: ETKDGv3 + MMFF; RBF distance encoding]
          │
          ▼
CrossInteractionFusion
[C(5,2)=10 cross-attention pairs; GOSS pair weighting]
[ESM-2 1280-dim + AlphaFold pLDDT-weighted 4-dim]
          │
          ├──→ Classifier → PROTAC activity probability
          ├──→ Stability head → ternary stability score
          └──→ Interaction head → target engagement score
          │
          ▼
DynamicLossBalancer (Kendall uncertainty weighting, loss ≥ 0)
          │
          ▼
RF Stacker [neural(3) + Morgan FP(6144)] → Final prediction
          │
          ▼
Temperature Scaling → Calibrated probability

Performance (with Data Leakage)

Reported performance on original (leaky) split:

  • AUROC: ~0.84
  • AUPRC: ~0.77
  • F1: ~0.78
  • MCC: ~0.57

Note: These metrics are inflated due to chemical/protein overlap between splits. See reports/LEAKAGE_REPORT.md for details.

True OOD performance (estimated): AUROC ~0.68-0.75


Audit Fixes (v3.8.1)

  1. 1.ImportError fixed (config.py missing symbols added to GLOBAL_CONFIG.py)
  2. 2.Negative loss fixed (DynamicLossBalancer clamped, floored at 0)
  3. 3.Gradient accumulation fixed (true gradaccumsteps=4 now implemented)
  4. 4.Scheduler fixed (total_steps = optimizer steps, not batch steps)
  5. 5.rebuild_cache.py created (was missing from repo)
  6. 6.scaffold_split.py created (Murcko scaffold-based dataset splitter)
  7. 7.13 audit reports generated (see reports/)

See reports/FINAL_CHANGELOG.md for complete list.


Web UI

bash
python app.py  # Flask server at http://localhost:5000

Features:

  • Single PROTAC prediction with 3D molecular viewer
  • Batch CSV upload
  • AlphaFold structure visualization
  • Calibrated probability output

REST API:

bash
python api.py  # REST API at http://localhost:5001/api/predict

Citation

If using SE3AF in research:

bibtex
@software{se3af2024,
  title={SE3AF: SE(3)-Equivariant PROTAC Activity Predictor},
  version={3.8.1},
  year={2026}
}