Entering edit mode
5.8 years ago
corend
▴
70
I have files a.bed
and b.bed
a.bed
chr1 10 20 geneA
chr1 30 40 geneB
b.bed
chr1 5 15 geneA
chr1 10 25 geneB
if I intersectbed
those files I will obtain:
chr1 10 15 geneA
chr1 10 20 geneA
But I would like the name
column to match between files so that i will obtain:
chr1 10 15 geneA
If name column does not match, I don't want to output the intersection. I can't find any option in intersectbed to "force identical name", any suggestions?
Sorry, it is not working, here is the problem:
In the second step, you don't intersect line by line, so the problem is still the same. Just try it and you will see.
Based on the data you provided it gives exactly the result you intended:
My bad, my example was not a MWE, I will validate your answer. If you replace 10 25 by 10 35 here you will see the problem.