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
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.