cellrefiner.tl.cluster_communication

cellrefiner.tl.cluster_communication(adata, cluster_key, signal, n_permutations=100, seed=0)[source]

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

Parameters:
  • adata (Anndata) – Anndata object, must contain cell-cell contact information in .obsp[contact_key] if sem is None.

  • cluster_key (str) – Key in .obs that contains cell type annotations

  • signal (str) – Key in .obsp that contains communication matrix

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

  • seed (int, default 0) – random seed

Returns:

add .uns[‘{cluster_key}-{signal}’], cluster-level communication via {signal}
  • .uns[‘{cluster_key}-{signal}’][‘communication_matrix’], cluster-level communication matrix

  • .uns[‘{cluster_key}-{signal}’][‘communication_pvalue’], p-values

Return type:

Sets the following fields in adata

Examples

>>> cr.tl.cluster_communication(adata,cluster_key = 'cell_type',signal = 'NOTCH')