commot.tl.cluster_communication

commot.tl.cluster_communication(adata, database_name=None, pathway_name=None, lr_pair=None, clustering=None, n_permutations=100, random_seed=1, copy=False)

Summarize cell-cell communication to cluster-cluster communication and compute p-values by permutating cell/spot labels.

Parameters
  • adata (AnnData) – The data matrix of shape n_obs × n_var. Rows correspond to cells or positions and columns to genes.

  • database_name (Optional[str]) – Name of the ligand-receptor database. If both pathway_name and lr_pair are None, the cluster signaling through all ligand-receptor pairs is summarized.

  • pathway_name (Optional[str]) – Name of the signaling pathway. If given, the signaling through all ligand-receptor pairs of the given pathway is summarized.

  • lr_pair – A tuple of ligand-receptor pair. If given, only the cluster signaling through this pair is computed.

  • clustering (Optional[str]) – Name of clustering with the labels stored in .obs[clustering].

  • n_permutations (int) – Number of label permutations for computing the p-value.

  • random_seed (int) – The numpy random_seed for reproducible random permutations.

  • copy (bool) – Whether to return a copy of the anndata.AnnData.

Returns

adata – Add cluster-cluster communication matrix to .uns['commot_cluster-databaseX-clustering-ligA-recA'] for the ligand-receptor database named ‘databaseX’ and the cell clustering named ‘clustering’ through the ligand-receptor pair ‘ligA’ and ‘recA’. The first object is the communication score matrix and the second object contains the corresponding p-values. If copy=True, return the AnnData object and return None otherwise.

Return type

anndata.AnnData