run_bidirectional_enrichment | R Documentation |
This function performs gene set enrichment analysis for both positive and negative loadings
using the clusterProfiler
package with gene sets obtained via msigdbr
.
It extracts the top topN
genes in both directions for a specified component
and then uses enricher
for enrichment analysis. If any significant enrichment is detected
(based on the adjusted p-value cutoff), a dotplot is displayed.
run_bidirectional_enrichment(
loadings,
comp,
topN,
species = "Homo sapiens",
category = "H",
pvalueCutoff = 0.05,
doPlot = F
)
loadings |
A numeric matrix or data frame of gene loadings with genes as row names. Rows represent genes and columns represent different components. |
comp |
Numeric. The component number (row index) to analyze. |
topN |
Numeric. The number of top genes (from both positive and negative directions) to consider. |
species |
Character. The species to query from |
category |
Character. The gene set category to use (e.g., |
pvalueCutoff |
Numeric. The p-value cutoff to consider enrichment as significant. Default is 0.05. |
A list with two elements:
An object of class enrichResult
with enrichment results for positively loaded genes.
An object of class enrichResult
with enrichment results for negatively loaded genes.
## Not run:
# Assuming results$loadings[[1]] is a numeric matrix with gene symbols as row names:
loadings <- results$loadings[[1]]
enrichmentResults <- run_bidirectional_enrichment(loadings, comp = 2, topN = 100)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.