run_bidirectional_fgsea_from_loadings | R Documentation |
This function performs a bidirectional Gene Set Enrichment Analysis (GSEA) using the fgsea package on a ranked gene loadings vector. It retrieves gene sets using msigdbr for a specified species and category, executes fgsea (either using fgseaMultilevel or fgsea based on the selected method), and optionally generates plots for the top enriched pathways.
run_bidirectional_fgsea_from_loadings(
loadings,
comp = 1,
topN = 6,
species = "Homo sapiens",
category = "H",
subcategory = NULL,
pvalueCutoff = 0.05,
doPlot = FALSE,
nperm = 1000,
method = "multilevel"
)
topN |
Integer specifying the number of top pathways to plot for each direction (default: 6). |
species |
Character string indicating the species for which to retrieve gene sets (default: "Homo sapiens"). |
category |
Character string representing the gene set category from msigdbr (default: "H"). |
pvalueCutoff |
Numeric value for the adjusted p-value cutoff to determine significant pathways (default: 0.05). |
doPlot |
Logical flag indicating whether to generate plots for the top pathways (default: FALSE). |
nperm |
Integer specifying the number of permutations for the fgsea function (default: 1000). |
method |
Character string specifying the fgsea method to use; "multilevel" for fgseaMultilevel, or any other value to use the standard fgsea function (default: "multilevel"). |
loadings_vector |
A named numeric vector of gene loadings. The names must correspond to gene symbols. |
A list containing:
A data frame with the full results from the GSEA analysis.
A data frame with significantly enriched pathways having positive Normalized Enrichment Scores (NES).
A data frame with significantly enriched pathways having negative NES.
## Not run:
# Create a named vector of gene loadings
loadings <- c(GeneA = 1.2, GeneB = -0.8, GeneC = 2.3)
# Run the bidirectional fgsea analysis
result <- run_bidirectional_fgsea_from_loadings(loadings)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.