Skip to content

scdef.tl.umap

umap(model: scDEF, layers: Optional[List[int]] = None, use_log: bool = False, metric: str = 'euclidean') -> None

Compute UMAP embeddings for each scDEF layer.

The resulting embeddings are stored in model.adata.obsm[f"X_umap_{layer_name}"] for each layer. Any pre-existing adata.obsm['X_umap'], adata.uns['neighbors'], adata.uns['umap'], and adata.obsp neighbor graphs are restored afterward (removed if absent), so generic scanpy calls keep using the original embedding and graph.

Parameters:

Name Type Description Default
model scDEF

scDEF model instance

required
layers Optional[List[int]]

which layers to compute UMAPs for, in processing order. If None, all layers with more than one factor are used, coarse-to-fine (descending layer index).

None
use_log bool

whether to use log-transformed cell-factor weights for the neighbor graph computation.

False
metric str

distance metric for neighbors computation.

'euclidean'

When a corrected layer-0 representation is already present in adata.obsm['X_L0_batch_corrected'] (written by factor_batch_correction), it is embedded as well and stored as adata.obsm['X_umap_L0_corrected'], in addition to the per-layer embeddings. This function never builds that representation.