spateo.tdr.interpolations.utils#

Module Contents#

Functions#

get_X_Y_grid(→ Tuple[numpy.ndarray, numpy.ndarray, ...)

Prepare the X (spatial coordinates), Y (gene expression) and grid points for the kernel or deep model.

spateo.tdr.interpolations.utils.get_X_Y_grid(adata: anndata.AnnData | None = None, genes: List | None = None, X: numpy.ndarray | None = None, Y: numpy.ndarray | None = None, grid_num: List = [50, 50, 50]) Tuple[numpy.ndarray, numpy.ndarray, numpy.ndarray, numpy.ndarray][source]#

Prepare the X (spatial coordinates), Y (gene expression) and grid points for the kernel or deep model.

Parameters:
adata

AnnData object that contains spatial (numpy.ndarray) in the obsm attribute.

genes

Gene list whose interpolate expression across space needs to learned. If Y is provided, genes will only be used to retrive the gene annotation info.

X

The spatial coordinates of each data point.

Y

The gene expression of the corresponding data point.

grid_num

Number of grid to generate. Default is 50 for each dimension. Must be non-negative.

Returns:

spatial coordinates. Y: gene expression of the associated spatial coordinates. Grid: grid points formed with the input spatial coordinates. grid_in_hull: A list of booleans indicates whether the current grid points is within the convex hull formed by

the input data points.

Return type:

X