Skip to content

scdef.pl.umap

umap(model: scDEF, color: Union[str, List[str]] = [], layers: Optional[List[Union[int, str]]] = None, figsize: Tuple[float, float] = (16, 4), fontsize: int = 12, legend_fontsize: int = 10, rasterized: bool = True, n_legend_cols: int = 1, factor_subset: Optional[List[str]] = None, cmap: Optional[str] = None, show: bool = True) -> None

Plot pre-computed UMAPs for different layers.

UMAP embeddings must have been computed first via scdef.tl.umap. Each panel temporarily points adata.obsm['X_umap'] at X_umap_{layer_name}; the original X_umap is restored afterward. When layers is None, panels follow ascending layer index (L0, L1, ...); otherwise the given layers order is used.

Parameters:

Name Type Description Default
model scDEF

scDEF model instance

required
color Union[str, List[str]]

color key(s) to use for coloring

[]
layers Optional[List[Union[int, str]]]

which layers to plot, in panel order. Entries are layer indices; a string entry is used as an embedding name directly, so layers=['L0_corrected'] plots adata.obsm['X_umap_L0_corrected']. scdef.tl.umap writes that embedding whenever a corrected representation is already present in adata.obsm['X_L0_batch_corrected']; it never builds the correction itself, so run the correction first. Indices and names can be mixed, e.g. layers=[0, 'L0_corrected'] for a before/after pair.

None
figsize Tuple[float, float]

figure size

(16, 4)
fontsize int

font size for labels

12
legend_fontsize int

legend font size

10
rasterized bool

whether to rasterize the plot

True
n_legend_cols int

number of columns in legend

1
factor_subset Optional[List[str]]

subset of factors to plot

None
cmap Optional[str]

colormap for continuous keys; by default scdef.plotting.FACTOR_CMAP for a factor name and scdef.plotting.GENE_CMAP for a gene

None
show bool

whether to show the plot

True