SpaMetric.spatial_reconstruction#

SpaMetric.spatial_reconstruction(adata, alpha=1, n_neighbors=10, n_pcs=15, use_highly_variable=None, normalize_total=False, copy=False)[source]#

Spatial reconstruction of gene expression matrix.

Parameters:
adata : AnnData

Annotated data matrix.

alpha : float (default: 1)

Relative weight for the aggregated expression to the original expression.

n_neighbors : int (default: 10)

Number of spatial neighbors for aggregating expression.

n_pcs : int (default: 15)

Number of principal components to use for weighting the spatial neighbors.

use_highly_variable : bool | NoneOptional[bool] (default: None)

Whether to use highly variable genes only, stored in adata.var[‘highly_variable’]. By default uses them if they have been determined beforehand.

normalize_total : bool (default: False)

Whether to normalize each cell by total counts over all genes.

copy : bool (default: False)

Return a copy instead of writing to adata.

Return type:

AnnData | NoneOptional[AnnData]

Returns:

Depending on copy, returns or updates adata with the following fields.

.X

The reconstructed log transformed gene expression matrix.

.layers[‘counts’]

The gene expression count matrix.

.layers[‘log1p’]

The log transformed gene expression matrix.