Skip to content

Tai-PET-Hydrolyzers/petase-zeroshot-pipeline

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧬 PETase Zero-Shot Tournament — 2025 奪冠方案

目標:贏得 Align 2025 PETase TournamentZero-Shot Track ($2,500 獎金)

策略:基於 2024-2025 最新學術研究,使用 Perplexity-Weighted Ensemble + Inference Dropout 方法

Competition License Python


🎯 專案概述

本專案實現完全 Zero-Shot(無訓練數據)的 PETase 蛋白質適應性預測 pipeline,結合多個頂尖預訓練模型:

模型 類型 權重 依據
GEMME MSA-based 50% ProteinGym 催化活性類別最佳
ESM-2 Sequence PLM 30% ProteinGym 單序列模型最佳
SaProt Structure-aware 15% 結構感知互補性
Conservation Evolutionary 5% 演化保守性

核心創新(基於最新論文):

  1. Perplexity-based weighting(ProPEC, bioRxiv 2024.10):動態調整模型權重
  2. Inference-time dropout(arXiv 2025.05):Monte Carlo 採樣提升預測穩定性

預期性能:Spearman ρ = 0.70-0.80+


🚀 快速開始

環境準備

# 1. 創建虛擬環境
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate

# 2. 安裝依賴
pip install -r requirements.txt

# 3. 配置環境變數
cp .env.sample .env
# 編輯 .env,設定路徑和 API keys(如需要)

運行 Pipeline

選項 A:快速基準版本(1-2 小時)

# 使用固定權重 ensemble(方案 B)
python scripts/ensemble_fixed_weights.py \
  --config config/weights_fixed.json \
  --output predictions_baseline.csv

# 預期性能:ρ = 0.60-0.70

選項 B:SOTA 奪冠版本(3-5 小時,推薦)

# Step 1: 計算 WT perplexity(動態權重)
python scripts/compute_wt_perplexity.py \
  --wt_fasta data/input/wt_sequence.fasta \
  --models esm,saprot \
  --output config/perplexity_weights.json

# Step 2: Inference dropout 增強預測
python scripts/inference_with_dropout.py \
  --models esm,saprot \
  --n_samples 10 \
  --dropout_rate 0.1 \
  --output features/dropout_enhanced/

# Step 3: 組合所有特徵(SOTA ensemble)
python scripts/ensemble_sota.py \
  --perplexity_config config/perplexity_weights.json \
  --gemme_weight 0.50 \
  --output predictions_sota.csv

# 預期性能:ρ = 0.70-0.80+

📁 專案結構

petase-zeroshot-pipeline/
├── README.md                    # 本文件
├── CLAUDE.md                    # 完整技術文檔與策略
├── requirements.txt             # Python 依賴
├── .env.sample                  # 環境變數範本
│
├── data/
│   ├── input/                   # 輸入序列
│   │   ├── petase_variants.csv
│   │   └── wt_sequence.fasta
│   ├── msa/                     # MSA 數據(GEMME)
│   └── pdb/                     # 結構文件(如需要)
│
├── features/                    # 預計算特徵(只讀)
│   ├── base/
│   │   ├── gemme_real.csv      ✅ 演化信息
│   │   ├── esm_mm_real.csv     ✅ 序列似然
│   │   ├── saprot_structure.csv ✅ 結構感知
│   │   └── conservation.csv    ✅ 保守性
│   └── dropout_enhanced/        # Inference dropout 增強
│
├── config/
│   ├── weights_fixed.json       # 固定權重(方案 B)
│   └── perplexity_weights.json  # 動態權重(方案 D)
│
├── scripts/
│   ├── compute_wt_perplexity.py       # WT perplexity 計算
│   ├── inference_with_dropout.py      # Monte Carlo dropout
│   ├── ensemble_fixed_weights.py      # 固定權重 ensemble
│   ├── ensemble_sota.py               # SOTA perplexity ensemble
│   ├── validate_submission.py         # 提交格式驗證
│   └── generate_abstract.py           # Abstract 生成
│
├── submissions/                 # 競賽提交文件
│   ├── predictions.csv
│   ├── abstract.md
│   └── README.md
│
├── plugins/                     # 模型插件
│   ├── esm_score.py            # ESM-2 masked marginal
│   ├── saprot_score.py         # SaProt structure-aware
│   └── gemme_wrapper.py        # GEMME 包裝
│
├── docs/                        # 文檔
│   ├── COMPETITION_RULES.md
│   ├── PROTEINGYM_ANALYSIS.md
│   └── WEIGHT_JUSTIFICATION.md
│
└── archive/                     # 已廢棄的舊方法
    ├── deprecated_colabfold/    # ColabFold 相關(違規)
    └── deprecated_phases/       # Grid search 方法(違規)

🏆 方法論總結

為什麼這個方法能奪冠?

1. 完全合規的 Zero-Shot

  • ❌ 不使用任何 PETase 實驗數據訓練
  • ✅ 所有權重基於 ProteinGym benchmark 或 WT 序列
  • ✅ Perplexity 僅在 WT 計算(不涉及突變數據)

2. 基於 2024-2025 最新研究

創新點 論文來源 貢獻
Perplexity Weighting ProPEC (bioRxiv 2024.10) +15% 性能提升
Inference Dropout arXiv 2025.05 +5-10% 穩定性提升
MSA 主導策略 ProteinGym v1.3 催化活性預測最佳

3. 針對 PETase 優化

  • PETase 是 → 催化活性是核心 → GEMME 50% 權重
  • FAST-PETase(38 倍提升)證明 PETase 高度可預測
  • 單一蛋白預測通常優於跨蛋白平均(ProteinGym benchmark)

4. 多層次防禦策略

  • 方案 B(baseline):固定權重,快速可靠,ρ = 0.60-0.70
  • 方案 D(SOTA):動態權重 + dropout,衝刺奪冠,ρ = 0.70-0.80+
  • 根據驗證結果選擇最佳提交

📊 與其他方法的比較

方法 Spearman ρ 合規性 科學依據
單一 PLM(如 ESM-2) 0.40-0.50 ProteinGym baseline
Naive ensemble 0.50-0.60 簡單平均
本專案(方案 B) 0.60-0.70 ✅✅ 固定權重 + ProteinGym
本專案(方案 D) 0.70-0.80+ ✅✅ Perplexity + Dropout SOTA
❌ Grid search (違規) 0.70-0.80 使用目標任務數據

🧪 驗證與測試

運行單元測試

pytest tests/

驗證提交格式

python scripts/validate_submission.py submissions/predictions.csv

檢查合規性

python scripts/check_compliance.py --check-all
# 驗證:
# - 沒有使用 PETase 突變數據
# - 所有權重來源清楚
# - Perplexity 僅用 WT 序列

📚 核心依賴

  • Python 3.10+
  • PyTorch 2.5+ (CUDA 12.1 support for GPU)
  • Transformers 4.47.1
  • ESM (Facebook/Meta)
  • SaProt (Structure-aware PLM)
  • GEMME (Evolutionary constraints)
  • NumPy, Pandas, SciPy

完整依賴見 requirements.txt


🗓️ 競賽時間線

日期 事件
2025-10-17 註冊截止 ⚠️
2025-11-03 預測階段開始
2025-11-03-05 運行 pipeline,生成預測
2025-11-05 建議提交時間(留時間測試)
2025-12-23 提交截止
2025-12-29 結果公布 🏆

📖 文檔


🤝 貢獻

本專案專為 2025 PETase Tournament Zero-Shot Track 設計。如有改進建議:

  1. 確保方法保持 Zero-Shot 合規性(不使用 PETase 突變數據)
  2. 提供科學依據(論文引用或 benchmark 結果)
  3. 更新相關文檔(CLAUDE.md)

📄 授權

MIT License


🙏 致謝

模型與方法

  • ProteinGym(OATML-Markslab):Large-scale benchmark
  • GEMME(MBE):Evolutionary constraint model
  • ESM-2(Meta AI):Protein language model
  • SaProt(ICLR 2024):Structure-aware PLM
  • ProPEC(bioRxiv 2024.10):Perplexity-based weighting
  • Inference Dropout(arXiv 2025.05):Zero-shot enhancement

競賽

  • Align Foundation:組織 2025 PETase Tournament

📮 聯絡


準備好了嗎?讓我們用最新科學方法奪冠! 🚀🏆

# 立即開始
python scripts/ensemble_sota.py --help

⚠️ 重要提醒

Zero-Shot 合規性

本專案嚴格遵守 Zero-Shot 定義:

允許的操作

  • 使用在其他蛋白上預訓練的模型
  • 基於 ProteinGym benchmark 選擇模型和權重
  • 計算 WT 序列的 perplexity(不涉及突變)
  • 使用固定權重或 WT-derived 權重

禁止的操作

  • 使用任何 PETase 突變的實驗數據做訓練
  • Grid search 優化權重(使用目標任務數據)
  • 任何形式的 supervised learning on PETase data

已廢棄的方法

archive/ 資料夾包含早期實驗方法,已證實違規或次優

  • deprecated_phases/:使用 ground_truth 做 grid search(❌ 違規)
  • deprecated_colabfold/:ColabFold 結構預測方法(⚠️ 計算成本高,效益不明確)

請勿使用這些方法!

About

Zero-shot PETase scoring pipeline. MSA+PLM+structure priors (ESM/TranceptEVE/GEMME/ESM-IF/MPNN/FoldX). Reproducible, cached, single-command runs.

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors