| """TxGNN fine-tune for drug repurposing (Phase 2). |
| |
| Following Huang et al. *Nature Medicine* 2024. Zero-shot disease–drug link |
| prediction using a heterogeneous GNN over PrimeKG + our enriched KG. |
| |
| Approach: |
| 1. Initialize node features with our raras-app `fused_embeddings.npz`. |
| 2. Train HGT-style message passing on PrimeKG drug-disease subgraph. |
| 3. Add Brazilian SUS auxiliary head — bias predictions toward drugs in |
| PCDT/CEAF when the patient is in the SUS context. |
| 4. Save inference module exposing `predict(space, embedding, ckpt) -> DrugSpec`. |
| """ |
| from __future__ import annotations |
| import os |
| import logging |
| from typing import Optional |
|
|
| logger = logging.getLogger("gemeo.train.txgnn") |
|
|
| CKPT = os.path.join(os.path.dirname(__file__), "..", "artifacts", "txgnn.pt") |
|
|
|
|
| async def predict(space, embedding, ckpt_path: str): |
| """Inference path used by `gemeo.repurpose.find`.""" |
| if not os.path.exists(ckpt_path): |
| return None |
| try: |
| import torch |
| except ImportError: |
| return None |
|
|
| |
| |
| return None |
|
|
|
|
| def train(epochs: int = 80): |
| """Run as `python -m gemeo.train.txgnn`.""" |
| logger.info("TxGNN scaffold — fill PrimeKG drug-disease loader + link-pred head") |
| |
| |
| |
|
|
|
|
| if __name__ == "__main__": |
| logging.basicConfig(level=logging.INFO) |
| train() |
|
|