rnalysis.enrichment.enrichment_bar_plotο
- rnalysis.enrichment.enrichment_bar_plot(results_table_path: str | Path, alpha: Fraction = 0.05, enrichment_score_column: str | Literal['log2_fold_enrichment', 'log2_enrichment_score'] = 'log2_fold_enrichment', n_bars: PositiveInt | Literal['all'] = 'all', title: str = 'Enrichment results', center_bars: bool = True, plot_horizontal: bool = True, ylabel: str | Literal['$\\log_2$(Fold Enrichment)', '$\\log_2$(Enrichment Score)'] = '$\\log_2$(Fold Enrichment)', ylim: float | Literal['auto'] = 'auto', plot_style: Literal['bar', 'lollipop'] = 'bar', show_expected: bool = False, title_fontsize: float = 18, label_fontsize: float = 13, ylabel_fontsize: float = 16) Figure ο
Generate an enrichment bar-plot based on an enrichment results table. For the clarity of display, complete depletion (linear enrichment = 0) appears with the smallest value in the scale.
- Parameters:
results_table_path (str or Path) β Path to the results table returned by enrichment functions.
alpha (float between 0 and 1 (default=0.05)) β the threshold for statistical significance. Used to draw significance asterisks on the graph.
enrichment_score_column (str (default='log2_fold_enrichment')) β name of the table column containing enrichment scores.
n_bars (int > 1 or 'all' (default='all')) β number of bars to display in the bar plot. If n_bars=βallβ, all the results will be displayed on the graph. Otherwise, only the top n results will be displayed on the graph.
title (str) β plot title.
plot_horizontal (bool (default=True)) β if True, results will be plotted with a horizontal bar plot. Otherwise, results will be plotted with a vertical plot.
ylabel (str (default="$log_2$(Fold Enrichment)")) β plot y-axis label.
center_bars (bool (default=True)) β if True, center the bars around Y=0. Otherwise, ylim is determined by min/max values.
ylim (float or 'auto' (default='auto')) β set the Y-axis limits. If ylim`=βautoβ, determines the axis limits automatically based on the data. If `ylim is a number, set the Y-axis limits to [-ylim, ylim].
plot_style ('bar' or 'lollipop' (default='bar')) β style for the plot. Either βbarβ for a bar plot or βlollipopβ for a lollipop plot in which the lollipop size indicates the size of the observed gene set.
show_expected (bool (default=False)) β if True, the observed/expected values will be shown on the plot.
title_fontsize (float (default=18)) β font size for the plot title.
label_fontsize (float (default=13)) β font size for the attribute labels on the plot.
ylabel_fontsize (float (default=16)) β font size for the y-axis colorbar label.
- Returns:
Figure object containing the bar plot
- Return type:
matplotlib.figure.Figure instance