commot.tl.group_cell_communication

commot.tl.group_cell_communication(adata, keys=None, bin_method='gaussian_mixture', bin_append_zeros='full', bin_random_state=1, bin_cutoff=0, knn=2, dissimilarity_method='graphwave', kw_graphwave={'approximation': 100, 'heat_coefficient': 1.0, 'mechanism': 'approximation', 'sample_number': 200, 'seed': 42, 'step_size': 0.1, 'switch': 1000}, leiden_k=5, leiden_resolution=1.0, leiden_random_seed=1, leiden_n_iterations=- 1)

Idenfitify groups of cell-cell communication with similar pattern.

The cell-cell communication should have been computed by the function commot.tl.spatial_communication().

Parameters
  • adata (AnnData) – The data matrix with the cell-cell communication info stored in adata.obsp.

  • keys – A list of keys for the analyzed communication connections as strings. For example, the string 'databaseX-pathwayX' represents the CCC of signaling pathway “pathwayX” computed with the LR database “databaseX”. For another example, the string 'databaseX-ligA-recA' represents the CCC of the LR pair “ligA-recA” computed with the LR database “databaseX”. The cell-level CCC networks corresponding to the above examples are stored in .obsp['commot-databaseX-pathwayX] and .obsp['commot-databaseX-ligA-recA'].

  • bin_method (str) – Method for binarize communication connections. Choices: ‘gaussian_mixture’, ‘kmeans’.

  • bin_append_zeros (str) – Number of zeros to append to the non-zero entries when running the binarization. ‘full’ use the full flattened cell-by-cell communication matrix. ‘match’ append the same number of zeros to the vector of non-zero entries.

  • bin_random_state (int) – The random seed for binarization methods.

  • bin_cutoff (float) – Force all connections with a weight smaller than or equal to bin_cutoff to be zero , regardless of binarization result.

  • knn (int) – Number of neighbors for building the spatial knn graph.

  • dissimilarity_method (str) – The method for quantifying dissimilarity. ‘graphwave’, node structural embedding by GraphWave [Donnat2018] implemented in Karate Club.

  • kw_graphwave (dict) –

    Keywords for GraphWave. Defaults: {‘sample_number’:200, ‘step_size’:0.1, ‘heat_coefficient’: 1.0, ‘approximation’:100, ‘mechanism’:’approximation’, ‘switch’:1000, ‘seed’:42} See details at Karate Club.

  • leiden_k (int) – Number of neighbors for the knn-graph to be fed to leiden clustering algorithm.

  • leiden_resolution (float) – The resolution parameter for the leiden clustering algorithm.

  • leiden_random_seed (int) – The random seed for the leiden clustering algorithm.

  • leiden_n_iterations (int) – The maximum number of iterations for the leiden algorithm. The algorithm will run until convergence if set to -1.

Returns

  • communication_clusterid (np.ndarray) – The group id of the cell-cell communications.

  • D (np.ndarray) – The dissimilarity matrix for the cell-cell communications.

References

Donnat2018

Donnat, C., Zitnik, M., Hallac, D., & Leskovec, J. (2018, July). Learning structural node embeddings via diffusion wavelets. In Proceedings of the 24th ACM SIGKDD International Conference on Knowledge Discovery & Data Mining (pp. 1320-1329).