stereo.algorithm.spatial_alignment.SpatialAlignment.main¶
- SpatialAlignment.main(use_hvg=False, n_neighors=15, is_undirected=True, spatial_key='spatial', latent_dims=100, gpu=None, lr=0.001, max_epoch=500, alpha=0.5, patient=15, tau1=0.2, tau2=1.0, tau3=0.5, is_verbose=True, inplace=False)[source]¶
A method to remove batch effect.
- Parameters:
use_hvgs – Whether to use a subset only contains highly variable genes, defaults to False, if True,
data.tl.highly_variable_genesshould be run first and the data will be filtered to only contain highly variable genes.n_neighors (
int) – The number of neighbors selected when constructing a spatial neighbor graph, defaults to 15is_undirected (
bool) – Whether the constructed spatial neighbor graph is undirected graph, defaults to Truelatent_dims (
int) – The number of embedding dimensions, defaults to 100, a reduced dimension matrix whose shape is (n_cells, latent_dims) will be output, you can get it throughdata.tl.result['aligned_reduction'].seed – Random seed, difference seed will cause difference result, defaults to 42
gpu (
Union[str,int,None]) – Whether to use GPU to train, set the ID of GPU to be used, defaults to None to use CPUlr (
float) – Learning rate, defaults to 1e-3max_epoch (
int) – The number of maximum epochs, defaults to 500alpha (
float) – The momentum parameter, defaults to 0.5patient (
int) – Early stop parameter, defaults to 15tau1 (
float) – Instance level and pseudo prototypical cluster level contrastive learning parameters, defaults to 0.2tau2 (
float) – Pseudo prototypical cluster entropy parameter, defaults to 1.tau3 (
float) – Cross-batch instance self-supervised learning parameter, defaults to 0.5is_verbose (
bool) – Whether to print the detail information, defaults to Trueinplace (
bool) – a corrected expression matrix will replace thedata.exp_matrixif True or will be stored indata.layers['aligned_matrix']if False, defaults to False.