SgTxGNN - Singapore: Drug Repurposing
本專案由 藥提醒科技有限公司(yao.care)開發與維運。
SgTxGNN 站台:https://sgtxgnn.yao.care/|產品總覽:https://www.yao.care/medical/txgnn/
Drug repurposing predictions for Singapore HSA-approved drugs using the TxGNN model.
Disclaimer
- The results of this project are for research purposes only and do not constitute medical advice.
- Drug repurposing candidates require clinical validation before application.
Project Overview
Report Statistics
| Item | Count |
|---|
| Drug Reports | 966 |
| Total Predictions | 10,473,055 |
| Unique Drugs | 1,041 |
| Unique Indications | 17,184 |
| DDI Data | 160,235 |
| FHIR Resources | 999 MK / 4,189 CUD |
Evidence Level Distribution
| Evidence Level | Report Count | Description |
|---|
| L1 | 11 | Multiple Phase 3 RCTs |
| L2 | 34 | Single RCT or multiple Phase 2 |
| L3 | 22 | Observational studies |
| L4 | 54 | Preclinical / mechanistic studies |
| L5 | 602 | Computational prediction only |
| N/A | 243 | Known uses only (no new prediction) |
By Source
| Source | Predictions |
|---|
| DL | 10,454,986 |
| KG | 14,364 |
| KG + DL | 3,705 |
By Confidence
| Confidence | Predictions |
|---|
| very_high | 1,515 |
| high | 479,332 |
| medium | 918,852 |
| low | 9,073,356 |
Prediction Methods
| Method | Speed | Accuracy | Requirements |
|---|
| Knowledge Graph | Fast (seconds) | Lower | No special requirements |
| Deep Learning | Slow (hours) | Higher | Conda + PyTorch + DGL |
Knowledge Graph Method
uv run python scripts/run_kg_prediction.py
| Metric | Value |
|---|
| HSA Total Drugs | 7,117 |
| Mapped to DrugBank | 6,038 (84.8%) |
| Repurposing Candidates | 18,069 |
Deep Learning Method
conda activate txgnn
PYTHONPATH=src python -m sgtxgnn.predict.txgnn_model
| Metric | Value |
|---|
| Total DL Predictions | 2,056,697 |
| Unique Drugs | 1,041 |
| Unique Indications | 17,184 |
Score Interpretation
The TxGNN score represents the model's confidence in a drug-disease pair, ranging from 0 to 1.
| Threshold | Meaning |
|---|
| >= 0.9 | Very high confidence |
| >= 0.7 | High confidence |
| >= 0.5 | Moderate confidence |
Score Distribution
| Threshold | Meaning |
|---|
| ≥ 0.9999 | Extremely high confidence, model's most confident predictions |
| ≥ 0.99 | Very high confidence, worth prioritizing for validation |
| ≥ 0.9 | High confidence |
| ≥ 0.5 | Moderate confidence (sigmoid decision boundary) |
Evidence Level Definitions
| Level | Definition | Clinical Significance |
|---|
| L1 | Phase 3 RCT or systematic review | Can support clinical use |
| L2 | Phase 2 RCT | Can consider for use |
| L3 | Phase 1 or observational study | Requires further evaluation |
| L4 | Case report or preclinical research | Not recommended yet |
| L5 | Computational prediction only, no clinical evidence | Requires further research |
Important Reminders
- High scores do not guarantee clinical efficacy: TxGNN scores are knowledge graph-based predictions that require clinical trial validation.
- Low scores do not mean ineffective: The model may not have learned certain associations.
- Recommended to use with validation pipeline: Use this project's tools to review clinical trials, literature, and other evidence.
Validation Pipeline
flowchart TD
A["TxGNN Prediction Results"] --> B
subgraph B["Step 1: DrugBundle Collector"]
B1["Drug-level: HSA, DDI, DrugBank"]
B2["Indication-level: ClinicalTrials, PubMed, ICTRP"]
end
B --> |"drug_bundle.json"| C
subgraph C["Step 2: Evidence Pack Generator"]
C1["Programmatic data transfer (100%)"]
C2["+ LLM Analysis (L1-L5)"]
end
C --> |"drug_evidence_pack.json/md"| D
subgraph D["Step 3: Notes Writer"]
D1["drug_pharmacist_notes.md"]
D2["drug_sponsor_notes.md"]
end
Quick Start
Step 1: Download Data
Step 2: Install Dependencies
uv sync
Step 3: Process Drug Data
uv run python scripts/process_fda_data.py
Step 4: Prepare Vocabulary Data
uv run python scripts/prepare_external_data.py
Step 5: Run Knowledge Graph Prediction
uv run python scripts/run_kg_prediction.py
Step 6: Set Up Deep Learning Environment
conda create -n txgnn python=3.11 -y
conda activate txgnn
pip install torch==2.2.2 torchvision==0.17.2
pip install dgl==1.1.3
pip install git+https://github.com/mims-harvard/TxGNN.git
pip install pandas tqdm pyyaml pydantic ogb
Step 7: Run Deep Learning Prediction
conda activate txgnn
PYTHONPATH=src python -m sgtxgnn.predict.txgnn_model
Resources
TxGNN Core
Data Sources
| Category | Data | Source | Note |
|---|
| Drug Data | HSA | data.gov.sg | Singapore |
| Knowledge Graph | TxGNN KG | Harvard Dataverse | 17,080 diseases, 7,957 drugs |
| Drug Database | DrugBank | DrugBank | Drug ingredient mapping |
| Drug Interactions | DDInter | DDInter | DDI pairs |
| Drug Interactions | Guide to PHARMACOLOGY | IUPHAR/BPS | Approved-drug target data (not interactions) |
| Clinical Trials | ClinicalTrials.gov | CT.gov API v2 | Clinical trials registry |
| Clinical Trials | WHO ICTRP | ICTRP API | International clinical trials platform |
| Literature | PubMed | NCBI E-utilities | Medical literature search |
| Name Mapping | RxNorm | RxNav API | Drug name standardization bridge |
|
Model Downloads
Project Introduction
Directory Structure
SgTxGNN/
├── README.md
├── CLAUDE.md
├── pyproject.toml
│
├── config/
│ └── fields.yaml
│
├── data/
│ ├── kg.csv
│ ├── node.csv
│ ├── edges.csv
│ ├── raw/
│ ├── external/
│ ├── processed/
│ │ ├── drug_mapping.csv
│ │ ├── repurposing_candidates.csv
│ │ ├── txgnn_dl_predictions.csv.gz
│ │ └── integration_stats.json
│ ├── bundles/
│ └── collected/
│
├── src/sgtxgnn/
│ ├── data/
│ │ └── loader.py
│ ├── mapping/
│ │ ├── normalizer.py
│ │ ├── drugbank_mapper.py
│ │ └── disease_mapper.py
│ ├── predict/
│ │ ├── repurposing.py
│ │ └── txgnn_model.py
│ ├── collectors/
│ └── paths.py
│
├── scripts/
│ ├── process_fda_data.py
│ ├── prepare_external_data.py
│ ├── run_kg_prediction.py
│ └── integrate_predictions.py
│
├── docs/
│ ├── _drugs/
│ ├── fhir/
│ │ ├── MedicationKnowledge/
│ │ └── ClinicalUseDefinition/
│ └── smart/
│
├── model_ckpt/
└── tests/
Legend: 🔵 Project development | 🟢 Local data | 🟡 TxGNN data | 🟠 Validation pipeline
Data Flow
flowchart TD
FDA["HSA Data"] --> proc["process_fda_data.py"]
TxGNN["TxGNN Data"] --> prep["prepare_external_data.py"]
proc --> json["sg_fda_drugs.json"]
prep --> ext["data/external/"]
json --> norm["normalizer.py"]
ext --> norm
norm --> drug_map["drug_mapping.csv"]
drug_map --> ind_map["indication_mapping.csv"]
ind_map --> KG["Knowledge Graph"]
ind_map --> DL["Deep Learning"]
KG --> kg_out["repurposing_candidates.csv"]
DL --> dl_out["txgnn_dl_predictions.csv"]
Citation
If you use this dataset or software, please cite:
@software{sgtxgnn2026,
author = {Yao.Care},
title = {SgTxGNN: Drug Repurposing Validation Reports for Singapore HSA Drugs},
year = 2026,
publisher = {GitHub},
url = {https://github.com/yao-care/SgTxGNN}
}
Also cite the original TxGNN paper:
@article{huang2023txgnn,
title={A foundation model for clinician-centered drug repurposing},
author={Huang, Kexin and Chandak, Payal and Wang, Qianwen and Haber, Shreyas and Zitnik, Marinka},
journal={Nature Medicine},
year={2024},
doi={10.1038/s41591-024-03233-x}
}
維運:資料還原與許可證更新
完整還原
git 只放程式碼與網站頁面;許可證原始資料、證據包、藥師報告原稿、預測結果放在本 repo 的 Release。
git clone https://github.com/yao-care/sgtxgnn.git && cd sgtxgnn
uv sync # Python 相依套件
bash scripts/restore_data.sh # 取最新的 data-* Release,還原 data/(含校驗)
bash scripts/restore_data.sh --with-kg # 另加共用知識圖譜與預測模型(只有重跑預測才需要)
需要 GitHub CLI(gh auth login)與 uv。
改頁工具鏈
事實層、checker、許可證狀態計算等放在 tools/txgnn/.claude/,是母 repo yao-care/txgnn 的 .claude/ 複本(版本見 tools/txgnn/VERSION)。
規則要改請改母 repo,再用 python3 .claude/sync_site_tools.py SgTxGNN 同步過來,不要直接改這裡的複本。
在本 repo 單獨使用時,先組工作目錄:
WS=$(bash scripts/txgnn_ws.sh)
cd "$WS"
python3 .claude/dump_license_facts_20261021.py SgTxGNN # 依證據包算市場狀態(checker 要用)
python3 .claude/checker_trend.py --no-append SgTxGNN # 全部藥物頁 checker,必須「非 0 0」
許可證排程更新(GitHub Actions)
.github/workflows/license-refresh.yml 每週一 UTC 03:17 自動執行,也可以在 Actions 頁手動觸發(可選只試跑):
- 從 Release 還原
data/(scripts/restore_data.sh)
- 從主管機關下載最新許可證資料(
scripts/license_adapter.py),檢查筆數與格式
- 更新證據包的許可證狀態 → 重算市場狀態 → 同步許可證表 → 事實層改頁 → checker 全量必須 0 → 衍生檔 → gate
- 全部通過才推上
main 並觸發部署;更新後的 data/ 另存成新的 data-YYYYMMDD Release
以下情況一律不推、自動開 issue(label license-refresh):下載失敗或格式改變、狀態變動超過兩成、
改到的藥物頁超過 min(200, 5%)、checker/gate/h1 沒過、有人工查核紀錄的頁會被改到。全程不使用 AI。