This function is used to create a ggplot2 bubble chart displaying the enrichment results.

enrichment_chart(
  result_df,
  top_terms = 10,
  plot_by_cluster = FALSE,
  num_bubbles = 4,
  even_breaks = TRUE
)

Arguments

result_df

a data frame that must contain the following columns:

Term_Description

Description of the enriched term

Fold_Enrichment

Fold enrichment value for the enriched term

lowest_p

the lowest adjusted-p value of the given term over all iterations

Up_regulated

the up-regulated genes in the input involved in the given term's gene set, comma-separated

Down_regulated

the down-regulated genes in the input involved in the given term's gene set, comma-separated

Cluster(OPTIONAL)

the cluster to which the enriched term is assigned

top_terms

number of top terms (according to the 'lowest_p' column) to plot (default = 10). If plot_by_cluster = TRUE, selects the top top_terms terms per each cluster. Set top_terms = NULL to plot for all terms.If the total number of terms is less than top_terms, all terms are plotted.

plot_by_cluster

boolean value indicating whether or not to group the enriched terms by cluster (works if result_df contains a 'Cluster' column).

num_bubbles

number of sizes displayed in the legend # genes (Default = 4)

even_breaks

whether or not to set even breaks for the number of sizes displayed in the legend # genes. If TRUE (default), sets equal breaks and the number of displayed bubbles may be different than the number set by num_bubbles. If the exact number set by num_bubbles is required, set this argument to FALSE

Value

a ggplot2 object containing the bubble chart. The x-axis corresponds to fold enrichment values while the y-axis indicates the enriched terms. Size of the bubble indicates the number of significant genes in the given enriched term. Color indicates the -log10(lowest-p) value. The closer the color is to red, the more significant the enrichment is. Optionally, if 'Cluster' is a column of result_df and plot_by_cluster == TRUE, the enriched terms are grouped by clusters.

Examples

g <- enrichment_chart(example_pathfindR_output)
#> Plotting the enrichment bubble chart