scdef.tl.multilayer_umap ¶
multilayer_umap(model: scDEF, layers: Optional[Sequence[int]] = None, weights: Optional[Sequence[float]] = None, normalize_per_layer: bool = False, use_log: bool = False, metric: str = 'euclidean', key_added: str = 'multilayer', eps: float = 1e-08, neighbors_kwargs: Optional[Dict[str, object]] = None, umap_kwargs: Optional[Dict[str, object]] = None) -> ndarray
Compute a single UMAP from the concatenation of all scDEF layers.
Each cell's representation is the concatenation of its soft factor
assignments X_{layer_name} across the selected layers, producing
a multi-resolution signature that encodes identity at every level
of the hierarchy simultaneously.
This tends to produce a lineage-aware embedding that smooths
through differentiation trajectories: terminally differentiated
cells form tight clusters by shared fine-layer factor, progenitor
cells bridge siblings through their shared parent-layer mass, and
stem-like cells with diffuse scores sit in their own regime.
Contrast with umap (per-layer), which only captures a single
scale.
By default it uses raw per-layer scores as stored in X_{layer}.
Set normalize_per_layer=True to convert each layer's row to
proportions before optional log/weighting; this makes geometry
reflect relative composition at each layer rather than absolute
score scale.
Use weights to bias the embedding toward fine or coarse
resolution.
Single-factor layers (K_k == 1, typically the root) are skipped
automatically — every cell has mass 1 there, so they add no
discriminative signal.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
scDEF
|
fitted scDEF model. |
required |
layers
|
Optional[Sequence[int]]
|
layer indices to include. If None, uses all layers with
|
None
|
weights
|
Optional[Sequence[float]]
|
optional per-layer multiplicative weights applied to
each layer's sub-vector before concatenation. Must have the
same length as |
None
|
normalize_per_layer
|
bool
|
if True, row-normalize each selected layer
block so rows sum to 1 before optional |
False
|
use_log
|
bool
|
if True, replace each sub-vector by |
False
|
metric
|
str
|
distance metric for |
'euclidean'
|
key_added
|
str
|
suffix used to store results. Writes
|
'multilayer'
|
eps
|
float
|
floor for |
1e-08
|
neighbors_kwargs
|
Optional[Dict[str, object]]
|
extra kwargs forwarded to |
None
|
umap_kwargs
|
Optional[Dict[str, object]]
|
extra kwargs forwarded to |
None
|
Returns:
| Type | Description |
|---|---|
ndarray
|
The concatenated representation of shape |