I'm trying to annotate a bed file with the closest downstream gene, but the output returns only the result for the first entry of the query file. I tried deleting the first entry and made a new file starting with the 2nd, but this one also only gave outputs for the 2nd (1st) entry. I have 1000 entries and don't want to repeat this.
I have also done/tried:
- sorting the query file
- bedtools closest -iu -D ref -a query.bed -b mm10gencode_sorted.bed
- bedtools closest -fd -D ref -a query.bed -b mm10gencode_sorted.bed
- bedtools closest -a query.bed -b mm10gencode_sorted.bed
- bedtools intersect -a query.bed -b mm10gencode_sorted.bed -wa -wb
Has this happened to anyone else? Or any ideas would be appreciated!
Intersect gives only the overlapping fields. The query files must also be sorted, try
I've always sorted the query file. This code also didn't work..
PS. I only tried intersect because closest didn't work properly, but both gave output for the first entry. So it seems there's a problem with the file, I just have no idea what's wrong
That's odd, was the bedtools installation ok? I had a problem before with v2.26 due to faulty installation, can you host the files somewhere to check?
I just deleted bedtools and reinstalled v2.27.1, but they gave the same results. But what do you mean by hosting files? Thanks for your input!
Some more updates: When I put another query file in, it worked fine! So I now suspect something went wrong while making the query bed file (exporting Excel to a tab-delimited .txt), which is weird because I've done the same thing many many times. Do you know other ways to make bed files?