A production-grade machine learning pipeline for predicting and optimizing protein thermal stability through rational mutation design. Combines biophysical feature engineering, multi-engine mutation generation (RAG, TRIZ-LLM, MSA consensus), and evolutionary multi-objective optimization.
Note: This repository includes a Lite Mode optimized for 16GB RAM devices. The full pipeline is designed for HPC/cloud environments with significantly larger datasets and computation.
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ORCHESTRATOR (run_all.py) β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β
ββββββββββββββββ¬ββββββββββββββββββββ΄βββββ¬βββββββββββββββββββββββ¬ββββββββββββββ
βΌ βΌ βΌ βΌ βΌ
ββββββββββ βββββββββββββ ββββββββββββββββββββββββββββ βββββββββββ ββββββββββ
βPhase 1 β β Phase 2 β β Phase 3 β β Phase 4 β βPhase 5 β
β Data ββββΆβ Feature β βββΆβ βββββββββ¬ββββββββ¬βββββββ ββββΆβ NSGA-II ββββΆβValidateβ
βIngest β βEngineeringβ β βEngine βEngine βEngineβ β βOptimize β β& SHAP β
ββββββββββ βββββββββββββ β βA: RAG βB: TRIZβC: MSAβ β βββββββββββ ββββββββββ
β βββββββββ΄ββββββββ΄βββββββ β
ββββββββββββββββββββββββββββ
| Phase | Component | Description |
|---|---|---|
| 1 | Data Ingestion | FireProtDB loader + Saboteur synthetic data generator |
| 2 | Feature Engineering | 14D biophysical vectors (RSA, B-factor, BLOSUM, ΞVolume, etc.) |
| 3A | Engine A: RAG | Literature mining via ChromaDB + sentence-transformers |
| 3B | Engine B: TRIZ | Inventive problem-solving + local LLM (Ollama) |
| 3C | Engine C: MSA | Consensus mutations from multiple sequence alignments |
| 4 | Optimization | XGBoost surrogate + NSGA-II multi-objective evolution |
| 5 | Validation | Steric clash filter, Domain of Applicability, SHAP explainability |
| Parameter | Full Mode | Lite Mode | Impact |
|---|---|---|---|
| PDB structures | 50+ | 20 | Dataset size |
| Mutants/protein | 10 | 5 | Training data |
| NSGA-II generations | 50 | 20 | Optimization depth |
| Population size | 100 | 30 | Search space |
| Engine B (TRIZ) | LLM-based | Skipped / Mocked | Resource usage |
| Typical runtime | 2-4 hours | ~2 minutes | - |
| RAM required | 32GB+ | 16GB | - |
The Lite Mode demonstrates the full pipeline architecture on reduced data. For production use with novel proteins, run Full Mode on appropriate hardware.
Pipeline output for Lipase A (PDB: 1ISP) target:
| Rank | Mutations | Stability Score | Conservation | Confidence |
|---|---|---|---|---|
| 1 | G14P; G30P; G111P; G158P; G13A; G176P; G45V; G145P; G67P; A132I | 12.16 | 0.72 | HIGH |
| 2 | G111P; G14P; G158P; A132I; G67P; G30A; G176P; G145P | 11.48 | 0.73 | HIGH |
| 3 | G176A; G145P; G13P; G30A; G111P; G158P; G14P; G67P; A132I | 11.15 | 0.73 | HIGH |
Key insight: Pipeline correctly identifies glycineβproline substitutions for rigidifying flexible loops, a well-established thermostabilization strategy.
- OS: Windows 10/11, Linux, macOS
- Python: 3.11+
- RAM: 16GB (Lite) / 32GB+ (Full)
- Optional: Ollama for Phase 3B LLM features
Windows:
setup_env.batLinux/macOS:
chmod +x setup_env.sh && ./setup_env.shManual:
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
pip install -r requirements.txt# Install Ollama from https://ollama.ai, then:
ollama pull qwen3:4bpython run_all.pyOr run individual phases:
python main_phase1.py # Data ingestion
python main_phase2.py # Feature engineering
python main_phase3_a.py # RAG engine
python main_phase3_b.py # TRIZ engine (requires Ollama)
python main_phase3_c.py # Consensus engine
python main_phase4.py # Evolutionary optimization
python main_phase5.py # Validation & explainabilityβββ config_lite.py # 16GB RAM settings (edit for Full Mode)
βββ run_all.py # Master orchestrator
βββ main_phase*.py # Phase entry points
βββ src/
β βββ ingestion.py # FireProtDB + PDB fetching
β βββ saboteur.py # Synthetic destabilizing mutations
β βββ physics_engine.py # SASA/RSA calculations
β βββ features/ # Biophysical feature extractors
β βββ engines/ # 3 mutation generation engines
β β βββ engine_a/ # RAG (ChromaDB)
β β βββ engine_b/ # TRIZ + LLM
β β βββ engine_c/ # MSA consensus
β βββ optimization/ # XGBoost + NSGA-II
β βββ validation/ # Steric checks + SHAP
βββ data/ # Input data (auto-populated)
βββ results/ # Output candidates + visualizations
βββ docs/ # Additional documentation
| File | Description |
|---|---|
results/FINAL_CANDIDATES_VALIDATED.csv |
Top mutation candidates with confidence scores |
results/phase4_candidates.csv |
All Pareto-optimal candidates |
results/viz/*.pml |
PyMOL visualization scripts |
results/plots/*.png |
SHAP explanation plots |
results/pipeline.log |
Full execution log |
Edit config_lite.py to customize:
# Target protein
TARGET_PDB_ID = "1isp"
TARGET_CHAIN_ID = "A"
PROTECTED_RESIDUES = [57, 102, 195] # Active site - never mutate
# Scale up for Full Mode
MAX_PDB_DOWNLOADS = 50 # Lite: 20
NSGA2_GENERATIONS = 50 # Lite: 20
XGBOOST_ESTIMATORS = 500 # Lite: 200MIT License - See LICENSE
See CONTRIBUTING.md for guidelines.
See SECURITY.md for security policy.
- FireProtDB - Protein stability database
- RCSB PDB - Protein structure database
- Biopython - Computational biology toolkit
- DEAP - Evolutionary algorithms