
Gene Set Enrichment Analysis (GSEA) is a computational method that determines whether an a priori defined set of genes shows statistically significant, concordant differences between two biological states (e.g. phenotypes).
plotGSEA(
gsea_list,
plot_type = c("volcano", "classic", "fgsea", "ridge", "bar"),
stats_metric = c("p.adjust", "pvalue", "qvalue"),
show_pathway = NULL,
show_gene = NULL,
colour = NULL,
wrap_length = NULL,
label_by = c("id", "description"),
...
)
A ggplot object
GSEA result from `genGSEA` function
GSEA plot type, one of 'volcano', 'classic', 'fgsea', 'ridge' or 'bar'.
Statistic metric from one of "pvalue", "p.adjust", "qvalue".
Select plotting pathways by number (will choose top N pathways) or pathway name (choose from ID column).
Select genes to show. Default is "all". Used in "classic" plot.
Colour vector. Deafault is NULL. Used in volcano, ridge and bar plot.
Numeric, wrap text if longer than this length. Default is NULL.
Select which column as the label. If user wants to modify labels in plot, please modify the "Description" column and set the argument as "description". Default is by 'id'.
other arguments transfer to `plot_theme` function
# \donttest{
k1 = requireNamespace("cowplot",quietly = TRUE)
k2 = requireNamespace("fgsea",quietly = TRUE)
k3 = requireNamespace("ggplotify",quietly = TRUE)
k4 = requireNamespace("ggridges",quietly = TRUE)
if(k1&k2&k3&k4){
library(ggplot2)
## get GSEA result
data(geneList, package = "genekitr")
gs <- geneset::getMsigdb(org = "human",category = "H")
gse <- genGSEA(genelist = geneList, geneset = gs)
## volcano plot
# get top3 of up and down pathways
plotGSEA(gse, plot_type = "volcano", show_pathway = 3)
# choose pathway by character
pathways <- c('HALLMARK_KRAS_SIGNALING_UP','HALLMARK_P53_PATHWAY','HALLMARK_GLYCOLYSIS')
plotGSEA(gse, plot_type = "volcano", show_pathway = pathways)
## classic pathway plot
genes <- c('ENG','TP53','MET')
plotGSEA(gse, plot_type = "classic", show_pathway = pathways, show_gene = genes)
## fgsea table plot
plotGSEA(gse, plot_type = "fgsea", show_pathway = 3)
## ridgeplot
plotGSEA(gse,
plot_type = "ridge",
show_pathway = 10, stats_metric = "p.adjust"
)
## two-side barplot
plotGSEA(gse,
plot_type = "bar", main_text_size = 8,
colour = c("navyblue", "orange")
)
}
# }
Run the code above in your browser using DataLab