How to exclude features that intersect with other features in the same file?
1
0
Entering edit mode
2.1 years ago
Jimmy ▴ 30

Say I have one BED file with the following intervals:

  1. 100 to 200
  2. 250 to 300
  3. 290 to 350
  4. 360 to 380
  5. 375 to 400
  6. 420 to 450

In this case, interval 1 has no intersection with any other feature. Intervals 2 and 3 intersect. Intervals 4 and 5 also have an intersection. Interval 6 does not intersect any other features. Is there a way to return only intervals 1 and 6, which have no intersection with any other feature in the same file? I looked but didn't see a clear command for this in bedtools/pybedtools. For work on a single file, bedtools has merge (which combines intersecting intervals) and cluster (which doesn't combine, but just gives an ID to intersecting features within the same file), but there is no clear command that I can use to return features that have either intersections or non-intersections within the same file. The intersect and window command in bedtools can do this between two files using the v flag.

I'm looking for something closer to a bedtools window command than an intersect command for use on one file. I actually want to add a distance to both sides of each feature and only grab features in the same file that still don't intersect. In other words, I want to grab features in the same file that are a minimum distance away from any other feature in that file.

Is there a way to do this in bedtools/pybedtools, or some different way?

bedtools pybedtools bed • 559 views
ADD COMMENT
2
Entering edit mode
2.1 years ago

run bedtools intersect with the same file for -a and -b , using option -c ("For each entry in A, report the number of hits in B"). Filter for count==1.

ADD COMMENT

Login before adding your answer.

Traffic: 1730 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