how to merge adjacent region with same coverage

16 views
Skip to first unread message

Laurent MANCHON

unread,
Oct 4, 2022, 5:17:27 AM10/4/22
to bedtools-discuss
--Hi all,

this is an extract of my big file:

chr2 1 501 0
chr2 501 1001 0
chr2 1001 1501 0
chr2 1501 2001 0
chr2 2001 2501 0
chr2 86501 87001 13
chr2 87001 87501 13
chr2 87501 88001 13
chr2 88001 88501 13
chr2 88501 89001 13
chr2 89001 89501 13.5
chr2 89501 90001 14
chr2 90001 90501 14
chr2 90501 91001 14
chr2 144001 144501 12
chr2 144501 145001 12.33333333
chr2 145001 145501 12
chr2 145501 146001 12
chr2 146001 146501 12
chr2 146501 147001 12
chr2 147001 147501 12
.../...
numbers in column 4 is coverage.

i want to merge regions which have same coverage, such as:
chr2 1 2501 0
chr2 86501 89001 13
 chr2 89001 89501 13.5
chr2 89501 91001 14
chr2 144001  144501 12
chr2 144501 145001 12.33333333
chr2 145001 147501 12

is there a bedtools command to do that ?

thank you --
Reply all
Reply to author
Forward
0 new messages