-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathvenn.R
71 lines (55 loc) · 2.12 KB
/
venn.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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
library(Vennerable)
setwd("/proj/hyejunglab/crossdisorder/Revision/hubenxia/")
background_SCZ<-read.table("/proj/hyejunglab/crossdisorder/Revision/hubenxia/background_SCZ.txt",header=T,sep="\t")
SCZ_gene<-read.table("/proj/hyejunglab/crossdisorder/Revision/hubenxia/SCZ_gene.txt", header=T,sep="\t")[,1] #coloc
MAGMAv26_SCZ_gene<-read.table("/proj/hyejunglab/crossdisorder/Revision/hubenxia/MAGMAv26_SCZ_gene.txt", header=T,sep="\t")[,1]
coloc_backgroundid<-read.table("/proj/hyejunglab/crossdisorder/Revision/hubenxia/coloc_backgroundid.txt", header=T,sep="\t")[,1]
background_SCZ$FDR<-p.adjust(background_SCZ[,2], method= "BH")
background_SCZ<-background_SCZ[background_SCZ$FDR<0.05,][,1]
gplot<-function(input,target,filename){
gene<-list(disease=input,coloc=target)
Vdemo<-Venn(gene)
pdf(paste0(filename,"_coloc_overlap_gene.pdf"))
p<-plot(Vdemo, doWeights = TRUE, type = "circles")
print (p)
dev.off()
}
gplot(background_SCZ,SCZ_gene,'SCZ')
gplot(background_SCZ,MAGMAv26_SCZ_gene,'MAGMAv26_SCZ')
SCZ_coloc<-181
SCZ_only<-4396
colc_only<-74
two_gene<-union(background_SCZ,SCZ_gene)
SCZ_background<-length(setdiff(coloc_backgroundid,two_gene))
SCZ<-matrix(c(SCZ_coloc,SCZ_only,colc_only,SCZ_background),2,2)
fisher.result<-fisher.test(SCZ)
#fisher.result$p.value
[1] 3.195631e-93
#Fisher's Exact Test for Count Data
data: SCZ
p-value < 2.2e-16
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
11.33803 19.92837
sample estimates:
odds ratio
14.96772
MAGMAv26_SCZ_coloc<-189
MAGMAv26_SCZ_only<-4679
colc_only<-66
two_gene<-union(background_SCZ,MAGMAv26_SCZ_gene)
SCZ_background<-length(setdiff(coloc_backgroundid,two_gene))
SCZ<-matrix(c(MAGMAv26_SCZ_coloc,MAGMAv26_SCZ_only,colc_only,SCZ_background),2,2)
fisher.result<-fisher.test(SCZ)
#fisher.result$p.value
[1] 4.935881e-98
#fisher.result
Fisher's Exact Test for Count Data
data: SCZ
p-value < 2.2e-16
alternative hypothesis: true odds ratio is not equal to 1
95 percent confidence interval:
12.22895 21.93239
sample estimates:
odds ratio
16.29126