Off topic:Match the three columns in 2 annotation files and print those lines to a new output file
0
0
Entering edit mode
8.4 years ago

I have 2 files, file 1 and file 2 with the same column numbers, column one has the chromosome number, column two has the promoter start site and column three has the promoter stop site.I want to match both files, if a match to all the three columns in file 1 is found in file 2, I want to generate an output file showing the exact three columns with a fourth one.the fourth one would show a match with a score 1 and a mismatch with a score 0.

I found the answer to match the files and output a new file at the same forum,

awk 'FNR==NR{a[$1,$2,$3]=$0;next}{if(b=a[$1,$2,$3]){print b}}' file1 file2

but I want to include the match and mismatch score column in the output file too.

linux • 2.5k views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 2745 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