voyagerpy.spatial.local_moran#
- voyagerpy.spatial.local_moran(adata: AnnData, feature: str | Sequence[str], inplace: bool = True, permutations: int = 0, key_added: str = 'local_moran', graph_name: str | None = None, keep_simulations: bool | None = None, layer: str | None = None, na_action: Literal['omit', 'exclude', 'fail', 'pass'] = 'fail', **kwargs: Any) AnnData#
Compute local Moran’s I for a feature.
- Parameters:
adata (AnnData) – The AnnData object to compute local Moran’s I for.
feature (Union[str, Sequence[str]]) – The feature(s) to compute local Moran’s I for. Must be a column in
adata.obsor in``adata.var_names``.inplace (bool, optional) – Whether to add the results to the adata object inplace or copy it, defaults to True
permutations (int, optional) – The number of permutations to permform for simulations, defaults to 0
key_added (str, optional) – The key in
adata.obsmto add, defaults to “local_moran”graph_name (Optional[str], optional) – The neighborhood graph to use, defaults to None
keep_simulations (bool, optional) – Whether to keep the simulations if permutations > 0, defaults to False
layer (Optional[str], optional) – If not None, use this layer for gene features, defaults to None
- Raises:
ImportError – if esda is not installed.
- Returns:
The updated AnnData object. If inplace is False, returns a copy. The results are stored in
adata.obsm[key_added]. If permutations > 0, the simulations are stored inadata.uns["spatial"][key_added]["sim"][feature]. If feature is a list of strings, stores each of the features as such.- Return type:
AnnData