Retrieve coverage/depth of individual bed tracks from merged bed
1
0
Entering edit mode
6.3 years ago
ishengtsai ▴ 10

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 • 1.2k views
ADD COMMENT
2
Entering edit mode
6.3 years ago

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 COMMENT
1
Entering edit mode

works like a charm! Thanks!

ADD REPLY

Login before adding your answer.

Traffic: 1842 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