dynamo.tl.infomap(adata, use_weight=True, adj_matrix=None, adj_matrix_key=None, result_key=None, layer=None, obsm_key=None, selected_cluster_subset=None, selected_cell_subset=None, directed=False, copy=False, **kwargs)[source]

Apply infomap community detection algorithm to cluster adata.

For other community detection general parameters, please refer to dynamo’s tl.cluster_community function. “Infomap is based on ideas of information theory. The algorithm uses the probability flow of random walks on a network as a proxy for information flows in the real system and it decomposes the network into modules by compressing a description of the probability flow.” - cdlib

  • adata (AnnData) – an AnnData object.

  • use_weight (bool) – whether to use graph weight or not. False means to use connectivities only (0/1 integer values). Defaults to True.

  • adj_matrix (Union[ndarray, csr_matrix, None]) – adj_matrix used for clustering. Defaults to None.

  • adj_matrix_key (Optional[str]) – the key for adj_matrix stored in adata.obsp. Defaults to None.

  • result_key (Optional[str]) – the key where the results will be stored in obs. Defaults to None.

  • layer (Optional[str]) – the adata layer on which cluster algorithms will work. Defaults to None.

  • obsm_key (Optional[str]) – the key in obsm corresponding to the data that would be used for finding neighbors. Defaults to None.

  • selected_cluster_subset (Optional[Tuple[str, str]]) – a tuple of (cluster_key, allowed_clusters).Filtering cells in adata based on cluster_key in adata.obs and only reserve cells in the allowed clusters. Defaults to None.

  • selected_cell_subset (Union[List[int], List[str], None]) – a subset of cells in adata that would be clustered. Could be a list of indices or a list of cell names. Defaults to None.

  • directed (bool) – whether the edges in the graph should be directed. Defaults to False.

  • copy (bool) – whether to return a new updated AnnData object or updated the original one inplace. Defaults to False.

Return type:



An updated AnnData object if copy is set to be true.