1. bedtools 对基因组染色体进行滑窗
bedtools makewindows -g CoreFlex.2kb.sizes -w 200 -s 20 > CoreFlex.2kb.sizes.200bp_20bp.bed
文件格式(CoreFlex.2kb.sizes ,使用Tab进行分隔):
C00001 5580
C00002 5275
C00003 4612
C00004 6967
C00005 5881
C00006 7173
2. bedtools 计算reads覆盖度
bedtools coverage -a TUE.gene.2kb.fasta.100bp.bed -b ${sample}.sorted.bam > ${sample}.Cov
文件格式(TUE.gene.2kb.fasta.100bp.bed,使用Tab进行分隔):
TUE00001 0 100
TUE00001 100 200
TUE00001 200 300
TUE00001 300 400
TUE00001 400 500
TUE00001 500 600
TUE00001 600 700
3. 合并bed区间(原则:先排序,后合并)
sort -k1,1 -k2,2n -k3,3n $mergedBed.tmp > $mergedBed.tmp.sorted
bedtools merge -i $mergedBed.tmp.sorted > $mergedBed