Official PyTorch implementation for the manuscript accepted by Bioinformatics:
SST-editing: In silico spatial transcriptomic editing at single-cell resolution
Jiqing Wu and Viktor H. Koelzer.
Accepted paper: https://doi.org/10.1093/bioinformatics/btae077
If you find this repository helpful for your research, we would appreciate your citation of this paper.
@article{10.1093/bioinformatics/btae077,
author = {Wu, Jiqing and Koelzer, Viktor H},
title = "{SST-editing: in silico spatial transcriptomic editing at single-cell resolution}",
journal = {Bioinformatics},
volume = {40},
number = {3},
pages = {btae077},
year = {2024},
month = {02},
issn = {1367-4811},
doi = {10.1093/bioinformatics/btae077},
url = {https://doi.org/10.1093/bioinformatics/btae077},
eprint = {https://academic.oup.com/bioinformatics/article-pdf/40/3/btae077/56850944/btae077.pdf},
}
Please see also our follow-up work IST-editing (MIDL, oral) for more references.
@inproceedings{wu2024ist,
title={IST-editing: Infinite spatial transcriptomic editing in a generated gigapixel mouse pup},
author={Wu, Jiqing and Berg, Ingrid and Koelzer, Viktor H},
booktitle={International Conference on Medical Imaging with Deep Learning},
year={2024},
organization={PMLR}
}
fov_demo.mp4
fov_demo.mp4
fov_demo.mp4
fov_demo.mp4
fov_demo.mp4
fov_demo.mp4
fov_demo.mp4
fov_demo.mp4
This implementation has been successfully tested under the following configurations:
- Ubuntu 20.04
- Nvidia driver 515.65
- CUDA 11.7
- Python 3.9
- PyTorch 2.0
- Miniconda
Please use also environment.yml to create the conda environment for this repo.
First, we need the processed ST datasets:
-
CosMx: Unzip the downloaded CosMx_crop to Data/ folder (create it if not exists)
-
Xenium: Unzip the downloaded Xenium_crop to Data/ folder
To reproduce the analysis results, we need some pre-computed weights and stats
-
SCLIP pre-trained weights: Unzip the downloaded SCLIP.zip to the SCLIP/ folder
-
Stats: Unzip the downloaded stats.zip folder to this repo
-
CosMx:
-
Unzip the downloaded CosMx_GAN.zip weights to Data/CosMx/GAN folder
-
Unzip the downloaded CosMx_GANI.zip weights to Data/CosMx/GANI folder
-
-
Xenium:
-
Unzip the downloaded Xenium_GAN.zip weights to Data/Xenium/GAN folder
-
Unzip the downloaded Xenium_GANI.zip weights to Data/Xenium/GANI folder
-
To reproduce the video demo results, we need the raw image data
-
CosMx:
-
Xenium:
Once the processed datasets are ready, we show the example script of training the model with two GPUs.
sh train_s2_cosmx.sh
sh train_s2_xenium.sh
To train the GAN Inversion model, first download moco to style3/pretrained_models folder
sh train_s2i_cosmx.sh
sh train_s2i_xenium.sh
Fig. 1 (q.0, q.1)
sh run_cosmx_plot.sh
Fig. 1 (q.2)
sh run_cosmx_metric.sh
Fig. 1 (i.0) (Results may vary due to random seed)
sh run_cosmx_demo.sh
Fig. 1 (i.2, i.3)
sh run_cosmx_fov.sh
Fig. 2 (q.0, q.1)
sh run_xenium_plot.sh
Fig. 2 (q.2)
sh run_xenium_metric.sh
Fig. 2 (i.0) (Results may vary due to random seed)
sh run_xenium_demo.sh
Fig. 2 (i.2, i.3)
sh run_xenium_fov.sh
This repository is built upon Restyle-encoder and StyleGAN3-editing projects. We would like to thank all the authors contributed to those projects. We would also like to thank all the authors contributing to the CosMx and Xenium datasets.
The copyright license of this repository is specified with the LICENSE-SST-editing.