Say I have one BED file with the following intervals:
- 100 to 200
- 250 to 300
- 290 to 350
- 360 to 380
- 375 to 400
- 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?