Bedtools Intersect -v returns same file, with only one line removed
1
0
Entering edit mode
7.2 years ago
sfox02 • 0

I have two bed files, a file with peaks, and a file I created to be +/- 1kb of the TSS in mm9.

When I try to use bedtools intersect -v to find all of the peaks that are not overlapping with the 1kb region around a TSS, it returns the same peak file, but with one line different:

$ bedtools intersect -v -a ProE_replicatePeaks.bed -b 1kbTSS.bed > ATAC_Not_Pr.bed

$ wc -l ProE_replicatePeaks.bed

17440 ProE_replicatePeaks.bed

$ wc -l ATAC_Not_Pr.bed

17439 ATAC_Not_Pr.bed

I thought maybe I needed to sort the file containing the region around the TSS, but the same problem occurred.

Any input is appreciated! Thanks.

ChIP-Seq software error • 2.1k views
ADD COMMENT
0
Entering edit mode
  1. What version of bedtools?
  2. Can you post a few relevant lines of each file?
ADD REPLY
1
Entering edit mode
7.2 years ago

Are you expecting no overlaps? Perhaps try BEDOPS, in order to see what answer you get with an alternative toolkit.

First, sort the inputs:

$ sort-bed ProE_replicatePeaks.unknownSortOrder.bed > ProE_replicatePeaks.bed 
$ sort-bed 1kbTSS.unknownSortOrder.bed > 1kbTSS.bed

Then do the exclusion operation:

$ bedops --not-element-of 1 ProE_replicatePeaks.bed 1kbTSS.bed > ATAC_Not_Pr.bed

You could also do the opposite operation:

$ bedops --element-of 1 ProE_replicatePeaks.bed 1kbTSS.bed > ATAC_Pr.bed

In theory, if the first operation worked in the same way, you would get one BED element from the second operation, with which you can do a sanity check by comparing 1kbTSS.bed with ATAC_Pr.bed:

$ bedmap --echo --echo-map 1kbTSS.bed ATAC_Pr.bed > sanityCheck.bed
ADD COMMENT

Login before adding your answer.

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