-
Notifications
You must be signed in to change notification settings - Fork 0
/
GSEA.analysis.r
30 lines (21 loc) · 1.09 KB
/
GSEA.analysis.r
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
library(ReactomePA)
library(tidyverse)
library(data.table)
library(org.Mm.eg.db)
library(clusterProfiler)
library(biomaRt)
library(enrichplot)
genelist_input <- fread(file="all.df.gene.8m.csv", header = T, sep=',', data.table = F)
colnames(genelist_input)[1] <- "Gene"
genename <- as.character(genelist_input[,1])
gene_map <- select(org.Mm.eg.db, keys=genename, keytype="SYMBOL", columns=c("ENTREZID"))
write.csv(as.data.frame(gene_map),"ID.transfer.csv",row.names =F)
aaa<-inner_join(gene_map,genelist_input,by = "Gene")
aaa<-na.omit(aaa)
aaa <- aaa[order(aaa$avg_log2FC,decreasing = TRUE),]
geneList <- aaa$avg_log2FC
names(geneList) <- as.character(aaa$ENTREZID)
Go_gseresult <- gseGO(geneList, 'org.Mm.eg.db', keyType = "ENTREZID", ont="all", nPerm = 1000, minGSSize = 10, maxGSSize = 1000,pvalueCutoff = 1)
KEGG_gseresult <- gseKEGG(geneList, nPerm = 1000, minGSSize = 10, maxGSSize = 1000, pvalueCutoff=1, organism = "mmu")
rectomepath <-enrichPathway(gene=aaa$ENTREZID,pvalueCutoff=0.05, readable=T, qvalueCutoff = 0.05, organism = "mouse")
dotplot(KEGG,split=".sign")+facet_wrap(~.sign,scales = "free")