Gene Set Enrichment Analysis in R: A Practical Tutorial for Interpreting Omics Data
Gene set enrichment analysis (GSEA) is a computational method that determines whether predefined sets of genes show statistically significant, concordant differences between two biological states. This tutorial provides a hands-on workflow for performing GSEA in R using the clusterProfiler and fgsea packages, with practical guidance on data preparation, execution, visualization, and interpretation. The target audience includes students, researchers, analysts, and life-science professionals who work with transcriptomic or other omics data and need to move beyond single-gene differential expression results to pathway-level biological insights.
Understanding Gene Set Enrichment Analysis
What GSEA Answers That Differential Expression Cannot
Standard differential expression analysis produces lists of individual genes with fold changes and p-values. Researchers often face the challenge of interpreting hundreds or thousands of changed genes. GSEA addresses this by evaluating whether known biological pathways, functional categories, or curated gene sets are enriched at the top or bottom of a ranked gene list. Instead of asking which single genes differ, GSEA asks which coordinated biological programs are activated or suppressed.
The method works by ranking all measured genes according to a statistic such as fold change, signal-to-noise ratio, or correlation with a phenotype. It then walks down the ranked list and calculates an enrichment score that reflects whether members of a given gene set cluster at the top, bottom, or are distributed randomly. A permutation-based procedure estimates statistical significance while controlling for the size of the gene set and the correlation structure among genes.
Core Concepts and Terminology
An enrichment score represents the degree to which a gene set is overrepresented at the extremes of the ranked list. A normalized enrichment score adjusts for gene set size and enables comparison across gene sets. The false discovery rate q-value estimates the probability that a given enrichment result represents a false positive after accounting for multiple testing.
The ranked gene list is the central input. The ranking metric determines the biological question. Ranking by log2 fold change identifies pathways differentially activated between conditions. Ranking by correlation with a continuous phenotype identifies pathways associated with that phenotype. Ranking by test statistics from a regression model allows adjustment for covariates.
Gene set databases provide the collections of genes to test. The Molecular Signatures Database offers curated gene sets, motif gene sets, and computational gene sets. Gene Ontology terms provide functional annotations for biological process, molecular function, and cellular component. KEGG pathways represent metabolic and signaling pathways. Reactome provides curated pathway annotations.
Preparing Data for GSEA
Required Input Formats
The clusterProfiler package accepts several input formats. The most common is a named numeric vector where names are gene identifiers and values are the ranking metric. The fgsea package requires the same structure. Both packages can also work with a data frame containing gene identifiers and ranking values.
Gene identifiers must match the identifiers used in the gene set database. If your expression data uses Entrez IDs, you need gene sets annotated with Entrez IDs. If your data uses Ensembl IDs or gene symbols, you must either convert identifiers or use a gene set database with matching annotation. Mismatched identifiers represent one of the most frequent causes of failed analyses.
## Example: creating a ranked gene list from DESeq2 results
library(DESeq2)
library(clusterProfiler)
## Assume res is a DESeq2 results object
ranked_genes <- res$stat
names(ranked_genes) <- rownames(res)
ranked_genes <- sort(ranked_genes, decreasing = TRUE)
Ranking Metrics and Their Biological Meaning
The choice of ranking metric changes the interpretation of results. Using the Wald statistic from DESeq2 accounts for both the magnitude of change and its precision. Using log2 fold change alone emphasizes magnitude but ignores variability. Using a moderated t-statistic from limma provides a balance between effect size and statistical reliability.
For studies with a continuous phenotype such as drug response or disease severity, ranking by correlation coefficient identifies gene sets whose expression tracks with the phenotype. For survival analysis, ranking by Cox regression coefficients identifies pathways associated with survival outcomes.
The ranking metric should be selected before analysis and documented in the methods section of any report. Changing the metric after seeing results introduces selection bias and undermines the validity of the analysis.
Gene Identifier Conversion
When gene identifiers do not match between expression data and gene set databases, conversion is required. The biomaRt package queries Ensembl for identifier mapping. The AnnotationDbi packages provide organism-specific mappings. The clusterProfiler package includes the bitr function for identifier conversion.
## Converting gene symbols to Entrez IDs
library(org.Hs.eg.db)
converted <- bitr(names(ranked_genes),
fromType = "SYMBOL",
toType = "ENTREZID",
OrgDb = org.Hs.eg.db)
Identifier conversion can fail for genes with outdated symbols, genes removed from reference genomes, or genes with ambiguous mappings. The proportion of successfully mapped genes should be reported. Low mapping rates indicate a problem with identifier format or database version.
Running GSEA with clusterProfiler
Basic Workflow
The clusterProfiler package provides the gseKEGG, gseGO, and gsePathway functions for different gene set collections. The core arguments include the ranked gene list, the organism or gene set database, the minimum and maximum gene set sizes, and the permutation count.
## KEGG pathway enrichment
kegg_gsea <- gseKEGG(geneList = ranked_genes,
organism = "hsa",
minGSSize = 10,
maxGSSize = 500,
pvalueCutoff = 0.05,
verbose = FALSE)
## Gene Ontology enrichment
go_gsea <- gseGO(geneList = ranked_genes,
OrgDb = org.Hs.eg.db,
ont = "BP",
minGSSize = 10,
maxGSSize = 500,
pvalueCutoff = 0.05)
The minimum and maximum gene set size parameters control which gene sets are tested. Very small gene sets produce unstable enrichment scores. Very large gene sets often represent broad categories with limited interpretive value. Common practice sets the minimum at 10 to 15 genes and the maximum at 500 genes.
Interpreting the Output Object
The result object contains one row per gene set with columns for the enrichment score, normalized enrichment score, p-value, adjusted p-value, and the genes that contribute to the enrichment. The leading edge genes are those that appear before the maximum enrichment score in the ranked list and drive the enrichment signal.
## Viewing results as a data frame
kegg_results <- as.data.frame(kegg_gsea)
head(kegg_results[, c("ID", "Description", "NES", "pvalue", "p.adjust")])
Positive normalized enrichment scores indicate gene sets enriched at the top of the ranked list, meaning up-regulated in the experimental condition. Negative scores indicate enrichment at the bottom, meaning down-regulated.
Running GSEA with fgsea
Fast Preranked Analysis
The fgsea package implements a fast algorithm for preranked GSEA that is particularly useful for large datasets and many gene set collections. It requires a named ranked vector and a list of gene sets.
library(fgsea)
## Gene sets as a list of character vectors
pathways <- gmtPathways("c2.cp.kegg.v2023.1.Hs.entrez.gmt")
fgsea_results <- fgsea(pathways = pathways,
stats = ranked_genes,
minSize = 10,
maxSize = 500,
nperm = 10000)
The fgsea package returns a data table with columns for pathway name, p-value, adjusted p-value, enrichment score, normalized enrichment score, and leading edge genes. The nperm argument controls the number of permutations used to estimate significance. Higher values produce more stable p-values at the cost of computation time.
Comparison with clusterProfiler
Both packages implement the same underlying GSEA algorithm but differ in convenience features. clusterProfiler provides built-in access to KEGG, GO, and Reactome databases with automatic identifier handling. fgsea offers faster computation and more flexible gene set input through GMT files or custom lists.
The choice between packages often depends on the gene set database and the scale of the analysis. For standard KEGG or GO analysis with modest data sizes, clusterProfiler provides a streamlined workflow. For large-scale analyses testing thousands of gene sets or for custom gene set collections, fgsea offers speed advantages.
Visualizing GSEA Results
Enrichment Plots
The enrichment plot displays the running enrichment score across the ranked gene list. The top panel shows the ranked list with gene set members indicated by vertical bars. The bottom panel shows the enrichment score curve. The peak of the curve indicates where the gene set is most enriched.
## Enrichment plot for a specific gene set
gseaplot2(kegg_gsea, geneSetID = 1, title = "Top enriched pathway")
The fgsea package provides the plotEnrichment function for the same purpose. These plots are essential for verifying that enrichment signals are driven by a coherent group of genes instead of a few outliers.
Dot Plots and Bar Plots
Dot plots display the normalized enrichment score, adjusted p-value, and gene count for multiple gene sets simultaneously. The size of the dot represents gene count, and the color represents the adjusted p-value. Bar plots provide a simpler view of the top enriched gene sets.
## Dot plot of top enriched pathways
dotplot(kegg_gsea, showCategory = 15)
Heatmaps of Leading Edge Genes
Heatmaps showing the expression of leading edge genes across samples provide a direct view of the biological signal. The pheatmap or ComplexHeatmap packages can generate these visualizations. The leading edge genes from the GSEA result are extracted and their expression values plotted.
## Extract leading edge genes
leading_edge <- kegg_gsea@result$core_enrichment[1]
genes <- unlist(strsplit(leading_edge, "/"))
## Subset expression matrix and plot
library(pheatmap)
pheatmap(expr_matrix[genes, ], scale = "row")
At a Glance
| Analysis Step | Recommended Tool | Key Input | Primary Output | Common Error |
|---|---|---|---|---|
| Identifier conversion | bitr from clusterProfiler | Gene symbols or Ensembl IDs | Entrez IDs matching gene set database | Low mapping rate from format mismatch |
| Ranking genes | DESeq2 or limma statistics | Count matrix or expression matrix | Named sorted numeric vector | Ranking by raw fold change without variance adjustment |
| Pathway enrichment | gseKEGG or gseGO | Ranked gene list | Enrichment scores with adjusted p-values | Gene set size filters too restrictive or permissive |
| Fast preranked analysis | fgsea | Ranked gene list and GMT file | Data table with NES and p-values | Duplicate gene names in ranked vector |
| Visualization | gseaplot2 or plotEnrichment | GSEA result object | Enrichment curve plot | Plotting without checking leading edge composition |
| Reporting | R Markdown or Jupyter notebook | All result objects and plots | Reproducible analysis document | Missing parameter documentation |
Practical Workflow for a Complete Analysis
Step 1: Load Required Packages and Data
Start with a clean R session and load the packages needed for the analysis. The exact packages depend on the input data format and the gene set databases selected.
library(clusterProfiler)
library(fgsea)
library(org.Hs.eg.db)
library(DESeq2)
library(ggplot2)
Step 2: Generate or Load the Ranked Gene List
If starting from raw count data, perform differential expression analysis first. If starting from a precomputed results table, load it and extract the ranking statistic.
## From DESeq2 results
dds <- DESeqDataSetFromMatrix(countData = counts,
colData = metadata,
design = ~ condition)
dds <- DESeq(dds)
res <- results(dds, contrast = c("condition", "treated", "control"))
## Create ranked list
ranks <- res$stat
names(ranks) <- rownames(res)
ranks <- sort(ranks, decreasing = TRUE)
Step 3: Remove Duplicate and Missing Identifiers
Duplicate gene identifiers cause errors in both clusterProfiler and fgsea. Missing values in the ranking statistic produce warnings and unstable results.
## Remove NA values
ranks <- ranks[!is.na(ranks)]
## Remove duplicate identifiers keeping the first occurrence
ranks <- ranks[!duplicated(names(ranks))]
Step 4: Run Enrichment Analysis
Select the gene set database appropriate for the biological question. KEGG pathways suit metabolic and signaling questions. Gene Ontology biological process terms suit functional categorization questions. Reactome pathways provide detailed curated annotations.
## KEGG analysis
kegg_gsea <- gseKEGG(geneList = ranks,
organism = "hsa",
minGSSize = 10,
maxGSSize = 500,
pvalueCutoff = 0.05,
verbose = FALSE)
## GO biological process analysis
go_gsea <- gseGO(geneList = ranks,
OrgDb = org.Hs.eg.db,
ont = "BP",
minGSSize = 10,
maxGSSize = 500,
pvalueCutoff = 0.05)
Step 5: Examine and Filter Results
Inspect the number of significant gene sets and the distribution of normalized enrichment scores. Filter results by adjusted p-value and consider the magnitude of the normalized enrichment score.
## Summary of significant results
summary(kegg_gsea)
## Filter by adjusted p-value
significant <- kegg_gsea@result[kegg_gsea@result$p.adjust < 0.05, ]
Step 6: Generate Visualizations
Create enrichment plots for the top gene sets, dot plots for an overview, and heatmaps for leading edge genes. Save all figures with sufficient resolution for publication.
Step 7: Document Parameters and Results
Record the R version, package versions, gene set database versions, ranking metric, and all parameters used. This documentation supports reproducibility and allows others to evaluate the analysis.
Options and Tradeoffs in GSEA Implementation
Gene Set Database Selection
The choice of gene set database shapes the biological interpretation. KEGG pathways provide well-curated metabolic and signaling pathways but have limited coverage of some biological processes. Gene Ontology terms provide comprehensive functional annotation but include many redundant and overlapping terms. Reactome offers detailed pathway hierarchies with less redundancy.
The Molecular Signatures Database provides collections such as Hallmark gene sets that consolidate redundant pathways into coherent biological themes. Hallmark gene sets are often preferred for initial exploration because they reduce multiple testing burden and produce interpretable results.
Permutation Strategy
GSEA can estimate significance by permuting phenotype labels or by permuting gene labels. Phenotype permutation preserves the correlation structure among genes and is the recommended approach. Gene label permutation assumes genes are independent, which violates the biological reality of coordinated gene expression.
The number of permutations affects the precision of p-value estimates. Low permutation counts produce discrete p-values that limit resolution near significance thresholds. The fgsea package uses an adaptive algorithm that performs more permutations for gene sets near the significance threshold.
Multiple Testing Correction
GSEA tests hundreds or thousands of gene sets simultaneously. The Benjamini-Hochberg procedure controls the false discovery rate and is the standard approach. The adjusted p-value represents the expected proportion of false positives among gene sets called significant.
The choice of significance threshold depends on the exploratory or confirmatory nature of the analysis. Exploratory analyses may use adjusted p-value thresholds of 0.05 or 0.1. Confirmatory analyses with predefined hypotheses may apply stricter thresholds.
Records and Measurements for Reproducible Analysis
Session Information and Version Control
Record the R version, Bioconductor version, and package versions at the time of analysis. The sessionInfo function provides this information. Store the analysis script in a version control system such as Git to track changes over time.
sessionInfo()
Parameter Documentation
Document every parameter that affects results, including the ranking metric, gene set database and version, minimum and maximum gene set sizes, permutation count, and significance thresholds. This documentation allows others to reproduce the analysis and assess its validity.
Output File Organization
Save the ranked gene list, GSEA result objects, and visualization files in a structured directory. Use descriptive file names that include the analysis date and key parameters. The FAIR Guiding Principles emphasize that research outputs should be findable, accessible, interoperable, and reusable, which applies to bioinformatics analysis outputs as well as primary data [4].
Common Failure Patterns and Troubleshooting
Identifier Mismatch Between Data and Gene Sets
The most common cause of failed GSEA is mismatched gene identifiers. Symptoms include zero gene sets tested, very low gene set coverage, or errors about missing genes. Check that the identifiers in the ranked list match the identifiers in the gene set database. Convert identifiers if needed and verify the conversion rate.
Duplicate Gene Names in the Ranked List
Duplicate identifiers cause fgsea to fail with an error about ties. clusterProfiler may produce unexpected results. Remove duplicates before running the analysis, keeping the entry with the highest absolute statistic or the first occurrence.
Ranking Metric with Many Ties
A ranking metric with many tied values reduces the resolution of the ranked list and can produce unstable enrichment scores. This situation occurs with count data that has not been properly normalized or with statistics that take only a few discrete values. Use a continuous statistic such as the Wald statistic or moderated t-statistic instead of raw fold change.
Gene Set Size Filters Excluding Relevant Pathways
Setting the minimum gene set size too high excludes small but biologically meaningful pathways. Setting it too low produces unstable enrichment scores for tiny gene sets. The default range of 10 to 500 genes works well for most analyses, but the choice should be documented and justified.
Permutation Count Too Low for Stable P-Values
Low permutation counts produce p-values that vary between runs and lack resolution near significance thresholds. Increase the permutation count or use the fgsea adaptive algorithm for more stable estimates. The ukbFGSEA package demonstrates the application of fast preranked GSEA to large-scale exome data, showing that computational efficiency enables enrichment analysis on datasets with hundreds of thousands of samples [10].
Interpretation of GSEA Results
Reading the Normalized Enrichment Score
The normalized enrichment score reflects the degree of overrepresentation of a gene set at the top or bottom of the ranked list. A score near zero indicates no enrichment. Scores above 1.5 or below negative 1.5 often indicate meaningful enrichment, but the threshold depends on the gene set database and the biological context.
Evaluating Statistical Significance
The adjusted p-value accounts for multiple testing across all gene sets tested. Gene sets with adjusted p-values below the chosen threshold are considered statistically significant. The leading edge genes provide the biological interpretation by identifying which genes drive the enrichment signal.
Connecting Enrichment to Biological Mechanism
Enriched pathways should be interpreted in the context of the experimental design and the known biology of the system. For example, GSEA revealed that the immunoglobulin heavy constant mu gene was associated with B cell receptor signaling, T helper cell differentiation, and NF-kappa B signaling pathways in both periodontitis and rheumatoid arthritis, providing insight into shared inflammatory mechanisms between these diseases [5]. Similarly, functional enrichment analysis of differentially expressed genes in canine mammary carcinoma identified extracellular matrix remodeling, cell adhesion, and immune response pathways as predominant biological programs in tumor tissues [6].
Validating with Complementary Analyses
GSEA results should be validated with complementary approaches. Check that leading edge genes show consistent expression patterns in the original data. Compare enrichment results across related gene set databases. Consider whether the enriched pathways align with known biology or generate testable hypotheses.
Limitations of GSEA
Dependence on Gene Set Database Quality
GSEA results depend entirely on the quality and completeness of the gene set database. Outdated annotations, incomplete pathway coverage, and redundant gene sets all affect results. The Molecular Signatures Database and other resources are updated regularly, and the database version should be reported.
Sensitivity to Ranking Metric
Different ranking metrics produce different ranked lists and therefore different enrichment results. The choice of metric should be justified by the biological question. Results based on an arbitrary or poorly justified metric may not be reproducible.
Inability to Distinguish Causality
GSEA identifies associations between gene sets and phenotypes but does not establish causality. An enriched pathway may be a consequence instead of a cause of the observed phenotype. Experimental validation is required to establish mechanistic relationships.
Assumption of Coordinated Gene Expression
GSEA assumes that genes within a set change in a coordinated manner. This assumption holds for many biological pathways but fails for gene sets that contain genes with opposing regulatory patterns. The leading edge analysis helps identify whether the enrichment signal is driven by a coherent subset of genes.
Quality Controls and Validation Steps
Check Gene Set Coverage
After running GSEA, verify that a reasonable proportion of genes in the ranked list map to the gene set database. Low coverage indicates identifier problems or database incompatibility. The analysis should report the number of genes tested and the number mapped to gene sets.
Examine Leading Edge Composition
For each significant gene set, examine the leading edge genes to confirm they are biologically coherent. A gene set with a significant enrichment score driven by unrelated genes may represent an artifact. The enrichment plot provides a visual check of the running score curve.
Run Sensitivity Analyses
Test whether results change with different parameter choices. Vary the minimum gene set size, the permutation count, and the ranking metric. Consistent results across parameter choices increase confidence in the findings.
Compare with Alternative Methods
Overrepresentation analysis tests whether differentially expressed genes are enriched in gene sets without considering the ranked list. Comparing GSEA results with overrepresentation analysis results can identify robust biological signals. Discrepancies between methods warrant investigation.
Safety and Regulatory Context for Omics Data
Data Sharing and Privacy Considerations
Omics data derived from human subjects are subject to data sharing policies that protect participant privacy. The NIH Genomic Data Sharing Policy establishes expectations for responsible sharing of genomic data, including informed consent requirements and data use limitations [3]. Researchers must ensure their analysis workflows comply with applicable data governance requirements.
Data Management and Reproducibility
The FAIR Guiding Principles provide a framework for making research data findable, accessible, interoperable, and reusable [4]. Applying these principles to GSEA workflows means documenting data sources, analysis parameters, and software versions. The EMBL-EBI Training program offers resources on bioinformatics data management and analysis best practices [1]. The NCBI provides access to public genomic databases and tools that support reproducible research [2].
Professional Escalation Criteria
When GSEA results will inform clinical decisions, regulatory submissions, or other high-stakes applications, consult with a bioinformatics specialist or biostatistician. Escalate when results are inconsistent across analysis methods, when leading edge genes lack biological coherence, or when the analysis will be used to support claims beyond the scope of the data.
Reporting GSEA Results
Methods Section Documentation
The methods section should describe the gene set database and version, the ranking metric, the minimum and maximum gene set sizes, the permutation count, and the multiple testing correction method. This information allows readers to evaluate the analysis and reproduce the results.
Results Presentation
Report the number of gene sets tested, the number significant at the chosen threshold, and the range of normalized enrichment scores. Present the top enriched gene sets in a table with enrichment scores, p-values, and leading edge gene counts. Include enrichment plots for the most biologically relevant gene sets.
Supplementary Materials
Provide the complete GSEA results table, the ranked gene list, and the analysis script as supplementary materials. This transparency supports reproducibility and allows other researchers to reanalyze the data with different parameters or gene set databases.
Integrating GSEA with Other Bioinformatics Analyses
Combining with Differential Expression
GSEA complements differential expression analysis by providing pathway-level context. Differential expression identifies individual genes, while GSEA identifies coordinated biological programs. The two approaches together provide a more complete picture than either alone.
Combining with Machine Learning
Machine learning models can identify genes that discriminate between conditions, and GSEA can characterize the biological functions of those genes. Studies have combined machine learning screening with GSEA to identify shared genes between diseases and characterize their associated pathways [5]. Similarly, prognostic gene signatures identified through machine learning can be interpreted through pathway enrichment analysis [7].
Combining with Single-Cell Analysis
Single-cell RNA sequencing data can be analyzed with GSEA at the level of cell clusters or pseudobulk expression. Pathway enrichment in specific cell populations reveals cell-type-specific biological programs. The integration of bulk and single-cell data with GSEA provides complementary perspectives on pathway activity [7].
Combining with Imaging Data
Quantitative imaging features can be clustered to identify disease subtypes, and gene expression data can characterize the biological basis of those subtypes. GSEA of gene expression data from imaging-defined subtypes reveals the molecular pathways that distinguish them [9]. This integrative approach connects phenotypic imaging features with molecular mechanisms.
Advanced Applications and Extensions
GSEA for Non-Model Organisms
GSEA requires gene set databases with annotations for the organism under study. For non-model organisms, gene sets can be constructed from orthology mapping or from literature curation. The clusterProfiler package supports multiple organisms through the respective OrgDb packages.
GSEA for Proteomics and Metabolomics
The GSEA framework applies to any omics data type that produces a ranked list of features. Proteomics data can be ranked by protein abundance changes, and metabolomics data by metabolite concentration changes. Gene set databases must be adapted to the feature identifiers used in each data type.
GSEA for Time Series Data
Time series experiments can be analyzed by ranking genes according to their correlation with time or by analyzing each time point separately. The choice of approach depends on whether the question concerns overall temporal trends or condition-specific responses at individual time points.
GSEA for Multi-Omics Integration
Integrating transcriptomics, proteomics, and metabolomics data with GSEA can reveal coordinated changes across molecular layers. Each data type produces a ranked list, and enrichment analysis of each list identifies pathways active at each level. Comparing enrichment results across data types identifies pathways with consistent changes.
Case Examples from Published Studies
Shared Inflammatory Pathways in Periodontitis and Rheumatoid Arthritis
A bioinformatic analysis of periodontitis and rheumatoid arthritis used GSEA to characterize the pathways associated with the shared gene immunoglobulin heavy constant mu. The analysis revealed enrichment of B cell receptor signaling, T helper cell differentiation, and NF-kappa B signaling pathways in both diseases [5]. This finding connected a shared gene to specific inflammatory mechanisms and suggested potential diagnostic applications.
Pathway Characterization in Canine Mammary Carcinoma
An integrated bioinformatics analysis of canine mammary carcinoma identified differentially expressed genes and characterized their functions through enrichment analysis. Genes with higher transcript levels in tumor tissues were associated with extracellular matrix remodeling, cell adhesion, and immune response pathways, while genes with lower transcript levels were enriched for cytoskeletal organization [6]. This pathway-level characterization provided biological context for the observed gene expression changes.
Prognostic Gene Signatures in Stomach Adenocarcinoma
A multi-omics analysis of stomach adenocarcinoma used GSEA to characterize the pathways enriched in high-risk versus low-risk patient groups. High-risk tumors showed enrichment of pro-metastatic pathways including cell adhesion molecules and extracellular matrix receptor interaction, along with an immunosuppressive microenvironment [7]. These pathway-level findings connected the prognostic gene signature to biological mechanisms.
Vitamin D Effects on Atlantic Salmon Skin Gene Expression
A transcriptomic study of Atlantic salmon skin examined the effects of dietary vitamin D supplementation on immune-related gene expression. The analysis identified 151 differentially expressed genes, 27 of which were linked to inflammation, antigen presentation, and innate and adaptive immunity [8]. This study demonstrates the application of transcriptomic analysis and pathway interpretation to non-mammalian species.
Frequently Asked Questions
What is the difference between GSEA and overrepresentation analysis?
GSEA uses the full ranked list of all measured genes and detects coordinated shifts in gene set expression, even when individual genes do not reach significance thresholds. Overrepresentation analysis tests only genes that pass a differential expression cutoff and asks whether those genes are overrepresented in gene sets. GSEA retains more information and can detect subtle but coordinated pathway changes that overrepresentation analysis misses.
How do I choose between clusterProfiler and fgsea?
clusterProfiler provides convenient access to KEGG, GO, and Reactome databases with automatic identifier handling and built-in visualization functions. fgsea offers faster computation and flexible input of custom gene sets through GMT files. For standard analyses with common databases, clusterProfiler is simpler. For large-scale analyses or custom gene set collections, fgsea is often more practical.
What ranking metric should I use for my data?
The ranking metric should reflect the biological question. For comparing two conditions, the Wald statistic from DESeq2 or the moderated t-statistic from limma accounts for both effect size and variability. For continuous phenotypes, use the correlation between gene expression and the phenotype. For survival data, use the statistic from a Cox regression model. Document the chosen metric in the methods section.
Why did my analysis return zero significant gene sets?
Zero significant results can occur for several reasons. The ranking metric may not capture the biological signal. The gene set database may not match the biological processes relevant to the study. The sample size may be too small to detect coordinated changes. The significance threshold may be too strict. Check gene set coverage, examine the distribution of enrichment scores, and consider whether the experimental design supports pathway-level detection.
How many permutations do I need for stable results?
The number of permutations affects the precision of p-value estimates. Low permutation counts produce discrete p-values that limit resolution near significance thresholds. The fgsea package uses an adaptive algorithm that performs more permutations for gene sets near the significance threshold. For clusterProfiler, 1000 permutations provide a reasonable starting point, and 10000 permutations provide more stable estimates at the cost of computation time.
What are leading edge genes and why do they matter?
Leading edge genes are the members of a gene set that appear before the maximum enrichment score in the ranked list. They drive the enrichment signal and provide the biological interpretation of the result. Examining leading edge genes confirms that the enrichment is driven by a coherent group of genes instead of a few outliers. The leading edge genes are the most relevant candidates for further investigation.
Can I use GSEA with data from non-model organisms?
GSEA requires gene set annotations for the
Related Bioinformatics Guides
- Gene Ontology (GO) and Enrichment Analysis
- Alternative Splicing Analysis from RNA-Seq Data
- Multi-Omics Integration Strategies
- The KEGG Database and Pathway Analysis
- Predicting AMR from Genomic Data
References and Further Reading
- EMBL-EBI Training. European Bioinformatics Institute.
- NCBI Data Resources. National Center for Biotechnology Information.
- Genomic Data Sharing Policy. National Institutes of Health.
- The FAIR Guiding Principles. Scientific Data.
- Immunoglobulin Heavy Constant Mu as a Shared Gene in Periodontitis and Rheumatoid Arthritis: A Bioinformatic Analysis.. 2026.
- Diagnostic and prognostic values of differentially expressed genes in canine mammary carcinoma: An integrated bioinformatics analysis.. 2026.
- Based on comprehensive analysis of ScRNA-seq and bulk RNA-seq, identification of palmitoylation-related genes as biomarkers to evaluate prognosis and immune landscape in stomach adenocarcinoma.. 2026.
- Impact of vitamin D on gene expression in Atlantic salmon skin.. 2026.
- Clustering of quantitative CT features identifies HCC subtypes with distinct prognosis and immune signatures.. 2026.
- ukbFGSEA: an R Package for Applying Fast Preranked Gene Set Enrichment Analysis to UK Biobank Exome Data. 2024.
- A Tutorial on Movable Antennas for Wireless Networks. IEEE Communications Surveys and Tutorials, 2025.
- Pinching-Antenna Systems (PASS): A Tutorial. IEEE Transactions on Communications, 2025.
- Estimating psychological networks and their accuracy: A tutorial paper. Behavior Research Methods, 2016.
- A Tutorial on Fluid Antenna System for 6G Networks: Encompassing Communication Theory, Optimization Methods and Hardware Designs. IEEE Communications Surveys and Tutorials, 2024.
- Intelligent Reflecting Surface-Aided Wireless Communications: A Tutorial. IEEE Transactions on Communications, 2020.
- Semantics-Empowered Communications: A Tutorial-Cum-Survey. IEEE Communications Surveys and Tutorials, 2024.
- Biological Functional Class Enrichment Analysis with R, an Annotated Tutorial for Bench Scientists. Methods and Protocols, 2026.
This article is educational and does not replace validated analysis plans, institutional policy, clinical interpretation, or specialist review.