Question: Combine BedTools Closest and Window Command
0
gravatar for Dotty
5 weeks ago by
Dotty0
Dotty0 wrote:

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.

ADD COMMENTlink written 5 weeks ago by Dotty0

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 REPLYlink written 5 weeks ago by ATpoint45k
Please log in to add an answer.

Help
Access

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.
Powered by Biostar version 2.3.0
Traffic: 1670 users visited in the last hour
_