I have three bed files with chrNo, start, end position and type. I need to compare each chrNo, start and end position of one file with 2 other files and write the common one in a new file. Can any one suggest how can I do this efficiently? I wrote the simple perl script, but as the file is huge, it is taking a lot of time, thus is not feasible. Thanks in advance
Example files:
file1.bed:
1 20 30
1 100 120
1 200 300
file2.bed:
1 2 5
1 25 34
1 200 300
file3.bed:
1 30 33
1 200 300
1 500 600
common.bed
1 30 34 --> coordinates with overlapping 5bp is considered as same but outermost coordinates of the 3 is taken in common file
1 200 300