
Spatial transcriptomics (ST) is a valuable methodology that integrates spatial location data with gene expression information, generating novel insights for biological research. Given the substantial number of ST datasets available, researchers are becoming more inclined to unveil potential biological features across larger datasets, thus obtaining a more comprehensive perspective. However, existing methods predominantly concentrate on cross-batch feature learning, disregarding the intricate spatial patterns within individual slices. Consequently, effectively integrating features across different slices while considering the slice-specific patterns poses a substantial challenge. To overcome this limitation and enhance the integration performance of multi-slice data, we propose a deep graph-based auto-encoder model incorporating contrastive learning techniques, named stMSA. This model is specifically tailored to generate batch-corrected representations while preserving the unique spatial patterns within each slice. It achieves this by simultaneously considering both inner-batch and cross-batch patterns during the integration process. We observe that stMSA surpasses existing state-of-the-art methods in discerning domain structures and cross-batch tissue structures across different slices, even when confronted with diverse experimental protocols and sequencing technologies. Furthermore, the representations learned by stMSA exhibit outstanding performance in matching two slices in the development dataset of a mouse embryo and aligning multi-slice mouse brain coronal sections.
scanpy==1.9.3
squidpy==1.3.0
pytorch==1.13.0(cuda==11.6)
torch_geometric==2.3.1(cuda==11.6)
R==3.5.1
mclust==5.4.10
docker run --gpus all --name your_container_name -idt hannshu/stmsa:latest
docker start your_container_name
docker exec -it your_container_name /bin/bash
The anaconda environment for stMSA will be automatically activate in the container. The stMSA source code is located at /root/stMSA, please run git pull to update the codes before you use.
All dependencies of stMSA have been properly installed in this container, including the mclust R package, and the conda environment stMSA will automatically activate when you run the container.
Note: Please make sure NVIDIA Container Toolkit is properly installed on your host device. (Or follow this instruction to setup NVIDIA Container Toolkit first)
Details of the container
/root
|-- stMSA # The stMSA source code
|-- stMSA_paras # The model parameters of stMSA for each experiment
`-- stMSA_results # The embedding result of each experiment
git clone https://github.com/hannshu/stMSA.git
git submodule init
git submodule update
conda env create -f environment.yml
environment.yml file not fit your system or device, please try the Docker container we provided.import scanpy as sc
from train_integrate import train_integration
import st_datasets as stds
# load data
adata_list = [stds.get_data(stds.get_dlpfc_data, id=i)[0] for i in range(4)]
adatas = sc.concat(adata_list, label='batch')
adatas = adatas[:, adata_list[-1].var['highly_variable']]
# train stMSA
adatas = train_integration(adata=adatas, radius=150)
# calculate the clustering result
adata = stds.cl.evaluate_embedding(adatas, len(set(adatas.obs['cluster']))-1)
# other downstream tasks
# ...
Read the Documentation for detailed tutorials.
Content type
Image
Digest
sha256:47ed541a6…
Size
17 GB
Last updated
over 2 years ago
docker pull hannshu/stmsa