spateo.plotting.static.three_d_plot.pairwise_align_plots ======================================================== .. py:module:: spateo.plotting.static.three_d_plot.pairwise_align_plots Functions --------- .. autoapisummary:: spateo.plotting.static.three_d_plot.pairwise_align_plots.pi_heatmap spateo.plotting.static.three_d_plot.pairwise_align_plots.pairwise_mapping spateo.plotting.static.three_d_plot.pairwise_align_plots.pairwise_iteration spateo.plotting.static.three_d_plot.pairwise_align_plots.pairwise_iteration_panel Module Contents --------------- .. py:function:: pi_heatmap(pi: numpy.ndarray, model1_name: str = 'model1', model2_name: str = 'model2', colormap: str = 'hot_r', fig_height: Union[int, float] = 3, robust: bool = False, vmin: Optional[Union[int, float]] = None, vmax: Optional[Union[int, float]] = None, fontsize: Union[int, float] = 12, filename: Optional[str] = None, **kwargs) Visualize a heatmap of the pi matrix. :param pi: The pi matrix obtained by alignment. :param model1_name: The name/id of model1. :param model2_name: The name/id of model2. :param colormap: Colors to use for plotting heatmap. The default colormap is ``'hot_r'``. :param fig_height: Figure height. :param robust: If True and vmin or vmax are absent, the colormap range is computed with robust quantiles instead of the extreme values. :param vmin: Values to anchor the colormap, otherwise they are inferred from the data and other keyword arguments. :param vmax: Values to anchor the colormap, otherwise they are inferred from the data and other keyword arguments. :param fontsize: The font size of x label and y label. :param filename: Filename of output file. :param \*\*kwargs: Additional parameters that will be passed to ``sns.heatmap`` function. .. py:function:: pairwise_mapping(idA: str = 'sampleA', idB: str = 'sampleB', adataA: Optional[anndata.AnnData] = None, adataB: Optional[anndata.AnnData] = None, pi: Optional[numpy.ndarray] = None, modelA: Optional[pyvista.PolyData] = None, modelB: Optional[pyvista.PolyData] = None, model_lines: Optional[pyvista.PolyData] = None, layer: str = 'X', group_key: Union[str, list] = None, spatial_key: str = 'align_spatial', keep_all: bool = False, distance: Optional[Union[int, float]] = 300, direction: Optional[Literal['x', 'y', 'z']] = 'z', filename: Optional[str] = None, jupyter: Union[bool, Literal['none', 'static', 'trame']] = False, off_screen: bool = False, cpo: Optional[Union[str, list]] = 'iso', window_size: Optional[tuple] = (1024, 1024), background: str = 'black', modelA_cmap: str = 'dodgerblue', modelA_amap: Union[float, list] = 1.0, modelB_cmap: str = 'red', modelB_amap: Union[float, list] = 1.0, line_color: str = 'gainsboro', line_alpha: Union[float, list] = 1.0, ambient: float = 0.3, model_opacity: float = 1, line_opacity: float = 0.03, model_size: Union[float, list] = 6.0, line_size: Union[float, list] = 2.0, show_axes: bool = True, show_legend: bool = True, legend_kwargs: Optional[dict] = None, text: Union[bool, str] = True, text_kwargs: Optional[dict] = None, **kwargs) Visualize the pairing of cells between two models. :param idA: ID of modelA. :param idB: ID of modelB. :param adataA: Anndata object of modelA. :param adataB: Anndata object of modelB. :param pi: The pi matrix obtained by alignment. :param modelA: The point cloud model of adataA. :param modelB: The point cloud model of adataB. :param model_lines: Cell connection lines between modelA and modelB :param layer: If ``'X'``, uses ``.X``, otherwise uses the representation given by ``.layers[layer]``. :param group_key: The key that stores clustering or annotation information in ``.obs``, a gene name or a list of gene names in ``.var``. :param spatial_key: The key in ``.obsm`` that corresponds to the spatial coordinate of each bucket. :param keep_all: Whether to retain all the optimal relationships obtained only based on the pi matrix, If ``keep_all`` is False, the optimal relationships obtained based on the pi matrix and the nearest coordinates. :param distance: Distance between modelA and modelB when visualizing. :param direction: The direction between modelA and modelB when visualizing. :param filename: Filename of output file. Writer type is inferred from the extension of the filename. * Output an image file,please enter a filename ending with ``'.png', '.tif', '.tiff', '.bmp', '.jpeg', '.jpg', '.svg', '.eps', '.ps', '.pdf', '.tex'``. When ``jupyter=False``, if you want to save '.png' file, please ensure ``off_screen=True``. :param jupyter: Whether to plot in jupyter notebook. Available ``jupyter`` are: * ``'none'`` - Do not display in the notebook. * ``'trame'`` - Show a trame widget * ``'static'`` - Display a static figure. :param off_screen: Renders off-screen when True. Useful for automated screenshots. :param cpo: Camera position of the active render window. Available ``cpo`` are: * Iterable containing position, focal_point, and view up. ``E.g.: [(2.0, 5.0, 13.0), (0.0, 0.0, 0.0), (-0.7, -0.5, 0.3)].`` * Iterable containing a view vector. ``E.g.: [-1.0, 2.0, -5.0].`` * A string containing the plane orthogonal to the view direction. ``E.g.: 'xy', 'xz', 'yz', 'yx', 'zx', 'zy', 'iso'.`` :param window_size: Window size in pixels. The default window_size is ``(1024, 1024)``. :param background: The background color of the window. :param modelA_cmap: Colors to use for plotting modelA. The default colormap is ``'dodgerblue'``. :param modelA_amap: The opacity of the colors to use for plotting modelA. The default alphamap is ``1.0``. :param modelB_cmap: Colors to use for plotting modelB. The default colormap is ``'red'``. :param modelB_amap: The opacity of the colors to use for plotting modelB. The default alphamap is ``1.0``. :param line_color: Colors to use for plotting lines. The default colormap is ``'gainsboro'``. :param line_alpha: Alpha to use for plotting lines. The default colormap is ``'gainsboro'``. :param ambient: When lighting is enabled, this is the amount of light in the range of 0 to 1 (default 0.0) that reaches the actor when not directed at the light source emitted from the viewer. :param model_opacity: Opacity of the modelA and modelB. :param line_opacity: Opacity of the lines. :param model_size: The point size of any nodes in the dataset plotted. :param line_size: The line size of lines in the dataset plotted. :param show_axes: Whether to add a camera orientation widget to the active renderer. :param show_legend: whether to add a legend to the plotter. :param legend_kwargs: A dictionary that will be pass to the ``add_legend`` function. By default, it is an empty dictionary and the ``add_legend`` function will use the ``{"legend_size": None, "legend_loc": None, "legend_size": None, "legend_loc": None, "title_font_size": None, "label_font_size": None, "font_family": "arial", "fmt": "%.2e", "n_labels": 5, "vertical": True}`` as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs. :param text: The text to add the rendering. :param text_kwargs: A dictionary that will be pass to the ``add_text`` function. By default, it is an empty dictionary and the ``add_legend`` function will use the ``{ "font_family": "arial", "font_size": 12, "font_color": "black", "text_loc": "upper_left"}`` as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs. :param \*\*kwargs: Additional parameters that will be passed to ``three_d_plot`` function. :returns: The point cloud models of adataA. pcB: The point cloud models of adataB. model_lines: Cell mapping lines between modelA and modelB. :rtype: pcA .. py:function:: pairwise_iteration(adataA: anndata.AnnData, adataB: anndata.AnnData, layer: str = 'X', group_key: Union[str, list] = None, spatial_key: str = 'align_spatial', iter_key: str = 'iter_spatial', id_key: str = 'slices', filename: str = 'animate.mp4', jupyter: Union[bool, Literal['none', 'static', 'trame']] = False, off_screen: bool = False, cpo: Optional[Union[str, list]] = None, window_size: Optional[tuple] = None, background: str = 'black', modelA_cmap: str = 'dodgerblue', modelB_cmap: str = 'red', ambient: Union[int, float] = 0.3, modelA_opacity: Union[int, float] = 0.8, modelB_opacity: Union[int, float] = 1.0, model_size: Union[float, list] = 6.0, show_axes: bool = True, show_legend: bool = True, legend_kwargs: Optional[dict] = None, text: Union[bool, str] = True, text_kwargs: Optional[dict] = None, framerate: int = 6, **kwargs) Visualize the results of each iteration in the alignment process. :param adataA: Anndata object of modelA. :param adataB: Anndata object of modelB. :param layer: If ``'X'``, uses ``.X``, otherwise uses the representation given by ``.layers[layer]``. :param group_key: The key that stores clustering or annotation information in ``.obs``, a gene name or a list of gene names in ``.var``. :param spatial_key: The key in ``.obsm`` that corresponds to the spatial coordinate of each bucket. :param iter_key: The key in ``.uns`` that corresponds to the result of each iteration of the iterative process. :param id_key: The key in ``.obs`` that corresponds to the model id of each bucket. :param filename: Filename of output file. Writer type is inferred from the extension of the filename. * Output a gif file, please enter a filename ending with ``.gif``. * Output a mp4 file, please enter a filename ending with ``.mp4``. :param jupyter: Whether to plot in jupyter notebook. Available ``jupyter`` are: * ``'none'`` - Do not display in the notebook. * ``'trame'`` - Show a trame widget * ``'static'`` - Display a static figure. :param off_screen: Renders off-screen when True. Useful for automated screenshots. :param cpo: Camera position of the active render window. Available ``cpo`` are: * Iterable containing position, focal_point, and view up. ``E.g.: [(2.0, 5.0, 13.0), (0.0, 0.0, 0.0), (-0.7, -0.5, 0.3)].`` * Iterable containing a view vector. ``E.g.: [-1.0, 2.0, -5.0].`` * A string containing the plane orthogonal to the view direction. ``E.g.: 'xy', 'xz', 'yz', 'yx', 'zx', 'zy', 'iso'.`` :param window_size: Window size in pixels. The default window_size is ``[512, 512]``. :param background: The background color of the window. :param modelA_cmap: Colors to use for plotting modelA. The default colormap is ``'dodgerblue'``. :param modelB_cmap: Colors to use for plotting modelB. The default colormap is ``'red'``. :param ambient: When lighting is enabled, this is the amount of light in the range of 0 to 1 (default 0.0) that reaches the actor when not directed at the light source emitted from the viewer. :param modelA_opacity: Opacity of the modelA. :param modelB_opacity: Opacity of the modelB. :param model_size: The point size of any nodes in the dataset plotted. :param show_axes: Whether to add a camera orientation widget to the active renderer. :param show_legend: whether to add a legend to the plotter. :param legend_kwargs: A dictionary that will be pass to the ``add_legend`` function. By default, it is an empty dictionary and the ``add_legend`` function will use the ``{"legend_size": None, "legend_loc": None, "legend_size": None, "legend_loc": None, "title_font_size": None, "label_font_size": None, "font_family": "arial", "fmt": "%.2e", "n_labels": 5, "vertical": True}`` as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs. :param text: The text to add the rendering. :param text_kwargs: A dictionary that will be pass to the ``add_text`` function. By default, it is an empty dictionary and the ``add_legend`` function will use the ``{ "font_family": "arial", "font_size": 12, "font_color": "black", "text_loc": "upper_left"}`` as its parameters. Otherwise, you can provide a dictionary that properly modify those keys according to your needs. :param framerate: Frames per second. :param \*\*kwargs: Additional parameters that will be passed to ``three_d_animate`` function. .. py:function:: pairwise_iteration_panel(adataA: anndata.AnnData, adataB: anndata.AnnData, group_key: Union[str, list] = None, select_group: Union[str, list] = None, spatial_key: str = 'align_spatial', iter_key: str = 'iter_spatial', filename: str = 'animate.mp4', jupyter: Union[bool, Literal['none', 'static', 'trame']] = False, off_screen: bool = False, id_key: Optional[str] = None, cpo: Optional[Union[str, list]] = None, window_size: Optional[tuple] = None, background: str = 'black', modelA_cmap: str = 'dodgerblue', modelB_cmap: str = 'red', ambient: Union[int, float] = 0.3, modelA_opacity: Union[int, float] = 0.8, modelB_opacity: Union[int, float] = 1.0, model_size: Union[float, list] = 6.0, show_axes: bool = True, show_legend: bool = True, legend_kwargs: Optional[dict] = None, text: Union[bool, str] = True, text_kwargs: Optional[dict] = None, framerate: int = 6, **kwargs)