Graph Variational Autoencoder for Tumor Microenvironment Analysis. Learns spatial and molecular cell representations via a dual-graph GAT encoder with cell-adaptive gating, ZINB expression decoder, and attention-based patient pooling for treatment response prediction.
pip install -r requirements.txt
python train.py --config local
python train.py --config full Outputs saved to outputs/.
src/config.py- LOCAL and FULL configs, device detection (cuda/mps/cpu)src/model.py- GVAEModel with cell-adaptive gate, dual decoder, response predictorsrc/trainer.py- Two-phase training with reconstruction safeguardssrc/analysis.py- Rare cell detection, clustering, predictionsrc/data_utils.py- Graph construction from AnnDatatrain.py- End-to-end pipeline
- Cell-adaptive hybrid graph fusion (learned gate blends molecular and spatial graphs per-cell)
- ZINB expression decoder + adjacency decoder
- KL-based rare cell detection
- Attention-based patient pooling for treatment response
- Two-phase training prevents latent collapse
- Patient-level train/val/test splits (no data leak in Phase 2)
- Contrastive loss with adaptive negative mining
- Python 3.9+
- PyTorch 2.0+
- PyTorch Geometric 2.3+
- scanpy, anndata, leidenalg
- See
requirements.txtfor full list