Skip to content

CTPLab/SST-editing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SST-editing

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}
}

Demo

CosMx

$\triangledown$ Edit HLA and B2M (Normal -> Tumor)

fov_demo.mp4

$\triangledown$ Edit all genes (Normal -> Tumor)

fov_demo.mp4

$\triangledown$ Edit HLA and B2M (Tumor -> Normal)

fov_demo.mp4

$\triangledown$ Edit all genes (Tumor -> Normal)

fov_demo.mp4

Xenium

$\triangledown$ Edit MUC1, KRT7, RBM3, and EPCAM (Normal -> Tumor)

fov_demo.mp4

$\triangledown$ Edit all genes (Normal -> Tumor)

fov_demo.mp4

$\triangledown$ Edit MUC1, KRT7, RBM3, and EPCAM (Tumor -> Normal)

fov_demo.mp4

$\triangledown$ Edit all genes (Tumor -> Normal)

fov_demo.mp4

Prerequisites

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.

Preparation

First, we need the processed ST datasets:

  1. CosMx: Unzip the downloaded CosMx_crop to Data/ folder (create it if not exists)

  2. Xenium: Unzip the downloaded Xenium_crop to Data/ folder

To reproduce the analysis results, we need some pre-computed weights and stats

  1. SCLIP pre-trained weights: Unzip the downloaded SCLIP.zip to the SCLIP/ folder

  2. Stats: Unzip the downloaded stats.zip folder to this repo

  3. CosMx:

    1. Unzip the downloaded CosMx_GAN.zip weights to Data/CosMx/GAN folder

    2. Unzip the downloaded CosMx_GANI.zip weights to Data/CosMx/GANI folder

  4. Xenium:

    1. Unzip the downloaded Xenium_GAN.zip weights to Data/Xenium/GAN folder

    2. Unzip the downloaded Xenium_GANI.zip weights to Data/Xenium/GANI folder

To reproduce the video demo results, we need the raw image data

  1. CosMx:

    1. Download F097.jpg image to Data/CosMx/Liver1/CellComposite/ folder

    2. Download F055.jpg image to Data/CosMx/Liver2/CellComposite/ folder

  2. Xenium:

    1. Download 1.fig image to Data/Xenium/Lung1/dapi folder

    2. Download 2.fig image to Data/Xenium/Lung2/dapi folder

Train the customized StyleGAN2 model

Once the processed datasets are ready, we show the example script of training the model with two GPUs.

CosMx

sh train_s2_cosmx.sh

Xenium

sh train_s2_xenium.sh

Train the customized StyleGAN2 Inversion model

To train the GAN Inversion model, first download moco to style3/pretrained_models folder

CosMx

sh train_s2i_cosmx.sh

Xenium

sh train_s2i_xenium.sh

Run the analysis reported in the paper

CosMx

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

Xenium

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

Acknowledgment

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.

License

The copyright license of this repository is specified with the LICENSE-SST-editing.

About

[Accepted by Bioinformatics] Spatial transcriptomic editing, GAN, gene expression, bioimage, single-cell

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors