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:

AnnData

Returns:

An updated anndata object that are updated with the mnn or other relevant data that are calculated during mnn calculation.