umap
umap ¶
umap(
data,
layer="raw",
log=True,
nNeighbors=15,
nComponents=2,
metric="euclidean",
minDist=0.1,
randomState=0,
label="umap",
maxWorkers=None,
verbose=False,
outputDir=None,
streamData=False,
sdataTable=None,
**kwargs
)
Compute a UMAP embedding of the expression matrix.
Runs umap-learn over the matrix selected
by layer and writes the coordinates to obsm[label].
UMAP is stochastic. randomState is fixed at 0 by default, which makes runs
reproducible but forces single-threaded optimisation — umap-learn warns about
this. Pass randomState=None to get parallelism back at the cost of exact
reproducibility.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
(AnnData | SpatialData | str, required)
|
The cell table. An |
required |
layer
|
str
|
Which matrix to embed. |
'raw'
|
log
|
bool
|
Apply |
True
|
nNeighbors
|
int
|
UMAP's neighbourhood size. Small values emphasise local structure, large values the global shape. |
15
|
nComponents
|
int
|
Dimensions of the embedding. |
2
|
metric
|
str
|
Distance metric, passed to umap-learn. |
'euclidean'
|
minDist
|
float
|
How tightly points may pack together. Lower gives denser clusters. |
0.1
|
randomState
|
int
|
Seed. |
0
|
label
|
str
|
Key in |
'umap'
|
maxWorkers
|
int
|
Cap on parallel workers. Defaults to |
None
|
verbose
|
bool
|
Print progress messages. |
False
|
outputDir
|
str
|
Directory to write the updated object to. With |
None
|
streamData
|
bool
|
Run out of core against an |
False
|
sdataTable
|
str
|
Which |
None
|
**kwargs
|
dict
|
Forwarded to |
{}
|
Returns:
| Name | Type | Description |
|---|---|---|
adata |
AnnData | SpatialData | None
|
The updated object with |