SpatialDE.fit_detailed

SpatialDE.fit_detailed(adata, genes=None, layer=None, normalized=False, sizefactor_col=None, spatial_key='spatial', control=GPControl(), rng=np.random.default_rng())

Fits Gaussian processes to genes.

A Gaussian process based on highly interpretable spectral mixture kernels (Wilson et al. 2013, Wilson 2014) is fitted separately to each gene. Sparse GPs are used on large datasets (>1000 observations) to improve speed. This uses a Gaussian likelihood and requires appropriate data normalization.

Parameters:
  • adata (AnnData) – The annotated data matrix.

  • genes (Optional[List[str]]) – List of genes to base the analysis on. Defaults to all genes.

  • layer (Optional[str]) – Name of the AnnData object layer to use. By default adata.X is used.

  • normalized (bool) – Whether the data are already normalized to an approximately Gaussian likelihood. If False, they will be normalized using the workflow from Svensson et al, 2018.

  • sizefactor_col (Optional[str]) – Column in adata.obs to be used for normalization. If None, total number of counts per spot will be used.

  • spatial_key (str) – Key in adata.obsm where the spatial coordinates are stored.

  • control (Optional[GPControl]) – Parameters for the Gaussian process, e.g. number of kernel components, number of inducing points.

  • rng (Generator) – Random number generator.

Return type:

DataSetResults

Returns:

A dictionary with the results. The dictionary has an additional method to_df, which returns a DataFrame with the key results.