-
Notifications
You must be signed in to change notification settings - Fork 1
/
mergebed_Sp_YS.txt
134 lines (110 loc) · 4.43 KB
/
mergebed_Sp_YS.txt
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
# Sp data only
# 03.30.2020- goal is to combine files together (DAP-Seq)
# by Ying Sun
Bedtools: Keep if it occurs in 2 or more files-- save peaks
Venn diagram to check: checked and the more files, the more peaks you can find
# Sp-Shoot_ABF1
module load bedtools/2.26.0
# This will chop each peak to 8bp
# Then also sorting
for f in *.narrowPeak; do
awk -v OFS='\t' '{$2=$2+97} {$3=$3-97} {print $0}' $f | awk -v OFS="\t" '{ if ($2<0) {$2=0}} {print $0}' | sort -k1,1 -k2,2n > ${f}_7bp
done
for f in *.narrowPeak_7bp; do
wc -l "$f"
done
########################
5853 sorted_Sp-SpABF1a-Spshoot-QR1-10-24-2016-CTTGTA_S1_out_GEM_events.narrowPeak
5993 sorted_Sp-SpABF1b-Spshoot-QR2-1-27-2017-CAAGCT_S1_out_GEM_events.narrowPeak
########################
cat *.narrowPeak_7bp | sort -k1,1 -k2,2n > ${PWD##*/}.bed
bedtools merge -c 1 -o count -i ${PWD##*/}.bed > ${PWD##*/}.merged.bed
awk -v OFS="\t" -v t=$t '$4>=2 {print $0}' ${PWD##*/}.merged.bed > ${PWD##*/}.mergedfiltered.bed
for f in *.bed; do
wc -l "$f"
done
# All peaks, merged peaks, final peaks
########################
11846 Sp_Shoot_SpABF1.bed
7010 Sp_Shoot_SpABF1.merged.bed
4819 Sp_Shoot_SpABF1.mergedfiltered.bed
########################
# Sp-Shoot_ABF2
module load bedtools/2.26.0
# This will chop each peak to 8bp
# Then also sorting
for f in *.narrowPeak; do
awk -v OFS='\t' '{$2=$2+97} {$3=$3-97} {print $0}' $f | awk -v OFS="\t" '{ if ($2<0) {$2=0}} {print $0}' | sort -k1,1 -k2,2n > ${f}_7bp
done
for f in *.narrowPeak_7bp; do
wc -l "$f"
done
########################
9792 sorted_Sp-SpABF2a-Spshoot-QR1-10-24-2016-CATCGA_S1_out_GEM_events.narrowPeak
9852 sorted_Sp-SpABF2b-Spshoot-QR2-1-27-2017-TGACAC_S1_out_GEM_events.narrowPeak
########################
cat *.narrowPeak_7bp | sort -k1,1 -k2,2n > ${PWD##*/}.bed
bedtools merge -c 1 -o count -i ${PWD##*/}.bed > ${PWD##*/}.merged.bed
awk -v OFS="\t" -v t=$t '$4>=2 {print $0}' ${PWD##*/}.merged.bed > ${PWD##*/}.mergedfiltered.bed
for f in *.bed; do
wc -l "$f"
done
# All peaks, merged peaks, final peaks
########################
19644 Sp_Shoot_SpABF2.bed
11986 Sp_Shoot_SpABF2.merged.bed
7598 Sp_Shoot_SpABF2.mergedfiltered.bed
########################
# Sp-Shoot_ABF3
module load bedtools/2.26.0
# This will chop each peak to 8bp
# Then also sorting
for f in *.narrowPeak; do
awk -v OFS='\t' '{$2=$2+97} {$3=$3-97} {print $0}' $f | awk -v OFS="\t" '{ if ($2<0) {$2=0}} {print $0}' | sort -k1,1 -k2,2n > ${f}_7bp
done
for f in *.narrowPeak_7bp; do
wc -l "$f"
done
########################
9295 sorted_Sp-SpABF3a-Spshoot-QR1-10-24-2016-TAGACC_S1_out_GEM_events.narrowPeak
9092 sorted_Sp-SpABF3b-Spshoot-QR2-1-27-2017-GTTCGA_S1_out_GEM_events.narrowPeak
########################
cat *.narrowPeak_7bp | sort -k1,1 -k2,2n > ${PWD##*/}.bed
bedtools merge -c 1 -o count -i ${PWD##*/}.bed > ${PWD##*/}.merged.bed
awk -v OFS="\t" -v t=$t '$4>=2 {print $0}' ${PWD##*/}.merged.bed > ${PWD##*/}.mergedfiltered.bed
for f in *.bed; do
wc -l "$f"
done
# All peaks, merged peaks, final peaks
########################
18387 Sp_Shoot_SpABF3.bed
10908 Sp_Shoot_SpABF3.merged.bed
7448 Sp_Shoot_SpABF3.mergedfiltered.bed
########################
# Sp-Shoot_ABF4
module load bedtools/2.26.0
# This will chop each peak to 8bp
# Then also sorting
for f in *.narrowPeak; do
awk -v OFS='\t' '{$2=$2+97} {$3=$3-97} {print $0}' $f | awk -v OFS="\t" '{ if ($2<0) {$2=0}} {print $0}' | sort -k1,1 -k2,2n > ${f}_7bp
done
for f in *.narrowPeak_7bp; do
wc -l "$f"
done
########################
7950 sorted_Sp-SpABF4a-Spshoot-Q-02-05-2020-CAGCATAC_S1_out_GEM_events.narrowPeak
8863 sorted_Sp-SpABF4b-Spshoot-Q-02-05-2020-CGAGAGAA_S1_out_GEM_events.narrowPeak
10729 sorted_Sp-SpABF4c-Spshoot-Q-02-05-2020-GGTATAGG_S1_out_GEM_events.narrowPeak
########################
cat *.narrowPeak_7bp | sort -k1,1 -k2,2n > ${PWD##*/}.bed
bedtools merge -c 1 -o count -i ${PWD##*/}.bed > ${PWD##*/}.merged.bed
awk -v OFS="\t" -v t=$t '$4>=2 {print $0}' ${PWD##*/}.merged.bed > ${PWD##*/}.mergedfiltered.bed
for f in *.bed; do
wc -l "$f"
done
# All peaks, merged peaks, final peaks
########################
27542 Sp_Shoot_SpABF4.bed
12506 Sp_Shoot_SpABF4.merged.bed
8472 Sp_Shoot_SpABF4.mergedfiltered.bed
########################