Friday, May 9, 2014

How to get closest feature with bedtools in both directions

Using bedtools closest feature you can get two closest intervals when comparing two bed files. Bedtools closest option will report closest interval that is either upstream or downstream. To get both upstream and downstream intervals, run bedtools twice with the following commands:

bedtools closest -D ref -id -a peaks.bed -b RefSeq_genes.bed > upstream_genes
bedtools closest -D ref -iu -a peaks.bed -b RefSeq_genes.bed > downstream_genes


-id will ignore downstream
-iu will ignore upstream

3 comments:

  1. I will be happy if you read my comment. I must say that I like all your posts and wait for new ones. That's because they seem so great and suitable for me. Thanks a ton for uploading your articles.
    Short Ride game racing free || Jump Ball Blast Online games kids for school || online Downhill Rush

    ReplyDelete
  2. Do you know that there are readers loving to read your posts everyday? So please write and post more. I choose to follow your writing because they bring me what I want. They have knowledge and information. I will support you a lot. Thanks
    Wormana.io 2 player games || Christmas Gifts Mania new game || How to make frozen fever cake girls games for free

    ReplyDelete
  3. Christmas has come and New Year is coming. One of the things I will do next year is to follow your new posts. It's because they provide what I need. Your articles are informative and great. Stay healthy and write more posts. Thanks
    Short Ride || Kindergarten Dress Up games for kids for school || Moto X3M 2 free on abcya3 games

    ReplyDelete