Question: obtain non-overlapping regions within the file
0
gravatar for ancient_learner
4.5 years ago by
India
ancient_learner630 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 • 1.4k views
ADD COMMENTlink modified 4.5 years ago by dariober11k • written 4.5 years ago by ancient_learner630

This was already answered here

ADD REPLYlink written 4.5 years ago by venu6.7k
2
gravatar for Alex Reynolds
4.5 years ago by
Alex Reynolds30k
Seattle, WA USA
Alex Reynolds30k 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 4.5 years ago • written 4.5 years ago by Alex Reynolds30k
1
gravatar for dariober
4.5 years ago by
dariober11k
WCIP | Glasgow | UK
dariober11k wrote:

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

sort -k1,1 -k2,2n in.bed | mergeBed > merged.bed
ADD COMMENTlink written 4.5 years ago by dariober11k
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: 1738 users visited in the last hour