Question: obtain non-overlapping regions within the file
0
gravatar for ancient_learner
3.1 years ago by
India
ancient_learner610 wrote:

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

non-overlapping bedtools • 903 views
ADD COMMENTlink modified 3.1 years ago by dariober10.0k • written 3.1 years ago by ancient_learner610

This was already answered here

ADD REPLYlink written 3.1 years ago by venu6.1k
2
gravatar for Alex Reynolds
3.1 years ago by
Alex Reynolds28k
Seattle, WA USA
Alex Reynolds28k wrote:

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.

ADD COMMENTlink modified 3.1 years ago • written 3.1 years ago by Alex Reynolds28k
1
gravatar for dariober
3.1 years ago by
dariober10.0k
WCIP | Glasgow | UK
dariober10.0k wrote:

...Since you tag bedtools, this should do:

sort -k1,1 -k2,2n in.bed | mergeBed > merged.bed
ADD COMMENTlink written 3.1 years ago by dariober10.0k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1315 users visited in the last hour