Question: how to add bed files together
0
gravatar for dimitrischat
2.9 years ago by
dimitrischat90
dimitrischat90 wrote:

i have many bed files and i want to add them all together into one. ( so i watch it in igv ). any help ?

edit: i have found common areas and i want to have them in 1 bed file. bedtools merge or mergeBed doesnt seem to work. maybe my command is wrong. Also when i type mrgeBed or bedtools merge ( like when you type intersectBed and it prints out help/options) , it doesnt do anything. it seems to keep doing something. Version of my bedtools is 2.26.0

bed bedtools • 2.4k views
ADD COMMENTlink modified 2.9 years ago by Alex Reynolds29k • written 2.9 years ago by dimitrischat90
1

You don't want to open them independently?

Please edit the title of the post so it matches the question.

ADD REPLYlink modified 2.9 years ago • written 2.9 years ago by genomax76k

maybe i can make some sense now..

ADD REPLYlink written 2.9 years ago by dimitrischat90

Ok. So post the command you are trying with bedtools merge that gives no output.

ADD REPLYlink written 2.9 years ago by genomax76k
4

You need bedtools intersectbed (rather than merge). Take a look at the documentation for intersectbed here.

ADD REPLYlink written 2.9 years ago by genomax76k

i cant seem to find the command for this.

ADD REPLYlink written 2.9 years ago by dimitrischat90

What do you mean by that? The linked help page has many ways of how to use intersectbed program.

intersectBed [OPTIONS] -a <FILE> \
                       -b <FILE1, FILE2, ..., FILEN>
ADD REPLYlink modified 2.9 years ago • written 2.9 years ago by genomax76k

Since we are discussing the bedtools intersect command: Is there a flag or something to add to bedtools intersect get the union, if I wanted to get it?

ADD REPLYlink modified 10 months ago • written 10 months ago by msimmer92220
1

Original question has this requirement: edit: i have found common areas and i want to have them in 1 bed file. It was not asking for union.

ADD REPLYlink written 10 months ago by genomax76k

Yes, you are right, you answered the users question properly because that question suggest finding the overlap. I just wanted to know for the union case and got confused reading the other answer. Let me rephrase

ADD REPLYlink modified 10 months ago • written 10 months ago by msimmer92220

mergeBed a.bed o.bed -i > all.bed

ADD REPLYlink written 2.9 years ago by dimitrischat90
3
gravatar for Alex Reynolds
2.9 years ago by
Alex Reynolds29k
Seattle, WA USA
Alex Reynolds29k wrote:

If you have an arbitrary number of files you want to generate the union from, use BEDOPS bedops -u:

$ bedops -u A.bed B.bed ... N.bed > answer.bed

If you have an arbitrary number of files whose intervals you want to merge, instead use BEDOPS bedops -m:

$ bedops -m A.bed B.bed ... N.bed > answer.bed

Merging creates new intervals from overlaps between input intervals. Unioning creates a larger set from all the input intervals, but doesn't otherwise modify them. You would pick one of the other operation depending on what you're trying to do.

ADD COMMENTlink modified 2.9 years ago • written 2.9 years ago by Alex Reynolds29k

thanks a lot!! but i wonder why mergebed doesnt work..

ADD REPLYlink written 2.9 years ago by dimitrischat90
2

No idea. But BEDOPS tools are often worth trying.

ADD REPLYlink written 2.9 years ago by Alex Reynolds29k
2

mergebed is designed for only one bed input.

ADD REPLYlink written 2.9 years ago by genomax76k

This works wonderful, thank you. Just out of curiosity, is there an analogous of bedops -u in bedtools? (before someone answers bedtools intersect or merge, make sure that the options you include actually make the same output as bedops -u, because the default does not...please be more specific)

ADD REPLYlink modified 10 months ago • written 10 months ago by msimmer92220
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: 1794 users visited in the last hour