# Install packages
if (!requireNamespace("clusterProfiler", quietly = TRUE)) {
install_github("YuLab-SMU/clusterProfiler")
}
# Load packages
library(clusterProfiler)
DIY GSEA
Make your geneset.
Setup
System Requirements: Cross-platform (Linux/MacOS/Windows)
Programming language: R
Dependent packages:
clusterProfiler
Data Preparation
# Load data
<- read.delim("files/Hiplot/044-diy-gsea-data1.txt", header = T)
data1 <- read.delim("files/Hiplot/044-diy-gsea-data2.txt", header = T)
data2
# convert data structure
2] <- as.numeric(data1[,2])
data1[,<- data1[,2]
geneList names(geneList) <- data1[,1]
<- sort(geneList, decreasing = TRUE)
geneList <- data.frame(term=data2[,1], gene=data2[,2])
term
# 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
<- clusterProfiler::GSEA(geneList, TERM2GENE = term, pvalueCutoff = 1)
y <- gseaplot(
p
y,@result$Description[1],
ycolor = "#000000",
by = "runningScore",
color.line = "#4CAF50",
color.vline= "#FA5860",
title = "DIY GSEA Plot",
)
p
