DO Bar plot for GSEA df result
DO.SplitBarGSEA.Rd
This function generates a split barplot. This is a plot where the top 10 Go terms are shown, sorted based on a column ('col_split'). Two conditions are shown at the same time. One condition is shown in the positive axis, while the other in the negative one. The condition to be shown as positive is set with 'pos_col'.
The GO terms will be shown inside the bars, if the term is too long, using 'cutoff', you can control the maximum number of characters per line.
Pre-filter of the dataframe to contain significant Terms is recommended
Usage
DO.SplitBarGSEA(
df_GSEA,
term_col,
col_split,
cond_col,
pos_cond,
cutoff = 40,
log10_transform = TRUE,
figsize = c(12, 8),
topN = 10,
colors_pairs = c("sandybrown", "royalblue"),
alpha_colors = 0.3,
path = NULL,
spacing = 5,
txt_size = 12,
filename = "SplitBar.svg",
title = "Top 10 GO Terms in each Condition: ",
showP = F,
celltype = "all"
)
Arguments
- df_GSEA
dataframe with the results of a gene set enrichment analysis
- term_col
column in the dataframe that contains the terms
- col_split:
column in the dataframe that will be used to sort and split the plot
- cond_col:
column in the dataframe that contains the condition information
- pos_cond:
condition that will be shown in the positive side of the plot
- cutoff:
maximum number of characters per line
- log10_transform:
if col_split contains values between 0 and 1, assume they are pvals and apply a -log10 transformation
- figsize:
figure size
- topN:
how many terms are shown
- path:
path to save the plot
- filename:
filename for the plot
- spacing:
space to add between bars and origin. It is a percentage value, indicating that the bars start at 5 % of the maximum X axis value.
- txt_size:
size of the go terms text
- alpha_colors:
alpha value for the colors of the bars
- colors_pairs:
colors for each condition (1st color –> negative axis; 2nd color –> positive axis)
- title:
title of the plot
- showP:
if False, the axis is return
Examples
if (FALSE) { # \dontrun{
#df with GSEA results e.g. Metascape results
df_GSEA <- read.csv("path/to/GSEA_results.csv")
#Please add a 'celltype' and 'condition' column
head(df_GSEA)
#Columns should include: "Term", "Combined.Score", "conditon", "celltype", etc.
#Run SplitBarGSEA visualization
DO.SplitBarGSEA(df_GSEA = df_GSEA,
term_col = "Term",
col_split = "Combined.Score",
cond_col = "condition", # condition column (e.g., experimental group)
pos_cond = "Treatment",
cutoff = 40, # max term length before truncation
log10_transform = TRUE,
figsize = c(12, 8),
topN = 10, # top N GO terms to show
color_pairs = c("sandybrown", "royalblue"),
alpha_colors = 0.3,
path = "results/plots",
spacing = 5,
txt_size = 12,
filename = "SplitBar.svg",
title = "Top 10 GO Terms in each Condition: ",
showP = FALSE,
celltype = "all")
} # }