spateo.alignment.paste_alignment ================================ .. py:module:: spateo.alignment.paste_alignment Functions --------- .. autoapisummary:: spateo.alignment.paste_alignment.paste_align spateo.alignment.paste_alignment.paste_align_ref Module Contents --------------- .. py:function:: paste_align(models: List[anndata.AnnData], layer: str = 'X', genes: Optional[Union[list, numpy.ndarray]] = None, spatial_key: str = 'spatial', key_added: str = 'align_spatial', mapping_key_added: str = 'models_align', alpha: float = 0.1, numItermax: int = 200, numItermaxEmd: int = 100000, dtype: str = 'float64', device: str = 'cpu', verbose: bool = True, **kwargs) -> Tuple[List[anndata.AnnData], List[Union[numpy.ndarray, numpy.ndarray]]] Align spatial coordinates of models. :param models: List of models (AnnData Object). :param layer: If ``'X'``, uses ``.X`` to calculate dissimilarity between spots, otherwise uses the representation given by ``.layers[layer]``. :param genes: Genes used for calculation. If None, use all common genes for calculation. :param spatial_key: The key in ``.obsm`` that corresponds to the raw spatial coordinate. :param key_added: ``.obsm`` key under which to add the aligned spatial coordinates. :param mapping_key_added: `.uns` key under which to add the alignment info. :param alpha: Alignment tuning parameter. Note: 0 <= alpha <= 1. When ``alpha = 0`` only the gene expression data is taken into account, while when ``alpha =1`` only the spatial coordinates are taken into account. :param numItermax: Max number of iterations for cg during FGW-OT. :param numItermaxEmd: Max number of iterations for emd during FGW-OT. :param dtype: The floating-point number type. Only ``float32`` and ``float64``. :param device: Equipment used to run the program. You can also set the specified GPU for running. ``E.g.: '0'``. :param verbose: If ``True``, print progress updates. :param \*\*kwargs: Additional parameters that will be passed to ``pairwise_align`` function. :returns: List of models (AnnData Object) after alignment. pis: List of pi matrices. :rtype: align_models .. py:function:: paste_align_ref(models: List[anndata.AnnData], models_ref: Optional[List[anndata.AnnData]] = None, n_sampling: Optional[int] = 2000, sampling_method: str = 'trn', layer: str = 'X', genes: Optional[Union[list, numpy.ndarray]] = None, spatial_key: str = 'spatial', key_added: str = 'align_spatial', mapping_key_added: str = 'models_align', alpha: float = 0.1, numItermax: int = 200, numItermaxEmd: int = 100000, dtype: str = 'float64', device: str = 'cpu', verbose: bool = True, **kwargs) -> Tuple[List[anndata.AnnData], List[anndata.AnnData], List[Union[numpy.ndarray, numpy.ndarray]]] Align the spatial coordinates of one model list through the affine transformation matrix obtained from another model list. :param models: List of models (AnnData Object). :param models_ref: Another list of models (AnnData Object). :param n_sampling: When ``models_ref`` is None, new data containing n_sampling coordinate points will be automatically generated for alignment. :param sampling_method: The method to sample data points, can be one of ``["trn", "kmeans", "random"]``. :param layer: If ``'X'``, uses ``.X`` to calculate dissimilarity between spots, otherwise uses the representation given by ``.layers[layer]``. :param genes: Genes used for calculation. If None, use all common genes for calculation. :param spatial_key: The key in ``.obsm`` that corresponds to the raw spatial coordinates. :param key_added: ``.obsm`` key under which to add the aligned spatial coordinates. :param mapping_key_added: `.uns` key under which to add the alignment info. :param alpha: Alignment tuning parameter. Note: 0 <= alpha <= 1. When ``alpha = 0`` only the gene expression data is taken into account, while when ``alpha =1`` only the spatial coordinates are taken into account. :param numItermax: Max number of iterations for cg during FGW-OT. :param numItermaxEmd: Max number of iterations for emd during FGW-OT. :param dtype: The floating-point number type. Only ``float32`` and ``float64``. :param device: Equipment used to run the program. You can also set the specified GPU for running. ``E.g.: '0'``. :param verbose: If ``True``, print progress updates. :param \*\*kwargs: Additional parameters that will be passed to ``models_align`` function. :returns: List of models (AnnData Object) after alignment. align_models_ref: List of models_ref (AnnData Object) after alignment. pis: The list of pi matrices from align_models_ref. :rtype: align_models