Skip to content

24kwxc/111

Repository files navigation

SpaDAC: SPAtially embedded Deep Attentional graph Clustering

Overview

We proposed an unsupervised multi-model SPAtially embedded Deep Attentional graph Clustering (SpaDAC) method, which uses the deep learning framework to learn low-dimensional embeddings for spatial transcriptomics data. SpaDAC can efficiently identify spatial domains while reconstructing denoised gene expression profiles. We applied it to sixteen datasets covering three situations. Benchmark results demonstrated that SpaDAC outperforms other algorithms in most cases. We expected SpaDAC to offer a valuable computational tool for researchers to understand tissue organization and function.

Image

Tutorial

Start by grabbing this source codes:

git clone https://github.com/huoyuying/SpaDAC.git
cd SpaDAC

1. Folder hierarchy

We take 10X sample 151673 as an running example. After grabbing the source codes, you can see the folder hierarchy as follows:

.
├── datasets
│   └── 151673
│       └── notpca
├── denoising
│   └── 151673_cor
├── image_feature_learning_tool
│   ├── cut_image
│   │   └── 151673
│   │       ├── cor
│   │       ├── img_151673_224
│   │       └── img_151673_299
│   ├── inception_resnet_v2
│   │   ├── _
│   │   └── variables
│   ├── inception_v3
│   │   └── variables
│   └── resnet50
│       ├── _
│       └── variables
├── pretrain
│   └── 151673
├── result
│   └── 151673
├── pretrain_dual.py    # dual-mode pretraining code
├── pretrain_triple.py  # triple-mode pretraining code
├── daegc_dual.py       # dual-mode training code
├── daegc_triple.py     # triple-mode training code
├── model.py
├── model_plus.py
├── utils.py
└── evaluation.py

2. Virtual environment

(Recommended) Using python virtual environment with conda

# Configuring the virtual environment
conda create -n SpaDAC_env python=3.8
conda activate SpaDAC_env
pip install -r SpaDAC_requirement.txt

3. Usage

3-1 Image cutting (optional)

cd SpaDAC/image_feature_learning_tool
pip install -r muse_requirement.txt
cd cut_image
python deal_cut.py --name 151673 --size 224 (or 299)
--name: Name of sample
--size: Image resolution

3-2 Extraction of morphological features (optional)

cd SpaDAC/image_feature_learning_tool
python deal_inception.py --name 151673 --model inception_v3 (or inception_resnet_v2 or resnet50)
--name: Name of sample
--model: The Convolutional Neural Network used

3-3 Calculation of morphological similarity network and adjacency matrix (optional)

cd SpaDAC/image_feature_learning_tool
python deal_network.py --name 151673 --model inception_v3 (or inception_resnet_v2 or resnet50) --distance euc (or cos or pea) --neighbor 6 (or 4)
--name: Name of sample
--model: The Convolutional Neural Network used
--distance: The distance used to measure the similarity between cells
--neighbor: The number of neighbors per cell

3-4 pretraining

cd SpaDAC
python pretrain_plus.py --name 151673 --exp 3000 --adj adj1 --img adj6 --max_epoch 50
--name: Name of sample
--exp: The number of highly variable features(HVGs) selected
--adj: The 01-Matrix of whether cells are neighbors or not, based on geographical similarity
--img: The 01-Matrix of whether cells are neighbors or not, based on morphological similarity
--max_epoch: The number of iterations of this training

3-5 fine-tunning

cd SpaDAC
python daegc_plus.py --name 151673 --exp 3000 --adj adj1 --img adj6 --epoch 49 --max_epoch 100
--name: Name of sample
--exp: The number of highly variable features(HVGs) selected
--adj: The 01-Matrix of whether cells are neighbors or not, based on geographical similarity
--img: The 01-Matrix of whether cells are neighbors or not, based on morphological similarity
--epoch: The number of iterations of last training
--max_epoch: The number of iterations of this training

3-6 Clustering and optimization

cd SpaDAC
python clustering.py

3-7 Denoising of gene expression profile

cd SpaDAC/denoising
python denoising.py

4. Download data

Platform Tissue SampleID
10x Visium Human dorsolateral pre-frontal cortex (DLPFC) 151507, 151508, 151509, 151510, 151669, 151670, 151671, 151672, 151673, 151674, 151675, 151676
10x Visium Mouse brain section Sagittal-Anterior, Sagittal-Posterior
10x Visium Human breast cancer Ductal Carcinoma In Situ & Invasive Carcinoma
Stereo-Seq Mouse olfactory bulb Olfactory bulb
ST Pancreatic ductal adenocarcinoma tissue PDAC1, PDAC2

Spatial transcriptomics data of other platforms can be downloaded https://www.spatialomics.org/SpatialDB/

5. Contact

Feel free to submit an issue or contact us at [email protected] for problems about the packages.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages