spamosaic.build_graph.Cal_Spatial_Net

spamosaic.build_graph.Cal_Spatial_Net(adata, rad_cutoff=None, k_cutoff=None, max_neigh=50, model='Radius', verbose=True)[source]

Construct spatial graph from spatial coordinates using radius or kNN method.

Parameters:
  • adata (AnnData) – Input annotated data.

  • rad_cutoff (float, optional) – Distance cutoff for radius-based graph.

  • k_cutoff (int, optional) – Number of neighbors for kNN-based graph.

  • max_neigh (int) – Maximum number of neighbors to consider.

  • model (str) – Type of graph construction: ‘Radius’ or ‘KNN’.

  • verbose (bool) – Whether to print debug info.

Return type:

None

Notes

On success, adds the adjacency matrix to adata.uns['adj'] (SciPy sparse matrix).