I have two bedgraph files(a_h.bedgraph and b_h.bedgraph) with header. And I am running the following command:
bedtools intersect -header -wa -a a_h.bedgraph -b b_h.bedgraph
However I am getting the following error:
Error: unable to open file or unable to determine types for file a_h.bedgraph Please ensure that your file is TAB delimited (e.g., cat -t FILE). - Also ensure that your file has integer chromosome coordinates in the expected columns (e.g., cols 2 and 3 for BED).
When I remove the header from a_h.bedgraph and b_h.bedgraph, it works. Is there any way to keep the header after the intersection?
I am reasonably sure headers have to be indicated by
#
, is that the case with your file?I have the same problem, have you resolved?
Do you have headers? Did you make sure everything is tab-separated?
Sorry for my late response. Actually, I could not resolve it. Is it a bug?
People, User000 and irfanwustl, simply saying "it does not work" is not an adequate error description. As asked twice now above, did you make sure your file is properly tab-separated and headers are indicated by a '#'? I am 99.99% sure this is not a bug and a problem with your files.
Got it. Yes, the header was not indicated by '#'
I actually solved the problem 4 months ago I guess, so I do not remember now what was the problem, but it was pretty easy at the end :) and I never said it does not work