page

Apr 8, 2020

bedops --chop : chop bed into identical intervals


https://bedops.readthedocs.io/en/latest/content/reference/set-operations/bedops.html

The --chop operator merges all overlapping input regions and “chops” them up into a set of disjoint segments of identical length (with a default of one base). One or more input files may be provided; this option will segment regions from all inputs:

Note
Overlapping and nested regions are merged into contiguous ranges before chopping. The end result contains unique, non-overlapping elements.

(base) [lee@ko44 annotation]$ more chrom.sizes.chr.TAIR10.bed
chr1    0    30427671
chr2    0    19698289 
chr3    0    23459830
chr4    0    18585056
chr5    0    26975502


 (base) [lee@ko44 annotation]$ bedops --chop 1000 chrom.sizes.chr.TAIR10.bed > arabidopsis_1kb_chr1_5.bed

(base) [lee@ko44 annotation]$ more arabidopsis_1kb_chr1_5.bed
chr1    0    1000
chr1    1000    2000
chr1    2000    3000
chr1    3000    4000
chr1    4000    5000
chr1    5000    6000
chr1    6000    7000
chr1    7000    8000