stereo.algorithm.paste.pairwise_align#
- stereo.algorithm.paste.pairwise_align(sliceA, sliceB, alpha=0.1, dissimilarity='kl', use_rep=None, G_init=None, a_distribution=None, b_distribution=None, norm=False, numItermax=200, filter_gene=True, backend=<ot.backend.NumpyBackend object>, use_gpu=False, return_obj=False, verbose=False, gpu_verbose=True, **kwargs)[source]#
Calculates and returns optimal alignment of two slices.
- Parameters:
sliceA (
StereoExpData
) – Slice A to align.sliceB (
StereoExpData
) – Slice B to align.alpha (
float
) – Alignment tuning parameter. Note: 0 <= alpha <= 1.dissimilarity (
str
) – Expression dissimilarity measure:'kl'
or'euclidean'
.use_rep (
Optional
[str
]) – IfNone
, usesslice.X
to calculate dissimilarity between spots, otherwise uses the representation given byslice.obsm[use_rep]
.optional) (b_distribution (array-like,) – Initial mapping to be used in FGW-OT, otherwise default is uniform mapping.
optional) – Distribution of sliceA spots, otherwise default is uniform.
optional) – Distribution of sliceB spots, otherwise default is uniform.
numItermax (
int
) – Max number of iterations during FGW-OT.norm (
bool
) – IfTrue
, scales spatial distances such that neighboring spots are at distance 1. Otherwise, spatial distances remain unchanged.backend – Type of backend to run calculations. For list of backends available on system:
ot.backend.get_backend_list()
.use_gpu (
bool
) – IfTrue
, use gpu. Otherwise, use cpu. Currently we only have gpu support for Pytorch.return_obj (
bool
) – IfTrue
, additionally returns objective function output of FGW-OT.verbose (
bool
) – IfTrue
, FGW-OT is verbose.gpu_verbose (
bool
) – IfTrue
, print whether gpu is being used to user.
- Return type:
Tuple
[ndarray
,Optional
[int
]]- Returns:
Alignment of spots. If
return_obj = True
, additionally returns objective function output of FGW-OT.