gedi2py.tools.umap¶
- gedi2py.tools.umap(adata, *, n_neighbors=15, min_dist=0.1, n_components=2, metric='euclidean', input_key='pca', key='gedi', key_added=None, random_state=None, copy=False)[source]¶
Compute UMAP embedding from GEDI results.
- Parameters:
adata (
AnnData) – Annotated data matrix with GEDI results.n_neighbors (
int, default:15) – Size of local neighborhood for UMAP.min_dist (
float, default:0.1) – Minimum distance between points in the embedding.n_components (
int, default:2) – Dimensionality of the UMAP embedding.metric (
str, default:'euclidean') – Distance metric for neighbor search.input_key (
Literal['pca','db','zdb'], default:'pca') – Which GEDI representation to use as input: -"pca": PCA coordinates (default) -"db": DB latent factor embedding -"zdb": ZDB shared manifold projectionkey (
str, default:'gedi') – Key inadata.unswhere GEDI results are stored.key_added (
str|None, default:None) – Key to store UMAP inadata.obsm. Defaults toX_{key}_umap.random_state (
int|None, default:None) – Random seed for reproducibility. IfNone, usessettings.random_state.copy (
bool, default:False) – IfTrue, return UMAP coordinates instead of storing inadata.
- Return type:
- Returns:
If ``copy=True``,returns UMAP coordinates as numpy array (n_cells,n_components).Otherwise,stores in ``adata.obsm[key_added]``andreturns ``None`.`
Examples
>>> import gedi2py as gd >>> gd.tl.gedi(adata, batch_key="sample", n_latent=10) >>> gd.tl.umap(adata, n_neighbors=30) >>> gd.pl.embedding(adata, basis="X_gedi_umap", color="cell_type")