SpatialDE.test_spatial_interactions

SpatialDE.test_spatial_interactions(adata, layer=None, spatial_key='spatial', ard=False, sizefactors=None, copy=False)

Fit an SVCA model (Arnol, 2019) and test for spatial cell-cell interactions.

In contrast to the original publication, which used a Gaussian approximation with a likelihood ratio test, this fits a Poisson GLMM and uses a score test.

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

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

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

  • ard (bool) – Whether to use automatic relevance determination for the kernel. This amounts to a separate lengthscale for each spatial dimension.

  • sizefactors (Optional[ndarray]) – Scaling factors for the observations. Defaults to total read counts.

  • copy (bool) – Whether to return a copy of adata with results or write the results into adata in-place.

Return type:

Tuple[DataFrame, Optional[AnnData]]

Returns:

A tuple. The first element is a Pandas DataFrame with the test results, the second is None if copy == False or an AnnData object.