rnalysis.enrichment.enrichment_bar_plot
- rnalysis.enrichment.enrichment_bar_plot(results_table_path: Union[str, Path], alpha: Fraction = 0.05, enrichment_score_column: Union[str, Literal['log2_fold_enrichment', 'log2_enrichment_score']] = 'log2_fold_enrichment', n_bars: Union[PositiveInt, Literal['all']] = 'all', title: str = 'Enrichment results', center_bars: bool = True, plot_horizontal: bool = True, ylabel: Union[str, Literal['$\\log_2$(Fold Enrichment)', '$\\log_2$(Enrichment Score)']] = '$\\log_2$(Fold Enrichment)', ylim: Union[float, Literal['auto']] = 'auto', plot_style: Literal['bar', 'lollipop'] = 'bar', show_expected: bool = False) 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=r"$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.
- Returns
Figure object containing the bar plot
- Return type
matplotlib.figure.Figure instance