conda create -n STP python=3.7
conda activate STP
pip install -r requirements.txt
The required files include the h5ad file of spatial transcriptomics data and its corresponding pre-aligned nuclei-stained image.
The partition of single cell through spatial transcriptomics data is mainly done by the function called STP which includes following parameters:
adata: h5ad file spatial transcriptomicsimg: Pre-aligned nulcei-stained image with spatial transcriptomicssave_path: The path to save the resultsT: Initial temperature (the number of selected bins to extend the nuclei)T_min: Minimum temperature for ending the algorithmreduction_rate: Rate of reduction for T ( 0 < k < 1)neighbor_num: Number of neighbors for KNNalpha: Weight for distance energybeta: Weight for transcriptional similarity energygamma:Weight for size energythres: The threshold of nuclei segmentation
The output files include:
- Nuclei-segmentation image
- Single-cell partition image
- Connected component of partitioned cells
- The expression profiles of partitioned cells (index of cells is related to the label of the connected component of cell)
We supplied a demo for single-cell partition for the drosophila embryo.
Finally, it would create a folder called example_result to save the output results introduced above.