stDCL 1.0.1
Spatial Transcriptome Heterogeneity Dissection of Brain Regions with Dual Graph Contrastive Learning
License: MIT

# stDCL
Recent advances in spatial transcriptomics have enabled simultaneous preservation of high-throughput gene expression profiles and spatial context, enabling the high-resolution exploration of distinct regional characterization in brain tissue. However, the intricate spatial structure of brain poses challenges in capturing spatial heterogeneity effectively and deciphering internal regulatory mechanisms accurately. Here, we develop stDCL, a dual graph contrastive learning method to identify spatial domains from spatial transcriptomics data. stDCL adaptively incorporates gene expression data and spatial information via a graph embedding autoencoder, thereby preserving critical information within latent embedding representations. Then, we propose dual graph contrastive learning to train the model, ensuring that the latent embedding representation closely resembles the actual spatial distribution and exhibits cluster similarity. Benchmarking stDCL against other state-of-the-art clustering methods using cerebral cortex datasets demonstrates its superior accuracy and effectiveness in identifying spatial domains. Our analysis of the imputation matrices generated by stDCL reveals its capability to reconstruct spatial hierarchical structures and refine differential expression assessments. Furthermore, we illustrate the central role of stDCL in elucidating gene regulation, spatial heterogeneity, and developmental patterns in the brain. Additionally, stDCL can also be instrumental in annotating disease-associated cellular phenotypes in Alzheimer's disease, unraveling the regulatory mechanisms.





# System Requirements
## Hardware requirements
`stDCL` package requires only a standard computer with enough RAM to support the in-memory operations.

## Software requirements
### OS Requirements
This package is supported for *Linux*. The package has been tested on the following systems:
+ Linux: Ubuntu 18.04

### Python Dependencies
`stDCL` mainly depends on the Python scientific stack.
```
numpy
scipy
torch
scikit-learn
pandas
scanpy
```
For specific setting, please see <a href="https://github.com/Philyzh8/stDCL/blob/master/requirements.txt">requirements</a> or <a href="https://github.com/Philyzh8/stDCL/blob/master/environment.yaml">environment</a>.

# Installation Guide:

### Install from PyPi

```
$ conda create -n stDCL_env python=3.8.15
$ conda activate stDCL_env
$ pip install -r requirements.txt
$ pip install stDCL
```

### Install from Conda

```
$ conda env create -f environment.yaml
```

# Usage
`stDCL` is a dual graph contrastive learning method for identifing spatial domains, which can be used to:
+ DLPFC. The example can be seen in the <a href="https://github.com/Philyzh8/stDCL/blob/master/tutorial/run_dlpfc.py">run_dlpfc.py</a>.
+ MERFISH. The example can be seen in the <a href="https://github.com/Philyzh8/stDCL/blob/master/tutorial/run_merfish.py">run_merfish.py</a> and <a href="https://github.com/Philyzh8/stDCL/blob/master/tutorial/run_merfish_brain.py">run_merfish_brain.py</a>.
+ osmFISH. The example can be seen in the <a href="https://github.com/Philyzh8/stDCL/blob/master/tutorial/run_osm.py">run_osm.py</a>.
+ STARmap. The example can be seen in the <a href="https://github.com/Philyzh8/stDCL/blob/master/tutorial/run_starmap.py">run_starmap.py</a> and <a href="https://github.com/Philyzh8/stDCL/blob/master/tutorial/run_starmap_plus.py">run_starmap_plus.py</a>.

We also provide <a href="https://github.com/Philyzh8/stDCL/tree/master/step-by-step">step-by-step</a> tutorials to analyze spatial transcriptomic datasets.



# Data Availability

The real data sets we used can be download in <a href="https://zenodo.org/records/10968451">data</a>.

# License

This project is covered under the <a href="https://github.com/Philyzh8/stDCL/blob/master/LICENSE">**MIT License**</a>.