Skip to content
/ EGN Public

Exemplar Guided Deep Neural Network for Spatial Transcriptomics Analysis of Gene Expression Prediction

Notifications You must be signed in to change notification settings

Yan98/EGN

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dependency

  • python 3.9.4
  • pytorch_lightning 1.5.7
  • numpy 1.23.3
  • Pandas 1.5.2
  • tifffile 2021.7.2
  • Pillow 9.3.0
  • scanpy 1.9.1
  • torch 1.9.1+cu111
  • torchvision 0.10.1+cu111
  • einops 0.3.2

Dataset

  • Obtain 10xgenomics dataset.

  • We use the slide images blow, and please structure the data files as follows.

└───10xgenomics
    └───1.0.0
    │   │ V1_Breast_Cancer_Block_A_Section_1
    |   | V1_Breast_Cancer_Block_A_Section_2
    │  
    │
    └───1.1.0
    |   │ V1_Breast_Cancer_Block_A_Section_1
    |   | V1_Breast_Cancer_Block_A_Section_2
    |   
    |
    └───1.2.0
    |   │ Parent_Visium_Human_BreastCancer
    |   | Targeted_Visium_Human_BreastCancer_Immunology

Train EGN

  • Change system directory
cd v1
  • Build index for exemplar retrival
for fold in {0..2}
do
python3 build_exemplar.py --index_dir index --save_dir exemplar --TORCH_HOME PLEASE Fill --data PLEASE Fill --fold $fold #Set torch home and data path properly, e.g., 10xgenomics 

done
  • Gene expression prediction
for fold in {0..2}
do
	python3 main.py --num_nodes 1 --gpus 1 --epoch 50 --batch 32 --workers 6 --size 256 --data PLEAE FILL --fold $fold \
		--lr 5e-4 --weight_decay 1e-4 --dim 1024 --heads 16 --mlp_dim 4096 --depth 8 --bhead 8 --bdim 64  \
		--bfre 2 --player 2 --linear_projection True --index_path exemplar/index \
		        --emb_path exemplar --mdim 2048 --numk 6   #Set data path properly 
done  

Dependency

  • python 3.9.4
  • pytorch_lightning 1.5.7
  • numpy 1.23.3
  • Pandas 1.5.2
  • tifffile 2021.7.2
  • Pillow 9.3.0
  • scanpy 1.9.1
  • torch 1.9.1+cu111
  • torchvision 0.10.1+cu111
  • torch-geometric 2.1.0.post1

Train EGGN

  • Change system directory
cd v2
  • Build index for exemplar retrival
for fold in {0..2}
do
python3 build_exemplar.py --index_dir index --save_dir exemplar --TORCH_HOME PLEASE Fill --data PLEASE Fill --fold $fold #Set torch home and data path properly 

done
  • Build graphs
python3 generate_graph.py --savename 10xpro --size 256 --numk 6 --mdim 512 --index_path index --emb_path exemplar --data PLEASE Fill #Set data path properly 
  • Gene expression prediction
for fold in {0..2}
do
python3 main.py  --gpus 1 --epoch 300 --fold $fold  --lr 5e-4 --weight_decay 1e-4 --mdim 512 --numk 6  --graph_path 10xpro --num_layers 4

done

Code for Related Work

Notice

  • This is a minimal exemple to train EGN and EGGN on the 10xgenomics dataset. If you want to use StyleGAN-based exemplar retrival, please refer to S2FGAN.
  • There are some typos on the paper. We have updated the pdf. Please find it here.
  • Please find the EGGN here.
  • We have refactored the code, and potential error may exist. If you have question related to our work, please drop me an email.

Citation

If you find EGN useful in your research work, please consider citing:

@inproceedings{egn2023,
  author    = {Yan Yang and
               Md. Zakir Hossain and
               Eric A. Stone and
               Shafin Rahman},
  title     = {Exemplar Guided Deep Neural Network for Spatial Transcriptomics Analysis
               of Gene Expression Prediction},
  booktitle = {{IEEE/CVF} Winter Conference on Applications of Computer Vision, {WACV}
               2023, Waikoloa, HI, USA, January 2-7, 2023},
  pages     = {5028--5037},
  publisher = {{IEEE}},
  year      = {2023},
  url       = {https://doi.org/10.1109/WACV56688.2023.00501},
  doi       = {10.1109/WACV56688.2023.00501},
}

@article{eggn2023,
title = {Spatial transcriptomics analysis of gene expression prediction using exemplar guided graph neural network},
journal = {Pattern Recognition},
volume = {145},
pages = {109966},
year = {2024},
issn = {0031-3203},
doi = {https://doi.org/10.1016/j.patcog.2023.109966},
url = {https://www.sciencedirect.com/science/article/pii/S0031320323006647},
author = {Yan Yang and Md Zakir Hossain and Eric Stone and Shafin Rahman},
keywords = {Spatial transcriptomics, Gene expression prediction, Deep learning, Graph convolution, Tissue slide image},
}

About

Exemplar Guided Deep Neural Network for Spatial Transcriptomics Analysis of Gene Expression Prediction

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages