scatlastb_utils.metrics.compare_distances#
- scatlastb_utils.metrics.compare_distances(adata, obsp_key_1, obsm_key_1, obsp_key_2, obsm_key_2, scale_distances=True, quantile=0.9, k_max=50, log_scale_diffs=False, **kwargs)#
Compare distances of same edges but from different representations.
This function computes:
“average_distance_1”: the average distances per k-nearest neighborhood for obsp_key_1
“average_distance_2”: the average distances per k-nearest neighborhood for obsp_key_2
“average_difference”: the difference of 1. and 2.
“average_distance_diff”: the average of the differences between the two embeddings
“spearman_correlation”: the Spearman correlation of the distance differences (of the k-nearest neighbors only)
- Parameters:
adata – AnnData object containing the distances in obsp
obsp_key_1 – slot for pair-wise distances from embedding 1
obsm_key_1 – slot for embedding 1 used for distance computation
obsp_key_2 – slot for pair-wise distances from embedding 2
obsm_key_2 – slot for embedding 2 used for distance computation
scale_distances (default:
True) – if True, scale distances by the quantile of the distancesquantile (default:
0.9) – quantile to scale distances by, default is 0.9k_max (default:
50) – maximum number of neighbors to consider, default is 50log_scale_diffs (default:
False) – if True, log scale the differenceskwargs – additional keyword arguments for distance computation, e.g. metric=’euclidean’
- Returns:
DataFrame with average distances and differences