grassp.pl.aligned_umap

Contents

grassp.pl.aligned_umap#

aligned_umap(data, data2, highlight_hits=None, highlight_annotation_col=None, aligned_umap_key='X_aligned_umap', data1_label='data1', data2_label='data2', color_by='perturbation', data1_color='#C7E8F9', data2_color='#FFCCC2', figsize=(8.25, 6), size=80, alpha=0.4, ax=None, show=None, save=None)[source]#

Side-by-side visualisation of aligned UMAP embeddings.

Given two datasets embedded into a common aligned UMAP space (see aligned_umap()), the function plots both embeddings in a single scatter plot and optionally draws remodeling trajectories for highlighted proteins.

Parameters:
data AnnData

Two AnnData objects with the same set/order of observations and a shared key in .obsm (aligned_umap_key).

data2 AnnData

Two AnnData objects with the same set/order of observations and a shared key in .obsm (aligned_umap_key).

highlight_hits Union[List[str], ndarray[bool, Any], None] (default: None)

Proteins to emphasise with a star marker and a line connecting their positions between the two datasets. Can be a list of observation names or a boolean mask.

highlight_annotation_col str | None (default: None)

Optional column in data.obs used for text labels next to the highlighted points.

aligned_umap_key str (default: 'X_aligned_umap')

Key in .obsm containing the aligned coordinates (default: "X_aligned_umap").

data1_label str (default: 'data1')

Legend labels for the two datasets.

data2_label str (default: 'data2')

Legend labels for the two datasets.

color_by Literal['perturbation', 'cluster'] (default: 'perturbation')

If "perturbation" (default) both datasets are assigned uniform colors (data1_color, data2_color). If "cluster" cluster- specific colors defined in data.obs[color_key] are used.

size int (default: 80)

Standard matplotlib styling parameters.

alpha float (default: 0.4)

Standard matplotlib styling parameters.

figsize tuple[float, float] (default: (8.25, 6))

Standard matplotlib styling parameters.

ax Axes | None (default: None)

Standard matplotlib styling parameters.

show bool | None (default: None)

Forwarded to scanpy.pl._utils.savefig_or_show().

save bool | str | None (default: None)

Forwarded to scanpy.pl._utils.savefig_or_show().

data1_color str

data2_color str

Return type:

Axes | None

Returns:

Returns the Axes object if show is False.