spateo.tdr.interpolations.interpolation_sparseVFC

Functions

kernel_interpolation(→ anndata.AnnData)

Learn a continuous mapping from space to gene expression pattern with Kernel method (sparseVFC).

Module Contents

spateo.tdr.interpolations.interpolation_sparseVFC.kernel_interpolation(source_adata: anndata.AnnData, target_points: numpy.ndarray | None = None, keys: str | list = None, spatial_key: str = 'spatial', layer: str = 'X', lambda_: float = 0.02, lstsq_method: str = 'scipy', **kwargs) anndata.AnnData[source]

Learn a continuous mapping from space to gene expression pattern with Kernel method (sparseVFC).

Parameters:
source_adata

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

target_points

The spatial coordinates of new data point. If target_coords is None, generate new points based on grid_num.

keys

Gene list or info list in the obs attribute whose interpolate expression across space needs to learned.

spatial_key

The key in .obsm that corresponds to the spatial coordinate of each bucket.

layer

If 'X', uses .X, otherwise uses the representation given by .layers[layer].

lambda

Represents the trade-off between the goodness of data fit and regularization. Larger Lambda_ put more weights on regularization.

lstsq_method

The name of the linear least square solver, can be either ‘scipy` or douin.

**kwargs

Additional parameters that will be passed to SparseVFC function.

Returns:

an anndata object that has interpolated expression.

Return type:

interp_adata