How can I use the closestBed from bedtools to find the closest locations between two bed files. The important bit here is that i want them to be upstream and in correct oriantation.
When I use the -s option, it does not report anything (everything is -1).
Then I checked the -D a option. It is returning some results but not sure if it is the right thing.
The other thing to mention is that my genes bed file (lets call is gene.bed) is organized as
chr1 123 234 +
chr1 456 789 -
rather than end position being smaller to indicate the negative strand.
Whereas my repeats.bed file are organized as
chr1 239 456
chr3 456 987
Does bedtools get confused with this?
Which options should i use if i want to find the distance to nearest repeat that is upstream and in the correct orientation?