DIY GSEA

Authors

[Editor] Hu Zheng;

[Contributors]

Modified

2026-10-27

🤖 AI Skill — Download the Bizard unified skill for your AI assistant ⬇️ Download Skill ZIP
🔌 MCP Server — Let AI agents (Claude Code, Cursor, …) query Bizard live: claude mcp add bizard -- npx @openbiox/bizard-mcp — or the free hosted instance (no install, faster from mainland China): claude mcp add --transport http bizard http://biotree.top:38123/bizard-mcp/mcp 📖 MCP Docs
📖 Cite Bizard — if Bizard helps your research, please cite: Li, K., Zheng, H., Huang, K., et al. (2026). Bizard: A Community-Driven Platform for Accelerating and Enhancing Biomedical Data Visualization. iMetaMed, e70038. 🔗 DOI / BibTeX
Note

Hiplot website

This page is the tutorial for source code version of the Hiplot DIY GSEA plugin. You can also use the Hiplot website to achieve no code ploting. For more information please see the following link:

https://hiplot.cn/basic/diy-gsea?lang=en

Make your geneset.

Setup

  • System Requirements: Cross-platform (Linux/MacOS/Windows)

  • Programming language: R

  • Dependent packages: data.table; jsonlite; clusterProfiler

# Install packages
if (!requireNamespace("data.table", quietly = TRUE)) {
  install.packages("data.table")
}
if (!requireNamespace("jsonlite", quietly = TRUE)) {
  install.packages("jsonlite")
}
if (!requireNamespace("clusterProfiler", quietly = TRUE)) {
  BiocManager::install("clusterProfiler")
}

# Load packages
library(data.table)
library(jsonlite)
library(clusterProfiler)
sessioninfo::session_info("attached")
─ Session info ───────────────────────────────────────────────────────────────
 setting  value
 version  R version 4.6.0 (2026-04-24)
 os       Ubuntu 24.04.4 LTS
 system   x86_64, linux-gnu
 ui       X11
 language (EN)
 collate  C.UTF-8
 ctype    C.UTF-8
 tz       UTC
 date     2026-05-09
 pandoc   3.1.3 @ /usr/bin/ (via rmarkdown)
 quarto   1.9.37 @ /usr/local/bin/quarto

─ Packages ───────────────────────────────────────────────────────────────────
 package         * version date (UTC) lib source
 clusterProfiler * 4.20.0  2026-04-28 [1] Bioconduc~
 data.table      * 1.18.4  2026-05-06 [1] RSPM
 jsonlite        * 2.0.0   2025-03-27 [1] RSPM

 [1] /home/runner/work/_temp/Library
 [2] /opt/R/4.6.0/lib/R/site-library
 [3] /opt/R/4.6.0/lib/R/library
 * ── Packages attached to the search path.

──────────────────────────────────────────────────────────────────────────────

Data Preparation

# Load data
data1 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/diy-gsea/data.json")$exampleData$textarea[[1]])
data1 <- as.data.frame(data1)
data2 <- data.table::fread(jsonlite::read_json("https://hiplot.cn/ui/basic/diy-gsea/data.json")$exampleData$textarea[[2]])
data2 <- as.data.frame(data2)

# convert data structure
data1[,2] <- as.numeric(data1[,2])
geneList <- data1[,2]
names(geneList) <- data1[,1]
geneList <- sort(geneList, decreasing = TRUE)
term <- data.frame(term=data2[,1], gene=data2[,2])

# View data
head(term)
                         term   gene
1 GO_ADAPTIVE_IMMUNE_RESPONSE ADAM17
2 GO_ADAPTIVE_IMMUNE_RESPONSE  AICDA
3 GO_ADAPTIVE_IMMUNE_RESPONSE  ALCAM
4 GO_ADAPTIVE_IMMUNE_RESPONSE  ANXA1
5 GO_ADAPTIVE_IMMUNE_RESPONSE   BATF
6 GO_ADAPTIVE_IMMUNE_RESPONSE  BCL10

Visualization

# DIY GSEA
y <- clusterProfiler::GSEA(geneList, TERM2GENE = term, pvalueCutoff = 1)
p <- gseaplot(
  y,
  y@result$Description[1],
  color = "#000000",
  by = "runningScore",
  color.line = "#4CAF50",
  color.vline= "#FA5860",
  title = "DIY GSEA Plot",
  )

p
Figure 1: DIY GSEA