Combine BedTools Closest and Window Command
0
0
Entering edit mode
3.3 years ago
Dotty • 0

Hi,

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.

SNP genome sequencing bedtools GWAS • 588 views
ADD COMMENT
0
Entering edit mode

I would simply use slop to extend the SNP coordinate by 5kb in each direction and then intersect to get the overlaps with the gene start coordinate.

ADD REPLY

Login before adding your answer.

Traffic: 2522 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6