Question: Retrieve coverage/depth of individual bed tracks from merged bed
0
gravatar for ishengtsai
22 months ago by
ishengtsai10
ishengtsai10 wrote:

I have been using bedtools for a long time but I can't seem to quite figure the following operation. Hope someone can help!

cat test.bed 
chr1    5   27
chr1    7   12
chr1    10  20
chr1    22  27
chr1    24  30

bedtools merge -i test.bed
chr1    5   30

Now I wish to conduct something that would like :

# first two lines
chr1    5    6   1  #only shown once
chr1    7    10  2  #shown twice

I can do it with coverage option by showing the base depth option, but surely there may be something that is even quicker!

bedtools • 514 views
ADD COMMENTlink modified 22 months ago by Carlo Yague4.8k • written 22 months ago by ishengtsai10
2
gravatar for Carlo Yague
22 months ago by
Carlo Yague4.8k
Canada
Carlo Yague4.8k wrote:

You can try bedtools genomecov :

cat  test.bed
chr1    5   27
chr1    7   12
chr1    10  20
chr1    22  27
chr1    24  30

cat chr.txt
chr1    50

bedtools genomecov -i test.bed -g chr.txt -bg
chr1    5   7   1
chr1    7   10  2
chr1    10  12  3
chr1    12  20  2
chr1    20  22  1
chr1    22  24  2
chr1    24  27  3
chr1    27  30  1
ADD COMMENTlink written 22 months ago by Carlo Yague4.8k
1

works like a charm! Thanks!

ADD REPLYlink written 22 months ago by ishengtsai10
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: 1264 users visited in the last hour