Question: Bedtools Intersect -v returns same file, with only one line removed
gravatar for sfox02
4.1 years ago by
sfox020 wrote:

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 • 1.4k views
ADD COMMENTlink modified 4.1 years ago by Alex Reynolds31k • written 4.1 years ago by sfox020
  1. What version of bedtools?
  2. Can you post a few relevant lines of each file?
ADD REPLYlink written 4.1 years ago by Devon Ryan98k
gravatar for Alex Reynolds
4.1 years ago by
Alex Reynolds31k
Seattle, WA USA
Alex Reynolds31k wrote:

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 COMMENTlink written 4.1 years ago by Alex Reynolds31k
Please log in to add an answer.


Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1580 users visited in the last hour