nichepca.graph_construction.distance_graph

Contents

nichepca.graph_construction.distance_graph#

nichepca.graph_construction.distance_graph(adata, radius=50, obsm_key='spatial', remove_self_loops=False, p=2, verbose=True, return_graph=False)#

Construct a spatial graph based on a distance threshold.

Parameters:
  • adata (AnnData) – Annotated data object.

  • radius (float (default: 50)) – Radius for the distance threshold.

  • obsm_key (str (default: 'spatial')) – Key in obsm attribute where the spatial data is stored.

  • remove_self_loops (bool (default: False)) – Whether to remove self-loops.

  • p (int (default: 2)) – The norm to calculate the distance.

  • verbose (bool (default: True)) – Whether to print graph statistics.

  • return_graph (bool, default False) – Whether to return the graph instead of storing it in adata.

Returns:

None