library(ReactomePA)
library(tidyverse)
library(data.table)
library(clusterProfiler)
library(biomaRt)
library(enrichplot)
gene <-read.csv("C:/Users/Administrator/Desktop/c-vs-Tv5.csv ", header = T,sep='\t')
gene_entrizid=bitr(gene$GeneName ,fromType="SYMBOL",toType="ENTREZID",OrgDb="org.Hs.eg.db")
gene_df <- data.frame(logFC=gene$log2FoldChange, SYMBOL = gene$GeneName)
gene_df <- merge(gene_df,gene_entrizid,by="SYMBOL")
gene_df = gene_df[!duplicated(gene_df$ENTREZID) & gene_df$ENTREZID!="" & !is.na(gene_df$ENTREZID),]
geneList<-gene_df$logFC
names(geneList)=gene_df$ENTREZID
geneList=sort(geneList,decreasing = T)
allgmt<-read.gmt("C:/Users/Administrator/Desktop/c5.all.v7.4.entrez.gmt")
genename<-gene_df$ENTREZID
genename=sort(genename,decreasing = T)
gene_df = gene_df %>% mutate(rank = rank(bat, ties.method = "random"))
geneList<-gene_df$logFC
names(geneList)=gene_df$ENTREZID
geneList=sort(geneList,decreasing = T)
gene_list = gene_df[[type]]
names(gene_list) = gene_df$ENTREZID
names(geneList)=gene_df $ENTREZID
geneList=sort(geneList,decreasing = T)
geneList=sort(geneList,decreasing = T)
KEGG<-GSEA(geneList,TERM2GENE = allgmt)
library(enrichplot)
gseaplot2(KEGG,1,color="red",pvalue_table = T)
gseaplot2(KEGG,1:10,color="red")
gseaplot2(KEGG,path1,color="red")
head(KEGG)
KEGG[1:2]
write.table(KEGG$ID,"gsea_id.txt")
path1 <- c("enplot_GOBP_273","enplot_GOBP_171")
gseaplot2(KEGG,path1,color="red")
参考网址:
https://www.keyangou.com/topic/1152
http://www.360doc.com/content/21/0622/23/65403234_983257768.shtml
http://www.360doc.com/content/19/1124/22/62751463_875243270.shtml
http://www.360doc.com/content/21/0622/23/65403234_983257768.shtml
https://zhuanlan.zhihu.com/p/358168557
https://cloud.tencent.com/developer/article/1838918
网友评论