scmiracle.plot#
- scmiracle.plot.plot_umap(adata, key='z_c_joint', do_pca=False, n_comps=32, color='batch', **kwargs)[source]#
Computes and plots a UMAP for a single AnnData object based on a specific latent representation.
This function allows for optional PCA preprocessing on the selected latent representation (stored in .obsm) before computing the neighborhood graph and UMAP.
- Parameters:
adata (AnnData) – The input annotated data matrix.
key (str, optional) – The key in adata.obsm to use as the representation. Defaults to ‘z_c_joint’.
do_pca (bool, optional) – Whether to perform scaling and PCA on the representation before neighbor calculation. Defaults to False.
n_comps (int, optional) – The number of principal components to use if do_pca is True. Defaults to 32.
color (str, optional) – The key in adata.obs used to color the plot. Defaults to ‘batch’.
**kwargs – Additional keyword arguments passed to sc.pl.umap.
- Returns:
Displays the plot.
- Return type:
None
- scmiracle.plot.plot_umap_grid(adata, axis1, axis2, color, figsize=2, point_size=2, fontsize=10, background=True)[source]#
Plots a grid (facet plot) of UMAPs split by two categorical variables.
This visualizes how specific groups (defined by axis1 and axis2) are distributed within the global UMAP space.
- Parameters:
adata (AnnData) – Annotated data matrix with pre-computed UMAP coordinates (X_umap).
axis1 (str) – Key in adata.obs defining the rows of the grid.
axis2 (str) – Key in adata.obs defining the columns of the grid.
color (str) – Key in adata.obs used for coloring the points.
figsize (float, optional) – The size (in inches) of each subplot. Defaults to 2.
point_size (float, optional) – The size of the scatter points. Defaults to 2.
fontsize (int, optional) – Font size for the legend. Defaults to 10.
background (bool, optional) – If True, plots all cells in grey in the background of each subplot to show the global structure. Defaults to True.
- Returns:
Displays the plot.
- Return type:
None
- scmiracle.plot.plot_z_umap_grid(adata_list, batch_col='batch', color='label', figsize=2, point_size=2, fontsize=10, transpose=False)[source]#
Aggregates latent representations from a dictionary of AnnData objects, computes a joint UMAP, and plots a grid view.
It specifically looks for keys in .obsm starting with ‘z_c’, concatenates them, and re-computes the UMAP to visualize the alignment or distribution across different batches/types.
- Parameters:
adata_list (dict) – A dictionary where keys are batch identifiers and values are AnnData objects.
batch_col (str, optional) – Key in adata.obs identifying the batch/sample. Defaults to ‘batch’.
color (str, optional) – Key in adata.obs used for coloring. Defaults to ‘label’.
figsize (float, optional) – The size (in inches) of each subplot. Defaults to 2.
point_size (float, optional) – The size of the scatter points. Defaults to 2.
fontsize (int, optional) – Font size for the legend. Defaults to 10.
transpose (bool, optional) – If True, swaps the row and column axes of the grid (Batch vs. Type). Defaults to False.
- Returns:
Displays the plot.
- Return type:
None