monkeybread.calc.ligand_receptor_score_per_niche

monkeybread.calc.ligand_receptor_score_per_niche(adata, niche_to_cell_to_neighbors, lr_pairs=None)

Calculates an average co-expression score of a ligand-receptor pair between neighboring cells within each cellular niche calculated by monkeybread.calc.cellular_niches(). Statistical test is as described in [HBB+22] (See Figure 4). This function is a wrapper around monkeybread.calc.ligand_receptor_score() and calls this function separately for each niche.

Parameters:
  • adata (AnnData) – Annotated data matrix.

  • cell_to_neighbors – A mapping of cells to their neighbors, as calculated by monkeybread.calc.cell_neighbors().

  • lr_pairs (Union[Tuple[str, str], List[Tuple[str, str]], None] (default: None)) – One or multiple tuples corresponding to (ligand, receptor). If None then ligand/receptor pairs will be downloaded from Omnipath via the omnipath.interactions.import_intercell_network().

Return type:

Dict[str, Dict[Tuple[str, str], float]]

Returns:

: A dictionary mapping each niche to a sub-dictionary mapping each ligand-receptor pair to its co-expression score.