commot.tl.communication_direction

commot.tl.communication_direction(adata, database_name=None, pathway_name=None, lr_pair=None, k=5, pos_idx=None, copy=False)

Construct spatial vector fields for inferred communication.

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

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

  • pathway_name (Optional[str]) – Name of the signaling pathway. If given, only the signaling direction of this signaling pathway is computed.

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

  • k (int) – Top k senders or receivers to consider when determining the direction.

  • pos_idx (Optional[ndarray]) – The columns in .obsm['spatial'] to use. If None, all columns are used. For example, to use just the first and third columns, set pos_idx to numpy.array([0,2],int).

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

Returns

adata – Vector fields describing signaling directions are added to .obsm, e.g., for a database named “databaseX”, .obsm['commot_sender_vf-databaseX-ligA-recA'] and .obsm['commot_receiver_vf-databaseX-ligA-recA'] describe the signaling directions of the cells as, respectively, senders and receivers through the ligand-receptor pair ligA and recA. If copy=True, return the AnnData object and return None otherwise.

Return type

anndata.AnnData