- What version of bedtools?
- Can you post a few relevant lines of each file?
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.
1 answer
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
Log in to answer this question.