-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpaul_volcanoPlot.R
214 lines (191 loc) · 8.27 KB
/
paul_volcanoPlot.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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
res=read.table("atac.diffreps.annotated", sep="\t",header=T)
#down:23466 up:15360
pdf("pie_Open_in_NT.pdf")
tdown=table(res$Feature[res$Event=="Down"])
names(tdown) = paste(names(tdown)," ",round(tdown/sum(tdown)*100,digits=2),"%",sep="")
pie(tdown, main="Distribution of chromatin regions open in NT compared to SH\n(23,466 regions)")
dev.off()
pdf("pie_Open_in_SH.pdf")
tup=table(res$Feature[res$Event=="Up"])
names(tup) = paste(names(tup)," ",round(tup/sum(tup)*100,digits=2),"%",sep="")
pie(tup, main="Distribution of chromatin regions open in SH compared to NT\n(15,360 regions)")
dev.off()
#########
#annotatePeaks.pl Down_NT.bed hg19 -annStats Down_NT.annStats > Down_NT.anno
#annotatePeaks.pl Up_SH.bed hg19 -annStats Up_SH.annStats > Up_SH.anno
pdf("pie_homer_Open_in_NT.pdf")
par(mar=c(5.1,4.1,4.1,7))
res=read.table(pipe("more Down_NT.annStats |grep -v '0.0'|cut -f1,2,4|tail -n +10"), sep="\t",header=F)
tdown = res[,2]
names(tdown) = res[,1]
names(tdown) = paste(names(tdown)," ",round(tdown/sum(tdown)*100,digits=2),"%",sep="")
tdown = tdown[tdown>16]
pie(tdown, main="Distribution of chromatin regions open in NT compared to SH\n(23,466 regions)")
dev.off()
pdf("pie_homer_Open_in_SH.pdf")
res=read.table(pipe("more Up_SH.annStats |grep -v '0.0'|cut -f1,2,4|tail -n +10"), sep="\t",header=F)
tup = res[,2]
names(tup) = res[,1]
names(tup) = paste(names(tup)," ",round(tup/sum(tup)*100,digits=2),"%",sep="")
tup = tup[tup>16]
pie(tup, main="Distribution of chromatin regions open in SH compared to NT\n(15,360 regions)")
dev.off()
#####
pdf("enrichment_homer_in_NT.pdf")
par(mar=c(11.1,4.1,4.1,2))
res=read.table(pipe("more Down_NT.annStats |grep -v '0.0'|cut -f1,2,4|tail -n +10"), sep="\t",header=F)
tdown = res[,3]
names(tdown) = res[,1]
names(tdown) = paste(names(tdown)," ",round(tdown/sum(tdown)*100,digits=2),"%",sep="")
tdown = tdown[res[,2]>16]
barplot(sort(tdown),las=2,ylim=c(-2.5,5),ylab="Log2 Enrichment",col="lightblue3")
dev.off()
pdf("enrichment_homer_in_SH.pdf")
par(mar=c(11.1,4.1,4.1,2))
res=read.table(pipe("more Up_SH.annStats |grep -v '0.0'|cut -f1,2,4|tail -n +10"), sep="\t",header=F)
tup = res[,3]
names(tup) = res[,1]
names(tup) = paste(names(tup)," ",round(tup/sum(tup)*100,digits=2),"%",sep="")
tup = tup[res[,2]>16]
barplot(sort(tup),las=2,ylim=c(-2.5,5),ylab="Log2 Enrichment",col="lightblue3")
dev.off()
###########################################################################################
################################################################################################################
pdf("pie_homer_Open_in_NT.pdf")
res=read.table(pipe("more Down_NT.annStats |cut -f1,2,4"), sep="\t",header=F)
i1 = which(res[,1]=="Annotation")[2]+1
i2 = dim(res)[1]
res = res[ i1:i2,]
tdown = as.numeric(as.character(res[,2]))
names(tdown) = res[,1]
names(tdown) = paste(names(tdown)," ",round(tdown/sum(tdown)*100,digits=2),"%",sep="")
tdown = tdown[tdown>200]
pie(sort(tdown), main=,cex=.8)
title("Distribution of chromatin regions open in NT compared to SH\n(23,466 regions)", cex.main=.9)
dev.off()
pdf("pie_homer_Open_in_SH.pdf")
res=read.table(pipe("more Up_SH.annStats |cut -f1,2,4"), sep="\t",header=F)
i1 = which(res[,1]=="Annotation")[2]+1
i2 = dim(res)[1]
res = res[ i1:i2,]
tdown = as.numeric(as.character(res[,2]))
names(tdown) = res[,1]
names(tdown) = paste(names(tdown)," ",round(tdown/sum(tdown)*100,digits=2),"%",sep="")
tdown = tdown[tdown>200]
pie(sort(tdown), main=,cex=.8)
title("Distribution of chromatin regions open in SH compared to NT\n(15,360 regions)", cex.main=.9)
dev.off()
####################################################################################
#####
pdf("enrichment_homer_in_NT.pdf")
par(mar=c(11.1,4.1,4.1,2))
res=read.table(pipe("more Down_NT.annStats |cut -f1,2,4"), sep="\t",header=F)
i1 = which(res[,1]=="Annotation")[2]+1
i2 = dim(res)[1]
res = res[ i1:i2,]
tdown = as.numeric(as.character(res[,2]))
names(tdown) = res[,1]
names(tdown) = paste(names(tdown)," ",round(tdown/sum(tdown)*100,digits=2),"%",sep="")
enrich = as.numeric(as.character(res[tdown>200,3]))
tdown = tdown[tdown>200]
names(enrich) = names(tdown)
barplot(sort(enrich),las=2,ylim=c(-2.5,5),ylab="Log2 Enrichment",col="lightblue3")
abline(h=0)
dev.off()
pdf("enrichment_homer_in_SH.pdf")
par(mar=c(11.1,4.1,4.1,2))
res=read.table(pipe("more Up_SH.annStats |cut -f1,2,4"), sep="\t",header=F)
i1 = which(res[,1]=="Annotation")[2]+1
i2 = dim(res)[1]
res = res[ i1:i2,]
tdown = as.numeric(as.character(res[,2]))
names(tdown) = res[,1]
names(tdown) = paste(names(tdown)," ",round(tdown/sum(tdown)*100,digits=2),"%",sep="")
enrich = as.numeric(as.character(res[tdown>200,3]))
tdown = tdown[tdown>200]
names(enrich) = names(tdown)
barplot(sort(enrich),las=2,ylim=c(-2.5,5),ylab="Log2 Enrichment",col="lightblue3")
abline(h=0)
dev.off()
###########################################################################################
################################################################################################################
pdf("pie_homer_Open_in_NT_noThreshold.pdf")
res=read.table(pipe("more Down_NT.annStats |cut -f1,2,4"), sep="\t",header=F)
i1 = which(res[,1]=="Annotation")[2]+1
i2 = dim(res)[1]
res = res[ i1:i2,]
tdown = as.numeric(as.character(res[,2]))
names(tdown) = res[,1]
names(tdown) = paste(names(tdown)," ",round(tdown/sum(tdown)*100,digits=2),"%",sep="")
pie(sort(tdown), main=,cex=.8)
title("Distribution of chromatin regions open in NT compared to SH\n(23,466 regions)", cex.main=.9)
dev.off()
pdf("pie_homer_Open_in_SH_noThreshold.pdf")
res=read.table(pipe("more Up_SH.annStats |cut -f1,2,4"), sep="\t",header=F)
i1 = which(res[,1]=="Annotation")[2]+1
i2 = dim(res)[1]
res = res[ i1:i2,]
tdown = as.numeric(as.character(res[,2]))
names(tdown) = res[,1]
names(tdown) = paste(names(tdown)," ",round(tdown/sum(tdown)*100,digits=2),"%",sep="")
pie(sort(tdown), main=,cex=.8)
title("Distribution of chromatin regions open in SH compared to NT\n(15,360 regions)", cex.main=.9)
dev.off()
####################################################################################
#####
pdf("enrichment_homer_in_NT_noThreshold.pdf")
par(mar=c(11.1,4.1,4.1,2))
res=read.table(pipe("more Down_NT.annStats |cut -f1,2,4"), sep="\t",header=F)
i1 = which(res[,1]=="Annotation")[2]+1
i2 = dim(res)[1]
res = res[ i1:i2,]
tdown = as.numeric(as.character(res[,2]))
names(tdown) = res[,1]
names(tdown) = paste(names(tdown)," ",round(tdown/sum(tdown)*100,digits=2),"%",sep="")
enrich = as.numeric(as.character(res[,3]))
tdown = tdown
names(enrich) = names(tdown)
barplot(sort(enrich),las=2,ylim=c(-2.5,5),ylab="Log2 Enrichment",col="lightblue3")
abline(h=0)
dev.off()
pdf("enrichment_homer_in_SH_noThreshold.pdf")
par(mar=c(11.1,4.1,4.1,2))
res=read.table(pipe("more Up_SH.annStats |cut -f1,2,4"), sep="\t",header=F)
i1 = which(res[,1]=="Annotation")[2]+1
i2 = dim(res)[1]
res = res[ i1:i2,]
tdown = as.numeric(as.character(res[,2]))
names(tdown) = res[,1]
names(tdown) = paste(names(tdown)," ",round(tdown/sum(tdown)*100,digits=2),"%",sep="")
enrich = as.numeric(as.character(res[,3]))
tdown = tdown
names(enrich) = names(tdown)
barplot(sort(enrich),las=2,ylim=c(-2.5,5),ylab="Log2 Enrichment",col="lightblue3")
abline(h=0)
dev.off()
###########################################################################################
################################################################################################################
pdf("pie_homer_Open_in_NT_white.pdf")
res=read.table(pipe("more Down_NT.annStats |cut -f1,2,4"), sep="\t",header=F)
i1 = which(res[,1]=="Annotation")[2]+1
i2 = dim(res)[1]
res = res[ i1:i2,]
tdown = as.numeric(as.character(res[,2]))
names(tdown) = res[,1]
names(tdown) = paste(names(tdown)," ",round(tdown/sum(tdown)*100,digits=2),"%",sep="")
tdown = tdown[tdown>200]
pie(sort(tdown), main=,cex=.8,col=NA)
title("Distribution of chromatin regions open in NT compared to SH\n(23,466 regions)", cex.main=.9)
dev.off()
pdf("pie_homer_Open_in_SH_white.pdf")
res=read.table(pipe("more Up_SH.annStats |cut -f1,2,4"), sep="\t",header=F)
i1 = which(res[,1]=="Annotation")[2]+1
i2 = dim(res)[1]
res = res[ i1:i2,]
tdown = as.numeric(as.character(res[,2]))
names(tdown) = res[,1]
names(tdown) = paste(names(tdown)," ",round(tdown/sum(tdown)*100,digits=2),"%",sep="")
tdown = tdown[tdown>200]
pie(sort(tdown), main=,cex=.8,col=NA)
title("Distribution of chromatin regions open in SH compared to NT\n(15,360 regions)", cex.main=.9)
dev.off()