# graphST Algorithm

### Usage

```bash
SDAS spatialDomain graphst –i st.h5ad –o outdir  --n_clusters 10 --bin_size 100 \
--gpu_id 1 --n_hvg 3000
```

### Input Parameter Description

| Parameter         | Required | Default | Description                                                                                                                 |
| ----------------- | -------- | ------- | --------------------------------------------------------------------------------------------------------------------------- |
| **-i / --input**  | **Yes**  |         | Stereo-seq h5ad, must contain the raw expression matrix                                                                     |
| **-o / --output** | **Yes**  |         | Output folder                                                                                                               |
| **--n\_clusters** | **Yes**  |         | Number of clusters                                                                                                          |
| **--bin\_size**   | **Yes**  |         | Bin size, controls the size of points in the graph, not used for calculation, e.g., 20, 50, 100, cellbin (equivalent to 20) |
| --tool            | No       | mclust  | Clustering method used by GraphST, options: 'mclust', 'leiden', 'louvain'                                                   |
| --layer           | No       |         | Layer in Stereo-seq h5ad where raw counts are stored                                                                        |
| --n\_hvg          | No       | 3000    | Number of highly variable genes                                                                                             |
| --slice\_key      | No       |         | Name of the column in h5ad.obs indicating slice number for multi-slice data; must be specified for multi-slice analysis\*   |
| --gpu\_id         | No       | -1      | GPU ID to use; if -1, use CPU                                                                                               |
| --seed            | No       | 42      | Random seed                                                                                                                 |

\*Multi-slice analysis is possible under the following conditions:

1. Adjacent slices: For vertical tissue sections, spatial domain analysis requires slice registration. Set the slice\_key parameter to the key in h5ad.obs that records multiple slices.
2. For a single tissue section divided horizontally into several consecutive slices and sequenced separately, horizontal registration is required for multi-slice analysis.

For details, refer to:

1. <https://deepst-tutorials.readthedocs.io/en/latest/Tutorial%204\\_Horizontal%20Integration.html> (Adjacent)
2. <https://deepst-tutorials.readthedocs.io/en/latest/Tutorial%205\\_Vertical%20Integration.html> (Horizontal)

### Output Results

| Result File                                 | Description                                                                          |
| ------------------------------------------- | ------------------------------------------------------------------------------------ |
| `<input_name>_domain_graphst.h5ad`          | Input h5ad + spatial domain clustering results, stored in obs\['domain\_graphst']    |
| `<input_name>_domain_graphst.png/pdf`       | Distribution plot of spatial domain clusters on the tissue, outputs both png and pdf |
| `<input_name>_domain_graphst_split.png/pdf` | Plots showing each spatial domain cluster separately, outputs both png and pdf       |

* **Distribution plot of spatial domain clusters on the tissue**: `<input_name>_domain_graphst.png/pdf` the color represents the spatial domain type of each bin/cellbin

<figure><img src="https://3345087311-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FCggbEDCoTSjskIWVTMeM%2Fuploads%2Fgit-blob-a1a5f8bc345d6b34b2a1647fe757b98c41f659b1%2Finput_domain_graphst.png?alt=media" alt=""><figcaption></figcaption></figure>

* **Separated distribution plots of spatial domain clusters on the tissue**: `<input_name>_domain_graphst_split.png/pdf` the color represents the spatial domain type of each bin/cellbin, and the title indicates the spatial domain type (number of cells).
