Question: Bedtools Intersect Error
0
gravatar for dally
4.1 years ago by
dally180
United States
dally180 wrote:

I am trying to intersect two bed files using the intersectBed command of bedtools. But I am generating an error when I haven't run into it before generating these files originally.

I run this:

intersectBed -a H3K1-Chip.MACS2_peaks.narrowPeak -b pol_summits_windowed > pol-H3K1-model

And it generates this error:

Error: Invalid record in file pol_summits_windowed. Record is 

chr1    249106180    248956422    Pol-II-Chip.MACS2_peak_8225    22.27517

It seems to be incorrectly adding and subtracting flanks

This is from the unflanked file that i'm trying to flank:

chr1    249106179    249106180    Pol-II-Chip.MACS2_peak_8225

 

The pol_summits_windowed was created in bedtools using a pol_summit bed file from the sequencing core called by MACS and flanked 250bp in either direction using the flankBed function from bedtools.

The narrowpeak file is a file with all peaks of H3K4me1 from sequencing core. I want to interesect the peaks from this file that overlap my flanked summit file.

Looking at it it seems the chr str is larger than chr end. Don't know what went wrong in the flank command.

 

Any ideas? It works fine if I don't flank my pol summit file, but then I lose out on some H3K4me1 peaks.

 

EDIT: It's also useful if I not that I have flankedBed this file BEFORE. So that might be giving me the error.

error intersect bedtools • 4.4k views
ADD COMMENTlink modified 4.1 years ago • written 4.1 years ago by dally180
2
gravatar for Joseph Pearson
4.1 years ago by
UNC Chapel Hill
Joseph Pearson450 wrote:

The end site is before the start site.

ADD COMMENTlink written 4.1 years ago by Joseph Pearson450

Yes I'm aware that is the problem now. However, this is caused by the flankBed option because otherwise it works. How do I flank these summits without it causing this?

The reason I need to flank this is because if not I am losing true positives I want to keep when intersecting my Pol summits and a mark such as H3K1

ADD REPLYlink modified 10 hours ago by RamRS24k • written 4.1 years ago by dally180

I'm not sure why that's happening, but as long as the coordinates are correct (except that they are reverse order), you can fix this with awk (or excel). Do the ranges look right?

ADD REPLYlink written 4.1 years ago by Joseph Pearson450

the ranges are correct, the problem is that this only occurs for some start and end coordinates .. not all of them

ADD REPLYlink written 4.1 years ago by dally180

Weird, wonder if it has something to do with the size of the interval. Anyway, yeah, an awk one-liner or excel formula should be able to fix that. Sure is frustrating, though!

ADD REPLYlink written 4.1 years ago by Joseph Pearson450
Please log in to add an answer.

Help
Access

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