-
Notifications
You must be signed in to change notification settings - Fork 0
/
metaunicox.R
49 lines (41 loc) · 1.33 KB
/
metaunicox.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
m<-read.table("metaunicox")
mbb<-cbind(rownames(m),m$risk)
mbt<-t(mbb)
lncrg<-read.table("chose_lncp_ex_rg")
lnrgt<-t(lncrg)
colnames(lnrgt)<-rownames(lncrg)
rownames(lnrgt)<-colnames(lncrg)
lnrgt<-as.data.frame(lnrgt)
xl=subset(lnrgt,risk_rg=="0")
xh=subset(lnrgt,risk_rg=="1")
xlmean=apply(xl,2,mean)
xhmean=apply(xh,2,mean)
xx<-rbind(xlmean,xhmean)
xxt<-as.data.frame(t(xx))
xxt$fc=log(xxt$xhmean/xxt$xlmean,2)
write.table(xxt,"lnc_ex_rg_fc",sep="\t")
xxt<-read.table("lnc_ex_rg_fc",sep="\t")
library(enrichplot)
library(ChIPseeker)
library(GSEABase)
library(clusterProfiler)
library(org.Hs.eg.db)
xxt$entrez=?{probe...annot}
gmt<-"https://wikipathways-data.wmcloud.org/current/gmt/wikipathways-20211110-gmt-Homo_sapiens.gmt"
wp <- read.gmt.wp(gmt)
id= annot[match(rownames(xxt),annot$probe),2]
fc= xxt[match(rownames(xxt),annot$probe),3]
id=id[!is.na(id)]
fc=fc[!is.na(fc)]
a<-data.frame(id=id,fc=fc)
a=t(a[!is.na(a$id),])
a<-as.data.frame(a)
genelist<-as.numeric(a[2,])
names(genelist) = as.character(a[1,])
genelist = sort(genelist, decreasing = TRUE)
ewp <- GSEA(genelist,TERM2GENE = wp[,c("wpid","gene")],TERM2NAME = wp[,c("wpid","name")])
probe<-rownames(xxt)
ensg2entrez=toTable(org.Hs.egENSEMBL)
id= ensg2entrez[match(probe,ensg2entrez$ensembl_id),1]
annot=data.frame(probe=probe,"EntrezGene.ID"=id)
annot=annot[!is.na(annot$EntrezGene.ID),]