A running sum statistic is a sequential, cumulative calculation used in Gene Set Enrichment Analysis (GSEA) to detect whether members of a predefined gene set are clustered at the extremes of a ranked gene list. The algorithm walks down the entire list of genes, which is ordered by differential expression correlation. At each position, the running sum increases by a weighted amount when the gene belongs to the target set and decreases proportionally when it does not, creating a dynamic deviation profile.
Glossary
Running Sum Statistic

What is Running Sum Statistic?
The running sum statistic is the sequential calculation at the heart of Gene Set Enrichment Analysis that quantifies the non-random distribution of a predefined gene set within a ranked list of all genes.
The enrichment score (ES) is defined as the maximum absolute deviation of this running sum from zero. A high positive deviation indicates enrichment at the top of the ranked list, while a negative deviation indicates enrichment at the bottom. The magnitude of the increment is typically weighted by the gene's ranking metric, ensuring that genes with stronger differential expression contribute more heavily to the cumulative sum and the final enrichment signal.
Key Characteristics of the Running Sum Statistic
The running sum statistic is the sequential engine of Gene Set Enrichment Analysis (GSEA). It walks down a ranked list of genes, incrementing when a gene belongs to the target set and decrementing otherwise, to detect non-random clustering of the set at the extremes of the ranking.
Sequential Calculation
The statistic is computed by walking down a gene list L of N genes, ranked by differential expression (e.g., signal-to-noise ratio). At each position j, the running sum is updated:
- Hit: If gene j is in the target set S, the sum increases by a weighted amount proportional to the gene's correlation with the phenotype.
- Miss: If gene j is not in S, the sum decreases by a constant penalty. This creates a random walk-like trajectory that reflects the distribution of S within L.
Weighted vs. Unweighted Variants
The standard GSEA implementation uses a weighted running sum where the increment for a hit is proportional to the gene's ranking metric (e.g., absolute correlation). This gives more influence to genes at the extremes of the ranked list.
- Weighted (p=1): Increment = |r_j|^p, where r_j is the correlation. Genes with stronger differential expression contribute more to the enrichment signal.
- Unweighted (p=0): Increment = 1 for all hits. All members of S are treated equally, regardless of their individual effect size. The choice of weighting scheme affects sensitivity to leading-edge subsets.
Enrichment Score Derivation
The Enrichment Score (ES) is the maximum deviation from zero of the running sum statistic. It is calculated as:
- Track the running sum across all N positions.
- Identify the point where the sum reaches its peak positive or peak negative value.
- This peak is the ES, reflecting the degree of overrepresentation at the top (positive ES) or bottom (negative ES) of the ranked list. The ES is conceptually similar to a weighted Kolmogorov-Smirnov statistic, testing whether the distribution of S differs from a uniform distribution across L.
Null Distribution via Permutation
To assess statistical significance, the observed ES is compared against a null distribution generated by permutation testing:
- Phenotype permutation: Randomly shuffle sample labels, re-rank genes, and recompute the ES thousands of times. This preserves gene-gene correlations.
- Gene set permutation: Randomly select gene sets of the same size as S from the background. This is computationally faster but assumes gene independence. The nominal p-value is the fraction of permuted ES values exceeding the observed ES. Phenotype permutation is preferred for preserving the correlation structure of expression data.
Leading-Edge Subset Identification
The running sum trajectory directly identifies the leading-edge subset—the core group of genes driving the enrichment signal:
- These are the genes in S that appear before or at the point where the running sum reaches its maximum deviation.
- The leading-edge subset represents the most biologically relevant members of the gene set, often forming a signaling cascade or protein complex.
- This subset can be extracted for downstream analysis, such as identifying therapeutic targets or constructing diagnostic signatures.
Normalization Across Gene Sets
The raw ES is sensitive to gene set size and dataset correlation structure, making direct comparison across gene sets invalid. The Normalized Enrichment Score (NES) corrects for this:
- For each gene set, the observed ES is divided by the mean of all positive (or negative) permuted ES values for sets of that size.
- This normalization accounts for the fact that larger gene sets tend to have smaller maximum deviations.
- NES values enable comparative ranking of enrichment results across multiple gene sets, with |NES| > 1 typically indicating significant enrichment.
Frequently Asked Questions
A technical deep dive into the sequential calculation at the heart of Gene Set Enrichment Analysis, explaining how it detects non-random clustering of gene sets within ranked expression data.
The running sum statistic is a sequential, cumulative calculation used in Gene Set Enrichment Analysis (GSEA) that walks down a ranked list of genes, increasing its value when a gene belongs to the target set and decreasing it when a gene does not. This dynamic, position-dependent score is designed to detect whether members of a pre-defined gene set are non-randomly clustered at the extremes—either the top or bottom—of a ranked list ordered by differential expression. The maximum deviation of this running sum from zero is recorded as the Enrichment Score (ES), which quantifies the degree of overrepresentation at the phenotypic extremes. Unlike static overlap tests, the running sum statistic is a functional class scoring method that leverages the full continuous ranking of all genes, preserving the magnitude of differential expression rather than relying on an arbitrary significance cutoff.
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Related Terms
Core concepts that define how the running sum statistic operates within Gene Set Enrichment Analysis to detect non-random clustering of gene sets.
Enrichment Score (ES)
The maximum deviation from zero achieved by the running sum statistic during a GSEA walk. It quantifies the degree to which a gene set is overrepresented at the extremes (top or bottom) of a ranked list of genes.
- Calculated as the peak of the cumulative sum
- Positive ES: enrichment at the top of the ranked list
- Negative ES: enrichment at the bottom
- Magnitude reflects the strength of the correlation
Leading-Edge Subset
The core group of genes within an enriched gene set that drives the enrichment signal. These genes appear clustered at the extreme end of the ranked list before the running sum reaches its maximum deviation.
- Represents the most biologically relevant members
- Used to refine gene sets and identify key drivers
- Can be extracted for downstream network analysis
- Often visualized in Enrichment Maps as overlapping nodes
Phenotype Permutation
A resampling strategy used to estimate the statistical significance of the Enrichment Score. Sample labels are randomly shuffled to generate a null distribution of ES values against which the observed ES is compared.
- Preserves the gene-gene correlation structure within the dataset
- Contrasts with gene permutation, which assumes independence
- Computationally intensive but statistically robust
- Essential for calculating nominal p-values and FDR
Normalized Enrichment Score (NES)
An Enrichment Score that has been corrected for gene set size and dataset-specific correlation structure. Normalization enables direct comparison of enrichment results across multiple gene sets of varying sizes.
- Accounts for the fact that larger sets tend to have higher ES
- Calculated by dividing ES by the mean of all permuted ES values
- NES > 1.5 typically considered significant
- The primary metric for ranking enriched pathways
Gene Set Collection
A curated or computationally derived library of gene sets stored in GMT file format. Each set represents a shared biological feature, pathway, or regulatory motif used as input for the running sum calculation.
- MSigDB Hallmark: 50 refined biological states
- GO: Biological Process, Molecular Function, Cellular Component
- KEGG: Manually curated metabolic and signaling pathways
- Reactome: Detailed molecular interaction networks
False Discovery Rate (FDR)
The expected proportion of false positives among all gene sets declared significant. In GSEA, FDR is estimated by comparing the observed NES distribution against the null distribution from phenotype permutations.
- Controls for multiple hypothesis testing across thousands of gene sets
- FDR < 0.25 is the standard GSEA threshold
- More permissive than Bonferroni correction
- Balances sensitivity and specificity in exploratory analyses

About the author
Prasad Kumkar
CEO & MD, Inference Systems
Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.
His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us