comparing coordinates between two files
1
0
Entering edit mode
7.2 years ago
SOHAIL ▴ 400

Hi,

I have two files with content:

File1

1   32030000    32080000    0.294180714 -1.124178317
1   32810000    32860000    -0.011122006    -0.508257648
2   32110000    32160000    -0.011122006    -0.613642043

File2:

1   32037085    32058287    NM_022164   
1   32219260    32229336    NR_036216   
2   32187705    32234664    NM_001294336    
2   32112847    32174768    NM_001856

Desired Output file:

1   32030000    32080000    0.294180714 -1.124178317   NM_022164
2   32110000    32160000    -0.011122006    -0.613642043   NM_001294336
2   32110000    32160000    -0.011122006    -0.613642043   NM_001856

I wanna compare the coordinate of first three columns between two files. and if the ranges overlap print them in seperate file..

Can anyone please guide me ??

Thanks!

linux ngs • 1.9k views
ADD COMMENT
2
Entering edit mode

I solved this partially by myself using bedtools...

bedtools intersect -a file1.bed -b file2.bed -u > output.txt

ADD REPLY
0
Entering edit mode

Thanks! That helped me.

ADD REPLY
1
Entering edit mode
7.2 years ago

Just use bedmap in BEDOPS. Easy-peasy, lemon-squeezy:

$ bedmap --echo --echo-map-id-uniq A.bed B.bed > answer.bed
ADD COMMENT

Login before adding your answer.

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