spateo.tdr.interpolations.interpolation_gp

Classes

Functions

gp_interpolation(→ anndata.AnnData)

Learn a continuous mapping from space to gene expression pattern with the Gaussian Process method.

Module Contents

class spateo.tdr.interpolations.interpolation_gp.Imputation_GPR(source_adata: anndata.AnnData, target_points: numpy.ndarray | None = None, keys: str | list = None, spatial_key: str = 'spatial', layer: str = 'X', device: str = 'cpu', method: Literal['SVGP', 'ExactGP'] = 'SVGP', batch_size: int = 1024, shuffle: bool = True, inducing_num: int = 512, normalize_spatial: bool = True)[source]
source_adata[source]
X[source]
source_spatial_data[source]
info_data[source]
keys[source]
obs_keys[source]
var_keys[source]
device[source]
train_x[source]
train_y[source]
nx[source]
normalize_spatial[source]
N[source]
method[source]
PCA_reduction = False[source]
info_keys[source]
target_points[source]
normalize_coords(data: numpy.ndarray | torch.Tensor, given_normalize: bool = False)[source]
inference(training_iter: int = 50)[source]
interpolate(use_chunk: bool = False, chunk_num: int = 20)[source]
spateo.tdr.interpolations.interpolation_gp.gp_interpolation(source_adata: anndata.AnnData, target_points: numpy.ndarray | None = None, keys: str | list = None, spatial_key: str = 'spatial', layer: str = 'X', training_iter: int = 50, device: str = 'cpu', method: Literal['SVGP', 'ExactGP'] = 'SVGP', batch_size: int = 1024, shuffle: bool = True, inducing_num: int = 512) anndata.AnnData[source]

Learn a continuous mapping from space to gene expression pattern with the Gaussian Process method.

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].

training_iter

Max number of iterations for training.

device

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

Returns:

an anndata object that has interpolated expression.

Return type:

interp_adata