voyagerpy.spatial.moran#

voyagerpy.spatial.moran(adata: AnnData, feature: str | Sequence[str], graph_name: str | None = None, layer: str | None = None, dim: Literal['obs', 'var'] = 'obs', permutations: int = 0) None#

Compute Moran’s I.

Parameters:
  • adata (AnnData) – The AnnData object to compute Moran’s I for.

  • feature (Union[str, Sequence[str]]) – The feature(s) to compute Moran’s I for. Must be a column in adata.obs or in``adata.var_names``.

  • graph_name (Optional[str], optional) – The neighborhood graph defining the weights, defaults to None. If None, use the default graph. Must be a key in adata.uns["spatial"] or adata.obsp["spatial"].

  • layer (Optional[str], optional) – If the feature is a gene id, use this layer for its value, defaults to None

  • dim (Literal["obs", "var"], optional) – Whether the feature is a gene or in obs. Will be deprecated, defaults to “obs”

  • permutations (int, optional) – How many permutations to use when simulating Moran’s I, defaults to 0

Raises: