obtain non-overlapping regions within the file
Hi
I have a file like this
chr1 1 100
chr1 1 50
chr1 55 70
chr1 75 100
chr1 101 200
I want to obtain all non-overlapping regions into separate file. So my output will look like this
chr1 1 100
chr1 101 200
Is there any way to do this please let me know
• 3,774 views
•
link
2 answers
With BEDOPS bedops and sort-bed:
$ sort-bed input.bed | bedops --merge - > answer.bed
Sorting is required to deal with matches in the second (start position) column. Make sure your input BED file is tab-delimited.
• 2 views
•
link
...Since you tag bedtools, this should do:
sort -k1,1 -k2,2n in.bed | mergeBed > merged.bed
• 2 views
•
link
Log in to answer this question.
This was already answered here