I am new to using Bedtools so please excuse my possible naive question.
Let's say my file A is Snps and file B is genes.
The Closest command with -k flat let one set how many genes that are closest to the SNPs of interest.
The Window command allows one to set a window and get all genes within that window.
What should I do if I want to combine the 2 commands and find, for example, the 10 genes within 5kb up and downstream of the SNP?
What I have now is:
bedtools window -a A.sorted.bed -b B.sorted.bed -w 5000 | bedtools closest -k 10 -D b -a A.sorted.bed -b B.sorted.bed > closest.genes.k5.bed
But this isn't correct because it's only outputting the result of the latter (closest) command.
Any help is appreciated!
Thanks in advance.