Visualize GSEA results
VizGSEA.Rd
Visualize GSEA results
Usage
VizGSEA(
gsea_results,
plot_type = c("summary", "gsea"),
gene_ranks = "@gene_ranks",
gene_sets = "@gene_sets",
gs = NULL,
...
)
Arguments
- gsea_results
A data frame with the results of the fgsea analysis
- plot_type
The type of plot to create One of "summary", "gsea"
- gene_ranks
A numeric vector of gene ranks with genes as names The gene ranks are used to plot the gene sets. If
gene_ranks
is a character vector starting with@
, the gene ranks will be taken from the attribute ofdata
.- gene_sets
A list of gene sets, typically from a record of a GMT file The names of the list should match the
ID
column ofdata
. Ifgene_sets
is a character vector starting with@
, the gene sets will be taken from the attribute ofdata
. The GSEA plots will be plotted for each gene set. So, the number of plots will be the number of gene sets. If you only want to plot a subset of gene sets, you can subset thegene_sets
before passing it to this function.- gs
The names of the gene sets to plot If
NULL
, all gene sets ingene_sets
will be plotted.- ...
Additional arguments passed to the plotting function
When
plot_type
is "summary", they are passed toplotthis::GSEASummaryPlot()
When
plot_type
is "gsea", they are passed toplotthis::GSEAPlot()
Examples
# \donttest{
set.seed(123)
exprs <- matrix(rnorm(1000), nrow = 100, ncol = 10)
colnames(exprs) <- paste0("Sample", 1:10)
rownames(exprs) <- paste0("Gene", 1:100)
classes <- c(rep("A", 5), rep("B", 5))
ranks <- RunGSEAPreRank(exprs, case = "A", control = "B", classes = classes)
genesets <- list(
set1 = c("Gene1", "Gene2", "Gene3"),
set2 = c("Gene4", "Gene5", "Gene6"),
set3 = c("Gene7", "Gene8", "Gene9"),
set4 = c("Gene10", "Gene11", "Gene12"),
set5 = c("Gene13", "Gene14", "Gene15"),
set6 = c("Gene16", "Gene17", "Gene18"),
set7 = c("Gene19", "Gene20", "Gene21"),
set8 = c("Gene22", "Gene23", "Gene24"),
set9 = c("Gene25", "Gene26", "Gene27"),
set10 = c("Gene12", "Gene86", "Gene87", "Gene83", "Gene71")
)
r <- RunGSEA(ranks, genesets)
# Visualize the GSEA results
VizGSEA(r, plot_type = "summary")
VizGSEA(r, plot_type = "gsea", gs = c("set10", "set2"))
# }