Merging bed intervals within a group
0
0
Entering edit mode
7.3 years ago
EVR ▴ 610

Hi,

I have a bed file like following:

PGRP-SA-PA  11561749    11561803
PGRP-SA-PA  11561806    11561873
PGRP-SA-PA  11561875    11561925
noc-PB  14490900    14490989
noc-PB  14491004    14491065
noc-PB  14491076    14491106
noc-PB  14491117    14491182
noc-PB  14491201    14491295

I would like to group intervals based on column 1 like following

PGRP-SA-PA  11561749    11561925
PB  14490900    14491295

I tried using bedtools groupBy like following

groupBy -g 1 -c 2,3 -o min,max

but I couldnt get my desired output. any suggestions? Kindly guide me.

Bedtools bedops BED • 2.0k views
ADD COMMENT
0
Entering edit mode

That should work. I tried the following command with your example BED file:

groupBy -g 1 -c 2,3 -o min,max -i input.bed

Here is the output:

PGRP-SA-PA  11561749    11561925
noc-PB  14490900    14491295

What output do you get?

ADD REPLY
0
Entering edit mode

Hi, Thanks for your reply. I tried your code, it gave the following output

11561749    14491295
ADD REPLY
0
Entering edit mode

You might need to compile Bedtools from the latest source code. I remember the latest current release has a groupBy bug of some kind, but the latest commit version should have it fixed.

ADD REPLY

Login before adding your answer.

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