dynamo.tl.mnn
- dynamo.tl.mnn(adata, n_pca_components=30, n_neighbors=250, layers='all', use_pca_fit=True, save_all_to_adata=False)[source]
Calculate mutual nearest neighbor graph across specific data layers.
- Parameters:
adata (
AnnData
) – an AnnData object.n_pca_components (
int
) – the number of PCA components. Defaults to 30.n_neighbors (
int
) – the number of nearest neighbors to compute for each sample. Defaults to 250.layers (
Union
[str
,List
[str
]]) – the layer(s) to be normalized. When set to ‘all’, it will include RNA (X, raw) or spliced, unspliced, protein, etc. Defaults to “all”.use_pca_fit (
bool
) – whether to use the precomputed pca model to transform different data layers or calculate pca for each data layer separately. Defaults to True.save_all_to_adata (
bool
) – whether to save_fig all calculated data to adata object. Defaults to False.
- Raises:
Exception – no PCA fit result in .uns.
- Return type:
- Returns:
An updated anndata object that are updated with the mnn or other relevant data that are calculated during mnn calculation.