STADiffuser CLI documentation

The command-line interface is provided by the stadiffuser.cli module. The main function is main, which is the entry point of the command-line interface. We provide the following command-line templates for single slice, multiple slices, and 3D slices data. Please refer to Usage for more details.

Run STADiffuser CLI for single slice

1 stadiffuser-cli --input_file path-to-your-processed-h5ad-file \
2 --output_dir path-to-your-output-directory \
3 --autoencoder-path path-to-your-autoencoder-model.pth \
4 --new-spatial-division spatial-division-value \
5 --label label-column-name \
6 --device your-cuda-device \
7 --autoencoder-batch-size 128 \
8 --denoiser-batch-size 128 \
9 --input_dim input-dimension-value

Run STADiffuser CLI for multiple slices

 1 stadiffuser-cli python scripts/main.py --input_file \
 2 path-to-your-processed-multi-slice-h5ad-file \
 3 --output_dir path-to-your-output-directory \
 4 --new-spatial-division spatial-division-value \
 5 --input_dim input-dimension-value \
 6 --multi-slice \
 7 --use-batch used-batch-name-in-adata.obs \
 8 --pretrain-epochs 200 \
 9 --autoencoder-max-epochs 500 \
10 --update-interval 50 \
11 --autoencoder-batch-size 128 \
12 --denoiser-max-epochs 1000 \
13 --denoiser-batch-size 256 \
14 --device cuda:0

Run STADiffuser CLI for 3D slices data

 1     stadiffuser-cli --input_file \
 2     path-to-your-processed-h5ad-file \
 3     --output_dir path-to-your-output-directory \
 4     --new-spatial-division spatial-division-value  \
 5     --new-spatial-z-division z-axis-division-value  \
 6     --input_dim number-of-genes \
 7     --multi-slice \
 8     --use-batch column-name-for-batch \
 9     --pretrain-epochs 200 \
10     --autoencoder-max-epochs 500 \
11     --update-interval 50 \
12     --autoencoder-batch-size 256 \
13     --denoiser-3d \
14     --denoiser-max-epochs integer-value \
15     --denoiser-batch-size integer-value \
16     --label label-column-name \
17     --device cuda:0

Usage

Command-line interface to run the main program of STADiffuser.

Usage: stadiffuser-cli [OPTIONS]

Options:
--input_file PATH

str, path to the processed h5ad file. The AnnData object should contain the gene expression matrix, spatial_net and spatial in the .obsm and the metadata in the .obs.

--output_dir PATH

str, path to the output directory.

--input_dim INTEGER

int, the input dimension of the autoencoder model.

--gat_dim LIST

list, the hidden dimensions of the GAT layers in the autoencoder model.

--block_out_dims LIST

list, the output dimensions of the blocks in the autoencoder model.

--label STR

str, the column name of the label in the metadata to be used for diffusion model training. The key should be in the .obs of the AnnData object.

--mask STR

str, the mask file to specify the region of interest. The key should be in the .obs of the AnnData object. If not specified, the whole slide will be used.

--autoencoder-max-epochs INTEGER

int, the maximum number of epochs for training the autoencoder model. Default is 500.

--denoiser-max-epochs INTEGER

int, the maximum number of epochs for training the diffusion model. Default is 1000.

--device STR

str, “cuda” or “cpu”, specify the device to run the model.

--autoencoder-path PATH

str, the path to the pre-trained autoencoder model.

--autoencoder-check-points PATH

str, the check points of the autoencoder model to be used for training the diffusion model.

--denoiser-check-points PATH

str, the check points of the diffusion model to be used for training the diffusion model.

--autoencoder-name STR

str, the name of the autoencoder model.

--autoencoder-batch-size INTEGER

int, the batch size for training the autoencoder model.

–autoencoder-batch-mode / –no-autoencoder-batch-mode

bool, whether to use the batch mode for training the autoencoder model.

–multi-slice / –no-multi-slice

bool, whether to train the autoencoder model with multiple slices.

--use-batch STR

str, the column name of the batch in the metadata to be used for training the autoencoder model.

--pretrain-epochs INTEGER

int, the number of epochs for pretraining the autoencoder model with multiple slices.

--exclude-batches STR

str, the list of batches to be excluded for training the autoencoder model.

--align-lr FLOAT

float, the learning rate for aligning the autoencoder model with triplet loss.

--update-interval INTEGER

int, the update interval for aligning the autoencoder model with triplet loss.

--margin FLOAT

float, the margin for aligning the autoencoder model with triplet loss.

--new-spatial-division FLOAT

float, the new spatial is divided by this number.

--new-spatial-z-division FLOAT

float, the new spatial z is divided by this number.

–remove-na-label / –no-remove-na-label

bool, whether to remove the NA labels in the metadata.

--denoiser-batch-size INTEGER

int, the batch size for training the diffusion model.