set -e shome=~/script/bed hg19_map=/cgdata/guocq/TEST/exac_ref/wgEncodeCrgMapabilityAlign75mer.bigWig hg19_gc=/cgdata/guocq/TEST/exac_ref/ucsc.hg19.gc5Base.bw hg19_fai=/cgdata/guocq/TEST/exac_ref/ucsc.hg19.fasta.fai prebed=FeBY2_20210902.sorted.hg19 sortBed -i ${prebed}.bed |slopBed -g $hg19_fai -b 65 |mergeBed -c 4 -o distinct |awk '{print $0"\t0\t+"}' > ${prebed}.slop.bed perl $shome/dedep_bed.pl ${prebed}.slop.bed windowMaker -b ${prebed}.slop.uniq120.bed -i srcwinnum -w 120 |awk '{print $0"\t0\t+"}' > ${prebed}.uniq120.bed bigWigAverageOverBed $hg19_map ${prebed}.uniq120.bed ${prebed}.uniq120.chr_Mapability.tab -bedOut=${prebed}.uniq120.chr_Mapability.bed bigWigAverageOverBed $hg19_gc ${prebed}.uniq120.bed ${prebed}.uniq120.gc5Base.tab -bedOut=${prebed}.uniq120.gc5Base.bed perl $shome/bed_CG_Map.pl ${prebed}.uniq120.chr_Mapability.bed ${prebed}.uniq120.gc5Base.bed ${prebed}.uniq120.gcmap.bed awk -v end=0 'BEGIN{OFS="\t"}{if($2==end){$2+=1};print $0;end=$3 }' ${prebed}.uniq120.gcmap.bed \ > ${prebed}.uniq120.gcmap.1.bed mv ${prebed}.uniq120.gcmap.1.bed ${prebed}.uniq120.gcmap.bed