plotFoldEnrichment {diffEnrich} | R Documentation |
This function uses the results generated using diffEnrich
to generate a bar plot describing the fold enrichment of a set of given KEGG
pathways stratified by their enrichment in list 1 or list 2. Users can plot
all pathways based on the adjusted p-value threshold used in diffEnrich
and the top N pathways sorted by the adjusted p-value threshold used in diffEnrich
.
plotFoldEnrich
returns a ggplot2 object so users can add additional
customizations.
plotFoldEnrichment(de_res, pval, N)
de_res |
Dataframe. Generated using |
pval |
Numeric. Threshold for filtering pathways based on adjusted pvalue in de_res |
N |
Numeric. Number of top pathways to plot after filtering based on pval |
This function generates a grouped bar plot using ggplot2 and the ggnewscale package. KEGG pathways are plotted on the y-axis and fold enrichment is plotted on the x-axis. each KEGG pathway has a bar plotting its fold enrichment in list 1 (red) and its fold enrichment in list 2 (blue). The transparency of the bars correspond to the adjusted p-value for the pathway's enrichment in the given list. The p-value presented as text to the right of each pair of bars is the adjusted p-value associated with the differential enrichment of the pathway between the two lists, and the pathways are ordered from top to bottom by this p-value (i.e. smallest p-value on top of plot, and largest p-value on bottom of plot).
ggplot object. If the user calls plotFoldEnrich
and
assigns it to an object (see example) then no plot will print in viewer,
but if plotFoldEnrich
is called without being assigned to an
object the plot will print to the viewer. Users can edit the ggplot object
as they would any other ggplot object (e.g. add title, theme, etc.).
## Not run:
plot <- plotFoldEnrichment(de_res = diff_enrich, pval = 0.05, N = 5)
## End(Not run)