spateo.alignment.transform

Functions

paste_transform(→ anndata.AnnData)

Align the space coordinates of the new model with the transformation matrix obtained from PASTE.

BA_transform(vecfld, quary_points[, ...])

Apply non-rigid transform to the quary points

BA_transform_and_assignment(samples, vecfld[, layer, ...])

get_P_chunk(→ Union[numpy.ndarray, torch.Tensor])

Calculating the generating probability matrix P.

Module Contents

spateo.alignment.transform.paste_transform(adata: anndata.AnnData, adata_ref: anndata.AnnData, spatial_key: str = 'spatial', key_added: str = 'align_spatial', mapping_key: str = 'models_align') anndata.AnnData[source]

Align the space coordinates of the new model with the transformation matrix obtained from PASTE.

Parameters:
adata

The anndata object that need to be aligned.

adata_ref

The anndata object that have been aligned by PASTE.

spatial_key

The key in .obsm that corresponds to the raw spatial coordinates.

key_added

.obsm key under which to add the aligned spatial coordinates.

mapping_key

The key in .uns that corresponds to the alignment info from PASTE.

Returns:

The anndata object that have been to be aligned.

Return type:

adata

spateo.alignment.transform.BA_transform(vecfld, quary_points, deformation_scale: int = 1, dtype: str = 'float64', device: str = 'cpu')[source]

Apply non-rigid transform to the quary points

Parameters:
vecfld

A dictionary containing information about vector fields

quary_points

deformation_scale

If deformation_scale is greater than 1, increase the degree of deformation.

dtype

The floating-point number type. Only float32 and float64.

device

Equipment used to run the program. You can also set the specified GPU for running. E.g.: '0'.

spateo.alignment.transform.BA_transform_and_assignment(samples, vecfld, layer: str = 'X', genes: List | torch.Tensor | None = None, spatial_key: str = 'spatial', small_variance: bool = False, dtype: str = 'float64', device: str = 'cpu', verbose: bool = False)[source]
spateo.alignment.transform.get_P_chunk(XnAHat: numpy.ndarray | torch.Tensor, XnB: numpy.ndarray | torch.Tensor, X_A: numpy.ndarray | torch.Tensor, X_B: numpy.ndarray | torch.Tensor, sigma2: int | float | numpy.ndarray | torch.Tensor, beta2: int | float | numpy.ndarray | torch.Tensor, alpha: numpy.ndarray | torch.Tensor, gamma: float | numpy.ndarray | torch.Tensor, Sigma: numpy.ndarray | torch.Tensor, samples_s: List[float] | None = None, outlier_variance: float = None, chunk_size: int = 1000, dissimilarity: str = 'kl') numpy.ndarray | torch.Tensor[source]

Calculating the generating probability matrix P.

Parameters:
XAHat

Current spatial coordinate of sample A. Shape