msmu.tl.umap
Calculate UMAP embedding for a given modality in MuData object.
References
McInnes, L., Healy, J., & Melville, J. (2018). UMAP: Uniform Manifold Approximation and Projection for Dimension Reduction. arXiv preprint arXiv:1802.03426.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
mdata
|
MuData
|
MuData object containing the data. |
required |
modality
|
str
|
The modality to perform UMAP on. |
required |
n_components
|
int
|
The dimension of the space to embed into. This defaults to 2 to provide easy visualization, but can reasonably be set to any integer value in the range 2 to 100. |
2
|
n_neighbors
|
int | None
|
The size of local neighborhood (in terms of number of neighboring sample points) used for manifold approximation. Larger values result in more global views of the manifold, while smaller values result in more local data being preserved. In general values should be in the range 2 to 100. |
15
|
layer
|
str | None
|
Layer to use for quantification aggregation. If None, the default layer (.X) will be used. Defaults to None. |
None
|
metric
|
str
|
The metric to use to compute distances in high dimensional space. If a string is passed it must match a valid predefined metric. If a general metric is required a function that takes two 1d arrays and returns a float can be provided. For performance purposes it is required that this be a numba jit'd function. Valid string metrics include:
Metrics that take arguments (such as minkowski, mahalanobis etc.) can have arguments passed via the metric_kwds dictionary. At this time care must be taken and dictionary elements must be ordered appropriately; this will hopefully be fixed in the future. |
'euclidean'
|
init
|
str
|
How to initialize the low dimensional embedding. Options are:
|
'random'
|
min_dist
|
float
|
The effective minimum distance between embedded points. Smaller values
will result in a more clustered/clumped embedding where nearby points
on the manifold are drawn closer together, while larger values will
result on a more even dispersal of points. The value should be set
relative to the |
0.1
|
random_state
|
int | None
|
RandomState instance or None, optional (default: None)
If int, random_state is the seed used by the random number generator;
If RandomState instance, random_state is the random number generator;
If None, the random number generator is the RandomState instance used
by |
None
|
key_added
|
str
|
Base key used for UMAP outputs. Results are stored in:
- |
'X_umap'
|
**kwargs
|
Any
|
Additional keyword arguments passed to UMAP constructor. |
{}
|
Returns:
| Type | Description |
|---|---|
MuData
|
Updated MuData object with UMAP results. |