This is the official codebase for Dual-Path Knowledge-Augmented Contrastive Alignment Network for Spatially Resolved Transcriptomics. Thank you for your attention.
Python
5
5 commits
updated Mar 22, 2026
Thank you for your attention. This is the official codebase for DKAN.
python=3.11.11
pytorch-lightning==2.4.0
torch==2.4.1+cu121
torchvision==0.19.1+cu121
More details of our environments are provided in dkan.yaml.
All data used in this study is available at Huggingface. Please feel free to reach me if you have any trouble in downloading the data. After downloading all data, you will obtain below data directory:
./data/
├── her2st
│ ├── gt_features_224
│ ├── n_features_5_224
│ ├── ST-cnts
│ ├── ST-imgs
│ ├── ST-spotfiles
│ ├── ST-text
└── her2st_ncbi_biobert.pt
│ └── ...
├── skin
│ └── ...
└── stnet
└── ...
If you wish to use other foundation model alternatives, such as Conch, take HER2+ dataset as an example, the command for feature extraction can be found below:
python extract_features.py --config her2st/her2st --test_mode internal --extract_mode target --encoder conch
python extract_features.py --config her2st/her2st --test_mode internal --extract_mode neighbor --encoder conch
Our gene feature extraction have multiple steps:
To provide more gene representation alternatives and ensure reproducibility, more details about using other free accessed LLMs can be found at gene_embedding_notes. All codes, gene summaries and gene features are also released in this repository.
Before starting training, please make sure the directories in ./config/*/*.yaml are updated accordingly to your work environments.
# Training
python main.py --config_name skin/skin --mode cv --gpu 0
python main.py --config_name her2st/her2st --mode cv --gpu 0
python main.py --config_name stnet/stnet --mode cv --gpu 0
# Evaluation
python test.py --dataset skin --model_name your_name --gpu 0
Please see ./evaluation/metric.ipynb to reproduce the results reported in our paper.
Release our ST data on Hugging Face
Release our gene summary and embeddings
Release our prompts we used in this study
Release raw data from NCBI database
Release code for training and evaluation
Release code for reproducing our results
Release code for image features with foundation models
Release code for gene summary from external gene databases
Release code for gene summary refinement via LLMs
Release code for gene feature extraction with text encoders
Release paper on Arxiv
Our study builds upon previous studies: TRIPLEX, HisToGene. Many thanks for their opensource and the contributions to this community.
Please kindly cite our paper if our work could be helpful for your study. Thank you.
@inproceedings{zhang2025dkan,
title={Dual-Path Knowledge-Augmented Contrastive Alignment Network for Spatially Resolved Transcriptomics},
author={Zhang, Wei and Chu, Jiajun and Liu, Xinci and Tong, Chen and Li, Xinyue},
booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
volume={40},
number={15},
pages={12807--12815},
year={2026}
}
This is the official codebase for Dual-Path Knowledge-Augmented Contrastive Alignment Network for Spatially Resolved Transcriptomics. Thank you for your attention.
Python
5
5 commits
updated Mar 22, 2026
Thank you for your attention. This is the official codebase for DKAN.
python=3.11.11
pytorch-lightning==2.4.0
torch==2.4.1+cu121
torchvision==0.19.1+cu121
More details of our environments are provided in dkan.yaml.
All data used in this study is available at Huggingface. Please feel free to reach me if you have any trouble in downloading the data. After downloading all data, you will obtain below data directory:
./data/
├── her2st
│ ├── gt_features_224
│ ├── n_features_5_224
│ ├── ST-cnts
│ ├── ST-imgs
│ ├── ST-spotfiles
│ ├── ST-text
└── her2st_ncbi_biobert.pt
│ └── ...
├── skin
│ └── ...
└── stnet
└── ...
If you wish to use other foundation model alternatives, such as Conch, take HER2+ dataset as an example, the command for feature extraction can be found below:
python extract_features.py --config her2st/her2st --test_mode internal --extract_mode target --encoder conch
python extract_features.py --config her2st/her2st --test_mode internal --extract_mode neighbor --encoder conch
Our gene feature extraction have multiple steps:
To provide more gene representation alternatives and ensure reproducibility, more details about using other free accessed LLMs can be found at gene_embedding_notes. All codes, gene summaries and gene features are also released in this repository.
Before starting training, please make sure the directories in ./config/*/*.yaml are updated accordingly to your work environments.
# Training
python main.py --config_name skin/skin --mode cv --gpu 0
python main.py --config_name her2st/her2st --mode cv --gpu 0
python main.py --config_name stnet/stnet --mode cv --gpu 0
# Evaluation
python test.py --dataset skin --model_name your_name --gpu 0
Please see ./evaluation/metric.ipynb to reproduce the results reported in our paper.
Release our ST data on Hugging Face
Release our gene summary and embeddings
Release our prompts we used in this study
Release raw data from NCBI database
Release code for training and evaluation
Release code for reproducing our results
Release code for image features with foundation models
Release code for gene summary from external gene databases
Release code for gene summary refinement via LLMs
Release code for gene feature extraction with text encoders
Release paper on Arxiv
Our study builds upon previous studies: TRIPLEX, HisToGene. Many thanks for their opensource and the contributions to this community.
Please kindly cite our paper if our work could be helpful for your study. Thank you.
@inproceedings{zhang2025dkan,
title={Dual-Path Knowledge-Augmented Contrastive Alignment Network for Spatially Resolved Transcriptomics},
author={Zhang, Wei and Chu, Jiajun and Liu, Xinci and Tong, Chen and Li, Xinyue},
booktitle={Proceedings of the AAAI Conference on Artificial Intelligence},
volume={40},
number={15},
pages={12807--12815},
year={2026}
}