mercredi 5 mai 2021

compare 2 files by their first 2 columns. If the positions are not in file 2, print line from file1. If positions in file2, print line from the file2 [closed]

File1

1 14931 . A MQ=37;MQ0=0;DP=3;AN=4 GT:DP 0/0:.

1 14933 . G MQ=37;MQ0=0;DP=3;AN=4 GT:DP ./.:.

1 14934 . T MQ=37;MQ0=0;DP=3;AN=4 GT:DP ./.:.

1 14975 . C MQ=37;MQ0=0;DP=3;AN=4 GT:DP ./.:.

1 15021 . C AN=0 GT ./.

1 15211 . T MQ=37;MQ0=0;DP=3;AN=4 GT:DP ./.:.

1 15212 . T MQ=37;MQ0=0;DP=3;AN=4 GT:DP ./.:.

File2

1 14933 rs199856693 G A AR2=0;DR2=0.004;AF=0.018 GT:DS:GP 0|0:0.045

1 14975 rs11803341 C T AR2=0;DR2=0.001;AF=0.004 GT:DS:GP 0|0:0.009

1 15211 rs3982632 T G AR2=0;DR2=0.031;AF=0.426 GT:DS:GP 0|0:0.806

Expected output:

1 14931 . A MQ=37;MQ0=0;DP=3;AN=4 GT:DP 0/0:.

1 14933 rs199856693 G A AR2=0;DR2=0.004;AF=0.018 GT:DS:GP 0|0:0.045

1 14934 . T MQ=37;MQ0=0;DP=3;AN=4 GT:DP ./.:.

1 14975 rs11803341 C T AR2=0;DR2=0.001;AF=0.004 GT:DS:GP
0|0:0.009

1 15021 . C AN=0 GT ./.

1 15211 rs3982632 T G AR2=0;DR2=0.031;AF=0.426 GT:DS:GP
0|0:0.806

1 15212 . T MQ=37;MQ0=0;DP=3;AN=4 GT:DP ./.:.

So far I have not found a way to process that with awk. Help is much appreciated

Aucun commentaire:

Enregistrer un commentaire