Extracting reads outside the boundaries in a BED file
2
0
Entering edit mode
8.4 years ago
EVR ▴ 610

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 • 1.9k views
ADD COMMENT
1
Entering edit mode
8.4 years ago

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 COMMENT

Login before adding your answer.

Traffic: 1547 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6