Reference Code backup Executable files
Remove overlapping records from a (sorted) bed file.
bedRemoveOverlap in.bed out.bed
This tool is part of UCSC Genome Browser's utilities.
For overlapping regions, this tool only keep the longest records and discards all other records. You may find tools like bedtools
and bedops useful for similar purposes.
Assume you have a bed file (test.bed, corresponds to the argument in.bed) which stores three overlapping records:
$ head test.bed chr1 100 200 big chr1 108 110 small chr1 110 220 bigger
Runing bedRemoveOverlap and write the output to a file called test.out.bed (corresponds to the argument out.bed), here is what you will get:
$ bedRemoveOverlap test.bed test.out.bed $ head test.out.bed chr1 110 220 bigger