Hi,
I have the following files.
cat 1.txt
Quote:
chr1 100 200
chr1 200 300
chr1 1000 1200
chr2 300 400
chr2 400 500
chr2 600 900
chr2 1200 1800
chrz 100 200
chrz 300 400
chrz 400 500
cat 2.txt
Quote:
chr1 100 200
chr1 130 220
chr1 498 600
chr1 700 820
chr1 1499 1600
chr1 1800 1920
chr2 301 330
chr2 600 700
chrz 1000 1350
chrz 420 465
output.txt
Quote:
chr1 100 200 12.txt (because this record comes from both 1.txt and 2.txt)
chr1 200 300 1.txt
chr1 1000 1200 1.txt
chr1 130 220 2.txt
chr1 498 600 2.txt
chr1 700 820 2.txt
chr1 1499 1600 2.txt
chr2 300 400 1.txt
chr2 400 500 1.txt
chr2 600 900 1.txt
chr2 301 330 2.txt
chr2 600 700 2.txt
chrz 100 200 1.txt
chrz 300 400 1.txt
chrz 400 500 1.txt
chrz 420 465 2.txt
The logic is as follows....
chr1 in column1 of file1 should be matched to chr1 in column1 of file2.
Any value that is equal or 300 plus/minus range of the value in column2 of file1 matches to column2 of file2, (i.e., if column2 of file1 is 500, then the value in column2 of file2 can be 500, or between 200 and 500, or between 500 and 800) they should be printed.
Any value that is equal or 300 plus/minus range of the value in column3 of file1 matches to column3 of file2, (i.e., if column3 of file1 is 800, then the value in column3 of file2 can be 800, or between 500 and 800, or between 800 and 1100) they should be printed.
Also, anything that is in the range of column2 and column3 should be printed.
Ex: If file 1 has this record chr2 300 400, and file2 has this record chr1 301 383, both of them should be printed.
Each record is matched to each record in both these files.
I am looking for something that can be used across multiple files that are more than two.
Thanks a ton in advance. I know it is a pain. But, please help me.
---------- Post updated 02-09-12 at 09:59 AM ---------- Previous update was 02-08-12 at 02:18 PM ----------
Please guys. Someone help me out.
---------- Post updated at 04:19 PM ---------- Previous update was at 09:59 AM ----------
Any thoughts by anyone?
---------- Post updated at 04:20 PM ---------- Previous update was at 04:19 PM ----------
Any thoughts by anyone?