monkeybread.plot.ligand_receptor_score_heatmap_per_niche

monkeybread.plot.ligand_receptor_score_heatmap_per_niche(niche_to_lr_to_score, lr_pairs=None, plot_niches=None, z_score=True, clip_z=2.0, show=True, **clustermap_kwargs)

Create a heatmap showing the ligand/receptor scores for a specific set of ligand/receptor pairs within each niche. The rows represent ligand/receptors and the columns represent niches. This function plots the data returned by monkeybread.calc.ligand_receptor_score_per_niche().

Parameters:
  • niche_to_lr_to_score (Dict[str, Dict[Tuple[str, str], float]]) – A dictionary mapping each niche to a sub-dictionary mapping each ligand/receptor (represented as a tuple) to its score in that niche. This data structure is returned by monkeybread.calc.ligand_receptor_score_per_niche()

  • lr_pairs (Optional[List[Tuple[str, str]]] (default: None)) – Specific set of ligand/receptor pairs to plot. If None, all ligand/receptor pairs in the niche_to_lr_to_score data structure will be plotted

  • plot_niches (Optional[List[str]] (default: None)) – Specific niches to plot. If None, all niches will be plotted

  • z_score (Optional[List[str]] (default: True)) – If True plot the z-score normalized ligand-receptor scores, where the scores are normalized for each ligand/receptor pairs accross all niches

  • clip_z (Optional[float] (default: 2.0)) – If z_score is True, this clips the plotted z-score values at +/- clip_z

  • show (Optional[bool] (default: True)) – If True, show the plot. If False return the ClusterGrid object output by seaborn.clustermap()

  • clustermap_kwargs – Arguments passed to seaborn.clustermap()

Return type:

Optional[ClusterGrid]

Returns:

: If show = True, returns nothing. Otherwise, returns the ClusterGrid object output by seaborn.clustermap()

Example

https://raw.githubusercontent.com/immunitastx/monkeybread/main/docs/_static/ligand_receptor_score_heatmap_per_niche.png