This is a test version of Biostars. For the public version, visit https://www.biostars.org.
Bedtools and BEDOPS closest/closest-features issues

I have a bed file with hg19 motif coordinates that I would like to annotate. I downloaded the hg19 refFlat bed file from UCSC and (after sorting both files with the sort function) tried to use the closest function in bedtools to annotate the closest gene. However, I my output only shows the following:

MBP:manual_annotations$ bedtools closest -a sorted.abcd.bed -b sorted.refFlat.bed -d
chr19 940789549407959 E-box-116519    --box-11+805    chr1   
934341  935552  HES4    0   934438  935353  0   4   471,88,96,307,  0,564,730,904,  769
chr19   940789549407959 E-box-116519    --box-11+805    chr1   
934343  935552  HES4    0   934438  935353  0   3   469,88,481, 0,562,728,  769

closest-features in BEDOPS gives me a similar output.

Adding the > to a file just outputs my motif file in its entirety.

Any ideas on what's going on?

bedtools bedops

can you show head -2 sorted.abcd.bed sorted.refFlat.bed are they sorted ?

Hey thanks - the file wasn't sorted because the motif bed file was in the MAC text format. I used HOMER's changeNewLine.pl utility to change to UNIX format, sorted and then used closest and it worked. Now I have each peak annotated twice for some reason but working on that:)

Edit: The duplicate gene names are different isoforms.

0 answers

No answers yet.

Log in to answer this question.