Skip to content

Visualization and Pathways

A table of 1,153 tests is hard to read. This page draws the four figures that carry most of it for the Day 0 severity comparison of the Differential abundance page, then runs a Hallmark gene set test on the ranked t-statistics. The R tab uses ggplot2, pheatmap and fgsea. The Python tab uses matplotlib, seaborn and GSEApy.

The page runs on its own, so the first block repeats the Day 0 comparison, LOD filter and Welch t-tests of the differential page in short form, and finds the same 734 significant assays. top_proteins keeps the best assay of each of the ten leading proteins, so the four IL6 assays get one label.

The data below come from Bánk Fenyves’s version 2 deposit for Filbin and colleagues’ 2021 study, under CC BY 4.0. This lesson reshapes the NPX workbook, joins assay and clinical annotations, selects Day 0 COVID-positive subjects, and calculates the displayed comparisons.

suppressPackageStartupMessages({
library(readxl)
library(dplyr)
library(tidyr)
library(OlinkAnalyze)
library(ggplot2)
library(ggrepel)
library(pheatmap)
library(fgsea)
library(jsonlite)
})
data_dir <- "/opt/data/mgh_covid_olink"
dir.create("outputs", showWarnings = FALSE)
severity_colours <- c(Severe = "#eb6834", `Non-severe` = "#2a78d6")
npx_wide <- read_excel(file.path(data_dir, "olink_proteomics.xlsx"),
na = "NA")
assays <- read_excel(
file.path(data_dir, "supplemental_table_2_olink_assays.xlsx"),
sheet = "2A-Olink-Assay", skip = 1
)
clinical <- read_excel(file.path(data_dir, "clinical_metadata.xlsx"),
sheet = "Subject-level metadata")
# Day 0 samples of COVID-positive subjects. Acuity max 1 or 2 is severe.
samples <- npx_wide |>
filter(Day == "0") |>
transmute(SampleID = `Public ID`,
subject = as.numeric(sub("_.*", "", `Public ID`))) |>
inner_join(clinical, by = c(subject = "Public ID")) |>
filter(COVID == 1) |>
transmute(SampleID,
Severity = factor(if_else(`Acuity max` <= 2, "Severe",
"Non-severe"),
levels = c("Severe", "Non-severe")))
npx_long <- npx_wide |>
filter(Day == "0") |>
select(-Day) |>
rename(SampleID = `Public ID`) |>
pivot_longer(starts_with("OID"), names_to = "OlinkID",
values_to = "NPX") |>
inner_join(samples, by = "SampleID") |>
inner_join(select(assays, OlinkID, Assay, UniProt, Panel,
Panel_Version, LOD),
by = "OlinkID") |>
mutate(PlateID = NA_character_, QC_Warning = NA_character_,
Panel_Version = as.character(Panel_Version))
# Keep an assay when at least half of the samples are above its LOD.
detection <- npx_long |>
group_by(OlinkID) |>
summarise(above_lod = mean(NPX > LOD, na.rm = TRUE))
npx_kept <- semi_join(npx_long, filter(detection, above_lod >= 0.5),
by = "OlinkID")
welch <- olink_ttest(npx_kept, variable = "Severity",
check_log = check_npx(npx_kept))
cat("samples:", nrow(samples), " assays tested:", nrow(welch),
" significant at FDR 0.05:", sum(welch$Adjusted_pval < 0.05), "\n")
# The best assay of each protein, for labels and panels.
top_proteins <- welch |>
distinct(Assay, .keep_all = TRUE) |>
head(10)
top_proteins |>
transmute(Assay, OlinkID, estimate = round(estimate, 3),
t = round(statistic, 2)) |>
as.data.frame() |>
print(row.names = FALSE)
samples: 305 assays tested: 1153 significant at FDR 0.05: 734
Assay OlinkID estimate t
KRT19 OID20596 1.887 10.23
IL6 OID20101 1.749 9.61
PTX3 OID20570 0.902 8.98
CHI3L1 OID20399 1.617 8.94
TRIAP1 OID21403 1.098 8.87
LTBP2 OID20254 1.025 8.82
IL1RL1 OID20250 1.158 8.78
POLR2F OID21283 0.900 8.79
AREG OID21357 1.196 8.61
MAPK9 OID20557 0.723 8.45

A volcano plot puts the effect on the x axis, here the difference in mean NPX, and the evidence on the y axis as the negative log10 of the p-value. Benjamini-Hochberg fixes no p-value threshold in advance, so the dashed line sits at the largest raw p-value that still passes FDR 0.05. olink_volcano_plot() from OlinkAnalyze draws a similar plot in one call, but its dotted line marks a raw p-value of 0.05, which is a different and looser cut.

# The largest p-value that still passes FDR 0.05 marks the cut.
fdr_cut <- max(welch$p.value[welch$Adjusted_pval < 0.05])
volcano_data <- welch |>
mutate(direction = case_when(
Adjusted_pval >= 0.05 ~ "not significant",
estimate > 0 ~ "higher in severe",
TRUE ~ "lower in severe"
))
count(volcano_data, direction)
cat("FDR 0.05 cut at p =", signif(fdr_cut, 3), "\n")
volcano <- ggplot(volcano_data,
aes(estimate, -log10(p.value), colour = direction)) +
geom_point(size = 1.4, alpha = 0.8) +
geom_hline(yintercept = -log10(fdr_cut), linetype = "dashed",
colour = "#52514e") +
geom_text_repel(data = top_proteins,
aes(estimate, -log10(p.value), label = Assay),
inherit.aes = FALSE, size = 3.2, seed = 1,
min.segment.length = 0) +
scale_colour_manual(values = c(
`higher in severe` = "#eb6834", `lower in severe` = "#2a78d6",
`not significant` = "#c3c2b7"
)) +
labs(x = "Severe minus non-severe, NPX", y = "-log10 p-value",
colour = NULL,
title = "Welch t-tests, Day 0, 1,153 Olink Explore assays") +
theme_minimal(base_size = 11) +
theme(legend.position = "top", panel.grid.minor = element_blank())
ggsave("outputs/olink-visualization_volcano_r.png", volcano,
width = 7, height = 5.5, dpi = 120, bg = "white")
# A tibble: 3 × 2
direction n
<chr> <int>
1 higher in severe 687
2 lower in severe 47
3 not significant 419
FDR 0.05 cut at p = 0.0317

Volcano plot drawn with ggplot2. Most significant assays sit to the right of zero, higher in severe patients, with KRT19 and the IL6 assays at the top.

The FDR line sits at p = 0.0317. The plot is lopsided: 687 significant assays rise in severe patients and 47 fall, and the falls stay close to zero next to the rises. Severe COVID-19 raises many plasma proteins at once. Keep that in mind for the gene set test below, which ranks proteins against each other.

The heatmap shows the 30 leading proteins across all 305 samples. Each row is scaled to a mean of 0 and a standard deviation of 1, so a color says where a sample sits against the other samples for that protein, not its NPX. Rows and columns are clustered with complete linkage on Euclidean distance, the pheatmap default, and the Python call is set to match. The last lines cut the sample tree into two branches and count the patients in each.

heatmap_ids <- welch |>
distinct(Assay, .keep_all = TRUE) |>
head(30)
heat <- npx_kept |>
filter(OlinkID %in% heatmap_ids$OlinkID) |>
select(Assay, SampleID, NPX) |>
pivot_wider(names_from = SampleID, values_from = NPX)
heat_matrix <- as.matrix(heat[, samples$SampleID])
rownames(heat_matrix) <- heat$Assay
# Scale each protein to mean 0 and standard deviation 1 across samples.
z <- t(scale(t(heat_matrix)))
severe_cols <- samples$Severity == "Severe"
cat("proteins:", nrow(z), " samples:", ncol(z),
" missing values:", sum(is.na(z)), "\n")
cat("mean z, severe:", round(mean(z[, severe_cols]), 4),
" non-severe:", round(mean(z[, !severe_cols]), 4), "\n")
annotation <- data.frame(Severity = samples$Severity,
row.names = samples$SampleID)
heatmap_plot <- pheatmap(
pmin(pmax(z, -3), 3),
color = colorRampPalette(c("#2a78d6", "#f0efec", "#e34948"))(101),
breaks = seq(-3, 3, length.out = 102),
clustering_distance_rows = "euclidean",
clustering_distance_cols = "euclidean",
clustering_method = "complete",
annotation_col = annotation,
annotation_colors = list(Severity = severity_colours),
show_colnames = FALSE, fontsize_row = 8, border_color = NA,
main = "Top 30 proteins, z-score of NPX, 305 Day 0 samples",
silent = TRUE
)
ggsave("outputs/olink-visualization_heatmap_r.png", heatmap_plot$gtable,
width = 9, height = 6.5, dpi = 120, bg = "white")
# Cut the sample tree in two and call the branch with the higher mean z high.
branch <- cutree(heatmap_plot$tree_col, k = 2)[samples$SampleID]
high_branch <- which.max(tapply(colMeans(z), branch, mean))
branch_table <- table(branch = if_else(branch == high_branch, "high", "low"),
severity = samples$Severity)
branch_table
proteins: 30 samples: 305 missing values: 0
mean z, severe: 0.6003 non-severe: -0.3338
severity
branch Severe Non-severe
high 78 35
low 31 161

Heatmap of the top 30 proteins across the 305 samples, drawn with pheatmap, with the severity of each sample in a bar above the columns.

The high branch holds 78 severe and 35 non-severe patients, and the low branch holds 31 severe and 161 non-severe ones. Most severe patients share a raised profile across all 30 proteins, but 31 of them do not, and 35 non-severe patients look like the severe majority. Filbin et al. found the same heterogeneity, with several distinct clusters of severe patients on their Day 0 severity proteins. One caution applies to any heatmap of this kind. The 30 proteins were picked because they separate the groups in these same samples, so the picture cannot serve as evidence that they separate them.

A PCA uses every assay and no labels. Each assay with no missing value is centered and scaled to unit variance, the components come from all of them, and severity only colors the points afterwards. The sign of a component is arbitrary, so both tabs turn each one to make the severe mean positive, which makes the two figures match.

pca_input <- npx_kept |>
select(OlinkID, SampleID, NPX) |>
pivot_wider(names_from = OlinkID, values_from = NPX)
pca_matrix <- as.matrix(pca_input[, -1])
rownames(pca_matrix) <- pca_input$SampleID
pca_matrix <- pca_matrix[samples$SampleID, ]
# prcomp() needs complete columns, so drop the assays with a missing NPX.
pca_matrix <- pca_matrix[, colSums(is.na(pca_matrix)) == 0]
pca <- prcomp(pca_matrix, center = TRUE, scale. = TRUE)
variance <- pca$sdev^2 / sum(pca$sdev^2)
scores <- as.data.frame(pca$x[, 1:2])
# The sign of a component is arbitrary. Point both so the severe mean is
# positive, which the Python tab does too.
signs <- sign(colMeans(scores[samples$Severity == "Severe", ]))
scores <- sweep(scores, 2, signs, "*")
scores$Severity <- samples$Severity
cat("assays in the PCA:", ncol(pca_matrix), "\n")
cat("variance explained, PC1 to PC5:",
sprintf("%.2f%%", 100 * variance[1:5]), "\n")
scores |>
group_by(Severity) |>
summarise(PC1 = round(mean(PC1), 3), PC2 = round(mean(PC2), 3)) |>
as.data.frame()
pca_plot <- ggplot(scores, aes(PC1, PC2, colour = Severity)) +
geom_point(size = 1.8, alpha = 0.8) +
scale_colour_manual(values = severity_colours) +
labs(x = sprintf("PC1, %.1f%% of variance", 100 * variance[1]),
y = sprintf("PC2, %.1f%% of variance", 100 * variance[2]),
colour = NULL, title = "PCA of 305 Day 0 samples") +
theme_minimal(base_size = 11) +
theme(legend.position = "top", panel.grid.minor = element_blank())
ggsave("outputs/olink-visualization_pca_r.png", pca_plot,
width = 6.5, height = 5.5, dpi = 120, bg = "white")
assays in the PCA: 1152
variance explained, PC1 to PC5: 28.85% 11.60% 6.58% 4.95% 3.98%
Severity PC1 PC2
1 Severe 8.609 0.095
2 Non-severe -4.788 -0.053

PCA of the Day 0 samples drawn with ggplot2. Severe samples sit toward positive PC1, and the two groups overlap.

PC1 explains 28.85% of the variance across 1,152 assays and PC2 explains 11.60%. Severe patients lean toward positive PC1, with a mean score of 8.609 against -4.788 for non-severe patients, while PC2 hardly separates them. The overlap is wide. The largest axis of variation in Day 0 plasma is one on which severe patients score higher, and it is not a clean split.

A boxplot shows the spread, the overlap and the values near the LOD that a mean difference hides. The dashed line is the assay LOD, and the table gives the share of each group below it.

box_ids <- head(top_proteins, 6)
box_data <- npx_kept |>
filter(OlinkID %in% box_ids$OlinkID) |>
mutate(Assay = factor(Assay, levels = box_ids$Assay))
box_summary <- box_data |>
group_by(Assay, Severity) |>
summarise(median = median(NPX, na.rm = TRUE),
below_lod = mean(NPX < LOD, na.rm = TRUE), .groups = "drop")
box_summary |>
mutate(median = sprintf("%.3f", median),
below_lod = sprintf("%.3f", below_lod)) |>
as.data.frame() |>
print(row.names = FALSE)
box_plot <- ggplot(box_data, aes(Severity, NPX, fill = Severity)) +
geom_boxplot(outlier.size = 0.8, width = 0.6, alpha = 0.85) +
geom_hline(data = distinct(box_data, Assay, LOD),
aes(yintercept = LOD), linetype = "dashed",
colour = "#52514e") +
facet_wrap(~ Assay, scales = "free_y", nrow = 2) +
scale_fill_manual(values = severity_colours) +
labs(x = NULL, y = "NPX", fill = NULL,
title = "Top six proteins at Day 0, dashed line at the assay LOD") +
theme_minimal(base_size = 11) +
theme(legend.position = "none", panel.grid.minor = element_blank())
ggsave("outputs/olink-visualization_boxplots_r.png", box_plot,
width = 8, height = 5.5, dpi = 120, bg = "white")
Assay Severity median below_lod
KRT19 Severe 4.290 0.037
KRT19 Non-severe 2.462 0.117
IL6 Severe 6.718 0.000
IL6 Non-severe 5.395 0.010
PTX3 Severe 6.359 0.000
PTX3 Non-severe 5.541 0.000
CHI3L1 Severe 4.643 0.073
CHI3L1 Non-severe 2.716 0.418
TRIAP1 Severe 3.397 0.000
TRIAP1 Non-severe 2.333 0.000
LTBP2 Severe 5.388 0.000
LTBP2 Non-severe 4.323 0.000

Boxplots of NPX by severity for six proteins, drawn with ggplot2, with the LOD as a dashed line.

CHI3L1 shows why the LOD line belongs on the plot. A share of 0.418 of the non-severe values lies below its LOD, against 0.073 of the severe values, so part of that difference is a protein in measurable amounts against a protein at background. KRT19 has 0.117 of its non-severe values below the LOD. For IL6, PTX3, TRIAP1 and LTBP2, no group has more than 0.010 below it, and the boxes move as a whole.

A gene set test asks whether the members of a set sit together near the top or the bottom of a ranked list, here the Welch t-statistic of every gene on the panel. The 50 Hallmark sets of Liberzon et al. 2015 each summarize a well defined biological state. The image holds MSigDB v2026.1 as a GMT file exported at build time, so the run needs no network. Both tabs run the preranked GSEA of Subramanian et al. 2005 with a weight of 1, keep sets with at least 10 ranked genes, and fix the random seed.

The ranking needs one value per gene symbol. The Assay column holds the symbol, which is what the GMT file uses, so the code joins on Assay rather than on UniProt, for which the image holds no map to gene symbols. Seven kept assays join two genes in one name, such as IL12A_IL12B, and the code drops them, because one measurement cannot stand for two genes. CXCL8, IL6 and TNF have one assay on each of the four panels. The code keeps the copy with the most samples above the LOD, and the lowest OlinkID on a tie, and drops the other 8 copies.

The Hallmark memberships below come from MSigDB 2026.1.Hs, copyright Broad Institute, Massachusetts Institute of Technology, and Regents of the University of California, under CC BY 4.0. The MSigDB terms cover this collection. This lesson intersects the supplied memberships with the ranked panel genes and applies the stated minimum set size.

# One t-statistic per gene symbol. An Assay name such as IL12A_IL12B joins
# two genes, so drop it. CXCL8, IL6 and TNF have one assay on each panel:
# keep the copy with the most samples above LOD, then the lowest OlinkID.
two_genes <- grepl("_", welch$Assay)
gene_ranks <- welch[!two_genes, ] |>
left_join(detection, by = "OlinkID") |>
arrange(Assay, desc(above_lod), OlinkID) |>
distinct(Assay, .keep_all = TRUE)
ranks <- sort(setNames(gene_ranks$statistic, gene_ranks$Assay),
decreasing = TRUE)
cat("dropped:", sum(two_genes), "assays with two genes,",
sum(!two_genes) - nrow(gene_ranks), "duplicate copies\n")
gene_ranks |>
filter(Assay %in% c("CXCL8", "IL6", "TNF")) |>
transmute(Assay, OlinkID, above_lod = round(above_lod, 3)) |>
as.data.frame() |>
print(row.names = FALSE)
pathways <- gmtPathways("/opt/data/msigdb/h.all.v2026.1.Hs.symbols.gmt")
coverage <- tibble(
pathway = names(pathways),
genes = lengths(pathways),
on_panel = lengths(lapply(pathways, intersect, names(ranks)))
)
cat("genes ranked:", length(ranks), " in any Hallmark set:",
sum(names(ranks) %in% unlist(pathways)), "\n")
cat("sets with 10 or more ranked genes:", sum(coverage$on_panel >= 10),
"of", nrow(coverage), "\n")
coverage |>
mutate(share = round(on_panel / genes, 2)) |>
arrange(desc(share)) |>
slice(c(1:4, (n() - 3):n())) |>
as.data.frame() |>
print(row.names = FALSE)
set.seed(20261029)
gsea <- fgsea(pathways, ranks, minSize = 10, maxSize = 500,
BPPARAM = BiocParallel::SerialParam(progressbar = FALSE))
gsea <- arrange(gsea, pval)
cat("sets tested:", nrow(gsea), " FDR below 0.05:", sum(gsea$padj < 0.05),
"\n")
gsea |>
head(10) |>
transmute(pathway = sub("HALLMARK_", "", pathway), size,
ES = round(ES, 3), NES = round(NES, 2),
padj = signif(padj, 2)) |>
as.data.frame() |>
print(row.names = FALSE)
dropped: 7 assays with two genes, 8 duplicate copies
Assay OlinkID above_lod
CXCL8 OID20631 1.000
IL6 OID20101 0.993
TNF OID20473 1.000
genes ranked: 1138 in any Hallmark set: 570
sets with 10 or more ranked genes: 34 of 50
pathway genes on_panel share
HALLMARK_IL6_JAK_STAT3_SIGNALING 87 43 0.49
HALLMARK_ANGIOGENESIS 36 16 0.44
HALLMARK_EPITHELIAL_MESENCHYMAL_TRANSITION 200 79 0.40
HALLMARK_INFLAMMATORY_RESPONSE 200 65 0.32
HALLMARK_MITOTIC_SPINDLE 199 8 0.04
HALLMARK_SPERMATOGENESIS 135 5 0.04
HALLMARK_G2M_CHECKPOINT 200 6 0.03
HALLMARK_MYC_TARGETS_V1 200 6 0.03
sets tested: 34 FDR below 0.05: 1
pathway size ES NES padj
EPITHELIAL_MESENCHYMAL_TRANSITION 79 0.441 1.46 0.044
TNFA_SIGNALING_VIA_NFKB 44 0.464 1.46 0.130
IL6_JAK_STAT3_SIGNALING 43 0.463 1.45 0.130
INTERFERON_GAMMA_RESPONSE 42 0.444 1.39 0.230
COMPLEMENT 57 0.405 1.30 0.300
HYPOXIA 41 0.422 1.32 0.300
INFLAMMATORY_RESPONSE 65 0.386 1.26 0.300
IL2_STAT5_SIGNALING 45 0.405 1.28 0.300
ANGIOGENESIS 16 0.499 1.36 0.300
P53_PATHWAY 28 0.432 1.28 0.300

Read the coverage table before the results. 1,138 genes are ranked and 570 of them belong to at least one Hallmark set. Coverage follows the panel design rather than the biology. 43 of the 87 genes of IL6_JAK_STAT3_SIGNALING are on the panel, against 6 of the 200 genes of MYC_TARGETS_V1 and of G2M_CHECKPOINT. Olink built the Explore panels around four themes, cardiometabolic, inflammation, neurology and oncology, so cytokines and their receptors are well covered and nuclear and cell cycle proteins are not. Only 34 of the 50 sets reach 10 ranked genes, and the rest are never tested.

That bias shapes the answer. Preranked GSEA compares each set with the rest of the list, and here the rest is the panel, not the genome, so an inflammation set must beat other inflammation proteins to pass. The cytokine sets share members, so their results overlap rather than add up. The test also permutes genes, not samples, which treats the proteins as independent, and cytokines that rise together look more coherent than that null expects.

The results are weak. fgsea finds one set at FDR 0.05, EPITHELIAL_MESENCHYMAL_TRANSITION with an adjusted p-value of 0.044. GSEApy finds none, with an FDR q-value of 0.342 for the same set, because it estimates the FDR in a different way. The four leading sets agree in both tools: EMT, TNF-alpha signaling via NF-kB, IL6 JAK STAT3 signaling and the interferon gamma response. Filbin et al. report enrichment of their severity proteins in IFN-gamma, IL-6 and TNF signaling, in KRAS signaling and in epithelial to mesenchymal transition, from Ingenuity Pathway Analysis against the measured protein set. The themes match. On a panel built around these pathways, a match of themes is the most a gene set test can show.

The ES is a deterministic running sum, and the two tools agree on it to a relative 2.4e-07. The NES divides the ES by the mean of 1,000 random sets that each tool draws on its own, so the two NES values differ by up to a relative 2.3e-02. The parity check allows 1e-5 for the ES and 0.05 for the NES.

metrics <- list(
n_samples = nrow(samples),
n_tested = nrow(welch),
n_sig = sum(welch$Adjusted_pval < 0.05),
n_sig_up = sum(welch$Adjusted_pval < 0.05 & welch$estimate > 0),
fdr_cut = fdr_cut,
heat_mean_z_severe = mean(z[, severe_cols]),
pca_assays = ncol(pca_matrix),
pca_var_pc1 = variance[1],
pca_var_pc2 = variance[2],
pc1_mean_severe = mean(scores$PC1[scores$Severity == "Severe"]),
pc1_mean_non_severe = mean(scores$PC1[scores$Severity == "Non-severe"]),
high_branch_severe = branch_table["high", "Severe"],
high_branch_non_severe = branch_table["high", "Non-severe"],
n_ranked = length(ranks),
n_sets_tested = nrow(gsea)
)
for (i in seq_len(nrow(box_summary))) {
suffix <- paste0(box_summary$Assay[i], "_",
sub("-", "_", tolower(box_summary$Severity[i])))
metrics[[paste0("median_", suffix)]] <- box_summary$median[i]
metrics[[paste0("below_lod_", suffix)]] <- box_summary$below_lod[i]
}
for (i in seq_len(nrow(gsea))) {
name <- tolower(sub("HALLMARK_", "", gsea$pathway[i]))
metrics[[paste0("size_", name)]] <- gsea$size[i]
metrics[[paste0("es_", name)]] <- gsea$ES[i]
metrics[[paste0("nes_", name)]] <- gsea$NES[i]
}
write_json(metrics, "outputs/olink_visualization_metrics_r.json",
auto_unbox = TRUE, digits = NA, pretty = TRUE)
cat("wrote", length(metrics), "shared values\n")
wrote 141 shared values
  • A volcano line at a raw p-value of 0.05 overstates what passes. Draw the line at the largest p-value that passes your FDR cut.
  • A heatmap of the selected proteins always separates the groups. Treat it as a picture of the result, not as a test.
  • A symbol join misses an assay whose name differs from the MSigDB symbol. List the panel symbols that match no set before you trust the coverage table.
  • msigdbr() downloads its gene sets on first use, so it fails in a container with no network. Read the exported GMT file in /opt/data/msigdb/ instead.
  • On a targeted panel, a set with few members on the panel cannot be tested, and a set rich in panel proteins competes with its neighbors. Report the coverage with the result.

The code for this page is in the companion repository under guides/proteomics/olink-visualization/.

The OlinkAnalyze package by Nevola and colleagues supplies the functions for the analysis of Olink proteomic data.

Korotkevich and colleagues, 2016 describe the fast gene set enrichment analysis that fgsea implements.

Fang, Liu, and Peltz, 2022 describe GSEApy, the Python package for gene set enrichment analysis.

Liberzon and colleagues, 2015, explain how the Hallmark collection reduces overlap among biological signatures. Subramanian and colleagues, 2005, describe the enrichment statistic and its null comparisons. Read both before interpreting a set whose measured members depend on the targeted panel.

The fgsea tutorial and GSEApy tutorial explain ranked inputs and gene-set files. Their parameter definitions help locate differences between the two implementations; neither source promises identical adjusted p-values.