Question: Extracting reads outside the boundaries in a BED file
0
gravatar for EVR
3.1 years ago by
EVR540
Earth
EVR540 wrote:

HI,

I am new to bed file manipulations. I have two bed files like follows:

A.BED
Chr1    90       111    
Chr1    95       110
Chr1    102     115
Chr1    105     118
Chr1    107     119
Chr1    117     130

B.BED
Chr1 100   120

Now I would like to retain reads that is outside the range of B.BED. I mean I would like get the following as output

Chr1    90       111    
Chr1    95       110
Chr1    117     130

How can I get the above following output using bedtools or bedops. Kindly guide me

bed_file bedtools • 857 views
ADD COMMENTlink modified 3.1 years ago by Alex Reynolds28k • written 3.1 years ago by EVR540
1
gravatar for Alex Reynolds
3.1 years ago by
Alex Reynolds28k
Seattle, WA USA
Alex Reynolds28k wrote:

Via bedops, you can get all elements from set A which do not overlap entirely in set B via the -n 100% option:

$ bedops -n 100% A.bed B.bed > answer.bed
$ more answer.bed
Chr1    90  111
Chr1    95  110
Chr1    117 130

Basically, if there is any portion of an interval in A that is outside of B, -n 100% will report that interval.

It is the converse operation of -e 100%, if that helps. The -e 100% option reports all elements in A that are contained fully within elements in B, and, accordingly, -n 100% reports all elements which are not.

For details, please see: https://bedops.readthedocs.io/en/latest/content/reference/set-operations/bedops.html#not-element-of-n-not-element-of

ADD COMMENTlink modified 3.1 years ago • written 3.1 years ago by Alex Reynolds28k
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: 536 users visited in the last hour