metachat.pl.plot_communication_responseGenes_keggEnrich
- metachat.pl.plot_communication_responseGenes_keggEnrich(df_result, organism='Human', show_term_order=[0, 1, 2, 3, 4], cmap='green', maxshow_gene=5, figsize=(6, 6), ax=None, plot_savepath=None)[source]
Plot a horizontal bar chart summarizing KEGG enrichment results of MCC response genes.
This function visualizes the top enriched KEGG pathways identified from
mc.tl.communication_responseGenes(), with bar length representing -log10(p-value) and text annotations showing top associated genes.Parameters
- df_resultpandas.DataFrame
The KEGG enrichment results table returned by
mc.tl.communication_responseGenes().- organism{“Human”, “Mouse”}, default=”Human”
If set to
"Mouse", gene names are capitalized (first letter uppercase, rest lowercase).- show_term_orderlist of int, default=[0,1,2,3,4]
List of row indices (in
df_result) specifying which pathways to show and their order. IfNone, the top 5 terms will be displayed.- cmap{“green”, “blue”, “red”}, default=”green”
Color theme for the barplot.
- maxshow_geneint, default=10
Maximum number of genes to display under each pathway.
- figsizetuple of float, default=(6, 6)
Figure size (width, height).
- axmatplotlib.axes.Axes, optional
Existing Matplotlib axis to draw the barplot on. If
None, a new figure and axis are created.- plot_savepathstr, optional
File path to save the figure (e.g.,
"results/kegg_enrich.pdf"). The format is inferred from the file extension. IfNone, the plot is shown interactively.
Returns
- axmatplotlib.axes.Axes
Matplotlib axis containing the bar chart.
Notes
This visualization summarizes KEGG enrichment performed by
mc.tl.communication_responseGenes().Each bar represents one KEGG pathway, with its significance shown as -log10(p-value).
Up to
maxshow_genetop genes per pathway are displayed below the bar label.