Bedtools - can I operate two operations same time, and on the same database?
1
0
Entering edit mode
7 months ago
Waly • 0

Hi everyone,

I'm using the bedtools to find the closest hits between 2 databases and merge them to one file, but I wonder if I can have a command that operates for example; closest + intersect on the same database and same time; is this possible? can anyboday help me with the right commands?

thanks!

bedtools • 258 views
1
Entering edit mode
7 months ago

If you can use BEDOPS tools, you can use pipes and process substitutions pretty easily.

For instance:

$bedops --intersect <(closest-features --closest A.bed query.bed) B.bed > answer.bed  Or: $ closest-features --closest <(bedops --intersect A.bed B.bed) query.bed > answer.bed


Or:

$closest-features --closest A.bed query.bed | bedops --intersect - B.bed > answer.bed  Or: $ bedops --intersect A.bed B.bed | closest-features --closest - query.bed > answer.bed


Etc.

It just depends on what you're trying to do. Your question might be a little unclear, in that an intersection operation on two sets A and B will calculate elements which are always zero units away from B. Feel free to clarify what you're trying to do, if that's not the case.