spateo.tools.cluster._stagate

Module providing a encapsulation of pySTAGATE.

Classes

pySTAGATE

Class representing the object of pySTAGATE.

Module Contents

class spateo.tools.cluster._stagate.pySTAGATE(adata: anndata.AnnData, num_batch_x, num_batch_y, basis='spatial', spatial_key: list = ['X', 'Y'], batch_size: int = 1, rad_cutoff: int = 200, num_epoch: int = 1000, lr: float = 0.001, weight_decay: float = 0.0001, hidden_dims: list = [512, 30], device: str = 'cuda:0')[source]

Class representing the object of pySTAGATE.

device[source]
loader[source]
num_epoch[source]
lr[source]
weight_decay[source]
hidden_dims[source]
adata[source]
data[source]
model[source]
optimizer[source]
train()[source]

Train the STAGATE model.

predicted()[source]

Predict the STAGATE representation and ReX values for all cells.

cal_pSM(n_neighbors: int = 20, resolution: int = 1, max_cell_for_subsampling: int = 5000, psm_key='pSM_STAGATE')[source]

Calculate the pseudo-spatial map using diffusion pseudotime (DPT) algorithm.

Parameters:
n_neighbors int

Number of neighbors for constructing the kNN graph.

resolution float

Resolution for clustering.

max_cell_for_subsampling int

Maximum number of cells for subsampling. If the number of cells is larger than this value, the subsampling will be performed.

Returns:

pSM_values – The pseudo-spatial map values.

Return type:

numpy.ndarray