-
Notifications
You must be signed in to change notification settings - Fork 1
/
Fig3_chipseq_prom_enh_overlap.sh
executable file
·110 lines (69 loc) · 6.04 KB
/
Fig3_chipseq_prom_enh_overlap.sh
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
#A promoter region is defined as H3K27ac positive, H3K4me3 positive and within 2.5kb +/- TSS where TSS - GENCODE transcripts
#A enhancer region is defined as H3K27ac positive, H3K4me1 positive and non-overlapping with promoter
out=/mnt/projects/yaoxs/cancer_chipseqxs/PBRM1/intersect
TSS_2000_GENCODE=/mnt/projects/yaoxs/cancer_chipseqxs/kidney/others/UCSC.hg19.knownGene.tss.4kb.bed
peak_dir=/mnt/projects/tanbop/intergrated_genomics/rcc/chip/MACS2/
# histone peak regions
H3K27ac_WT=project197.mem/RCC431.merged.bam.sort.bam.mapQ.bam.bed_vs_RCC407.merged.bam.sort.bam.mapQ.bam.bed_peaks.bed
H3K27ac_KO=project197.mem/RCC432.merged.bam.sort.bam.mapQ.bam.bed_vs_RCC429.merged.bam.sort.bam.mapQ.bam.bed_peaks.bed
H3K4me3_WT=project197.mem/RCC435.merged.bam.sort.bam.mapQ.bam.bed_vs_RCC407.merged.bam.sort.bam.mapQ.bam.bed_peaks.bed
H3K4me3_KO=project197.mem/RCC436.merged.bam.sort.bam.mapQ.bam.bed_vs_RCC429.merged.bam.sort.bam.mapQ.bam.bed_peaks.bed
H3K4me1_WT=project208.mem/RCC542.merged.bam.sort.bam.mapQ.bam.bed_vs_RCC543.merged.bam.sort.bam.mapQ.bam.bed_peaks.bed
H3K4me1_KO=project208.mem/RCC547.merged.bam.sort.bam.mapQ.bam.bed_vs_RCC548.merged.bam.sort.bam.mapQ.bam.bed_peaks.bed
# SWI/SNF peak regions
#PBRM1
PBRM1_1=project179.mem/RCC346.merged.bam.sort.bam.mapQ.bam.bed_vs_RCC341.merged.bam.sort.bam.mapQ.bam.bed_peaks.bed
PBRM1_2=project194.mem/RCC406.merged.bam.sort.bam.mapQ.bam.bed_vs_RCC407.merged.bam.sort.bam.mapQ.bam.bed_peaks.bed
PBRM1_3=project194.mem/RCC408.merged.bam.sort.bam.mapQ.bam.bed_vs_RCC409.merged.bam.sort.bam.mapQ.bam.bed_peaks.bed
#ARID1A
ARID1A_1=project211.mem/RCC575.merged.bam.sort.bam.mapQ.bam.bed_vs_RCC543.merged.bam.sort.bam.mapQ.bam.bed_peaks.bed
ARID1A_2=project211.mem/RCC576.merged.bam.sort.bam.mapQ.bam.bed_vs_RCC548.merged.bam.sort.bam.mapQ.bam.bed_peaks.bed
#ARID2
ARID2_1=project188.mem/RCC366_peaks.bed
ARID2_2=project211.mem/RCC578.merged.bam.sort.bam.mapQ.bam.bed_vs_RCC543.merged.bam.sort.bam.mapQ.bam.bed_peaks.bed
#BRD7
BRD7_1=project209.mem/RCC562.merged.bam.sort.bam.mapQ.bam.bed_vs_RCC543.merged.bam.sort.bam.mapQ.bam.bed_peaks.bed
BRD7_2=project209.mem/RCC570.merged.bam.sort.bam.mapQ.bam.bed_vs_RCC548.merged.bam.sort.bam.mapQ.bam.bed_peaks.bed
#SMARCA4
SMARCA4_1=project188.mem/RCC364_peaks.bed
SMARCA4_2=project211.mem/RCC577.merged.bam.sort.bam.mapQ.bam.bed_vs_RCC543.merged.bam.sort.bam.mapQ.bam.bed_peaks.bed
#merge H3K27ac
#merge H3K4me3
#merge H3K4me1
K27ac=K27ac.merge.all.bed
K4me3=K4me3.merge.all.bed
K4me1=K4me1.merge.all.bed
cat $peak_dir/$H3K27ac_WT $peak_dir/$H3K27ac_KO |sortBed|mergeBed > $out/$K27ac
cat $peak_dir/$H3K4me3_WT $peak_dir/$H3K4me3_KO |sortBed|mergeBed > $out/$K4me3
cat $peak_dir/$H3K4me1_WT $peak_dir/$H3K4me1_KO |sortBed|mergeBed > $out/$K4me1
#promoters
bedtools intersect -a $out/"$K27ac" -b $out/"$K4me3" > $out/K27ac.K4me3.bed
bedtools intersect -u -a $out/K27ac.K4me3.bed -b $TSS_2000_GENCODE |uniq > $out/K27ac.K4me3.TSS_2000_GENCODE.bed
awk '{print $1 "\t" $2 "\t" $3 "\t" $4 "prom-"(NR+1000000)}' $out/K27ac.K4me3.TSS_2000_GENCODE.bed > $out/K27ac.K4me3.TSS_2000_GENCODE.ID.bed
#enhancers
bedtools intersect -a $out/"$K27ac" -b $out/"$K4me1" > $out/K27ac.K4me1.bed
bedtools intersect -v -a $out/K27ac.K4me1.bed -b $out/K27ac.K4me3.TSS_2000_GENCODE.bed |uniq > $out/K27ac.K4me1.noprom.bed
awk '{print $1 "\t" $2 "\t" $3 "\t" $4 "enh-"(NR+1000000)}' $out/K27ac.K4me1.noprom.bed > $out/K27ac.K4me1.noprom.ID.bed
#perform overlap with BRG1 peaks with promoters and enhancers
bedtools intersect -wa -a $peak_dir/$PBRM1_1 -b $out/K27ac.K4me3.TSS_2000_GENCODE.ID.bed |uniq > $out/PBRM1_1.promoter.bed
bedtools intersect -wa -a $peak_dir/$PBRM1_1 -b $out/K27ac.K4me1.noprom.ID.bed |uniq > $out/PBRM1_1.enhancer.bed
bedtools intersect -wa -a $peak_dir/$PBRM1_2 -b $out/K27ac.K4me3.TSS_2000_GENCODE.ID.bed |uniq > $out/PBRM1_2.promoter.bed
bedtools intersect -wa -a $peak_dir/$PBRM1_2 -b $out/K27ac.K4me1.noprom.ID.bed |uniq > $out/PBRM1_2.enhancer.bed
bedtools intersect -wa -a $peak_dir/$PBRM1_3 -b $out/K27ac.K4me3.TSS_2000_GENCODE.ID.bed |uniq > $out/PBRM1_3.promoter.bed
bedtools intersect -wa -a $peak_dir/$PBRM1_3 -b $out/K27ac.K4me1.noprom.ID.bed |uniq > $out/PBRM1_3.enhancer.bed
bedtools intersect -wa -a $peak_dir/$ARID1A_1 -b $out/K27ac.K4me3.TSS_2000_GENCODE.ID.bed |uniq > $out/ARID1A_1.promoter.bed
bedtools intersect -wa -a $peak_dir/$ARID1A_1 -b $out/K27ac.K4me1.noprom.ID.bed |uniq > $out/ARID1A_1.enhancer.bed
bedtools intersect -wa -a $peak_dir/$ARID1A_2 -b $out/K27ac.K4me3.TSS_2000_GENCODE.ID.bed |uniq > $out/ARID1A_2.promoter.bed
bedtools intersect -wa -a $peak_dir/$ARID1A_2 -b $out/K27ac.K4me1.noprom.ID.bed |uniq > $out/ARID1A_2.enhancer.bed
bedtools intersect -wa -a $peak_dir/$ARID2_1 -b $out/K27ac.K4me3.TSS_2000_GENCODE.ID.bed |uniq > $out/ARID2_1.promoter.bed
bedtools intersect -wa -a $peak_dir/$ARID2_1 -b $out/K27ac.K4me1.noprom.ID.bed |uniq > $out/ARID2_1.enhancer.bed
bedtools intersect -wa -a $peak_dir/$ARID2_2 -b $out/K27ac.K4me3.TSS_2000_GENCODE.ID.bed |uniq > $out/ARID2_2.promoter.bed
bedtools intersect -wa -a $peak_dir/$ARID2_2 -b $out/K27ac.K4me1.noprom.ID.bed |uniq > $out/ARID2_2.enhancer.bed
bedtools intersect -wa -a $peak_dir/$BRD7_1 -b $out/K27ac.K4me3.TSS_2000_GENCODE.ID.bed |uniq > $out/BRD7_1.promoter.bed
bedtools intersect -wa -a $peak_dir/$BRD7_1 -b $out/K27ac.K4me1.noprom.ID.bed |uniq > $out/BRD7_1.enhancer.bed
bedtools intersect -wa -a $peak_dir/$BRD7_2 -b $out/K27ac.K4me3.TSS_2000_GENCODE.ID.bed |uniq > $out/BRD7_2.promoter.bed
bedtools intersect -wa -a $peak_dir/$BRD7_2 -b $out/K27ac.K4me1.noprom.ID.bed |uniq > $out/BRD7_2.enhancer.bed
bedtools intersect -wa -a $peak_dir/$SMARCA4_1 -b $out/K27ac.K4me3.TSS_2000_GENCODE.ID.bed |uniq > $out/SMARCA4_1.promoter.bed
bedtools intersect -wa -a $peak_dir/$SMARCA4_1 -b $out/K27ac.K4me1.noprom.ID.bed |uniq > $out/SMARCA4_1.enhancer.bed
bedtools intersect -wa -a $peak_dir/$SMARCA4_2 -b $out/K27ac.K4me3.TSS_2000_GENCODE.ID.bed |uniq > $out/SMARCA4_2.promoter.bed
bedtools intersect -wa -a $peak_dir/$SMARCA4_2 -b $out/K27ac.K4me1.noprom.ID.bed |uniq > $out/SMARCA4_2.enhancer.bed