SpatialQuery.spatial_query.plot_gene_pair_heatmap

spatial_query.plot_gene_pair_heatmap(gene_pair_df, figsize=(7, 5), save_path=None, title=None, cmap='GnBu')[source]

Plot a heatmap showing the cross-varying gene pairs and return cluster assignments.

Parameters:
  • gene_pair_df (pd.DataFrame) – Output DataFrame from compute_gene_gene_correlation or compute_gene_gene_correlation_by_type.

  • figsize (tuple, default=(7, 5)) – Figure size.

  • save_path (str, optional) – Path to save the figure. If None, the figure will not be saved.

  • title (str, optional) – Figure title. If None, will use a default title based on center cell type.

  • cmap (str, default='GnBu') – Colormap for the heatmap.

Returns:

Displays a biclustered heatmap of gene pairs and returns a DataFrame with cluster assignments. Columns: gene_center, gene_motif, combined_score, cluster_type, cluster_row, cluster_col. If input has ‘cell_type’ column, it will also be included.

Return type:

pd.DataFrame