scatlastb_utils.metrics.compute_missing_distances

scatlastb_utils.metrics.compute_missing_distances#

scatlastb_utils.metrics.compute_missing_distances(adata, obsp_key_1, obsm_key, obsp_key_2, inplace=True, return_matrix=True, n_jobs=-1, batch_size=100000, **kwargs)#

Compute missing distances.

Due to scanpy’s heuristic, only distances for k-nearest neighbors are kept. In order to compare distances across embeddings, the corresponding distances of edges from one embedding must be present or recomputed for the other embedding.

Parameters:
  • obsp_key_1 – slot for pair-wise distances from embedding 1

  • obsm_key – slot for embedding 1 used for missing distance computation

  • obsp_key_2 – slot slot for pair-wise distances from embedding 2

  • inplace (default: True) – if True, set distances inplace in adata.obsp[obsp_key_1]

  • n_jobs (default: -1) – number of jobs to run in parallel, -1 for all available cores

  • batch_size (default: 100000) – batch size for distance computation

  • kwargs – additional keyword arguments for distance computation, e.g. metric=’euclidean’

  • return_matrix (default: True) – if True, return the distance matrix