paste3.model_selection.select_overlap_fraction

paste3.model_selection.select_overlap_fraction(a_slice, b_slice, alpha=0.1, show_plot=True, numItermax=1000)[source]

Selects the optimal overlap fraction between two slices, a_slice and b_slice, using a pairwise alignment approach. The function evaluates the edge inconsistency scores for different overlap fractions and estimates the best overlap fraction by finding the one that minimizes the edge inconsistency in both slices. The function also optionally visualizes the edge curves for both slices.

Parameters:
  • a_slice (anndata.AnnData) -- AnnData object containing data for the first slice.

  • b_slice (anndata.AnnData) -- AnnData object containing data or the second slice.

  • alpha (float, optional, default: 0.1) -- Regularization parameter balancing transcriptional dissimilarity and spatial distance among aligned spots. Setting alpha = 0 uses only transcriptional information, while alpha = 1 uses only spatial coordinates.

  • show_plot (bool, optional, default: True) -- Whether to plot the edge inconsistency curves for both slices. If True, the function will display two plots: one for the source slice (a_slice) and one for the target slice (b_slice).

  • numItermax (int, optional, default: 1000) -- Maximum number of iterations for the optimization.

Returns:

The estimated overlap fraction between the two slices, representing the proportion of spatial overlap between the two slices. The value is between 0 and 1, with 1 indicating a perfect overlap.

Return type:

float