Hi, I have two SNP files. I want to compare and merge them.
File1
chrA01 2024 G A 10 11
chrA01 2026 T A 10 11
chrA01 2289 A T 3 3
chrA01 2314 C T 3 3
chrA01 2323 T C 3 3
chrA01 26034 A G 4 5
file2
chrA01 2024 G A 10 12
chrA01 2026 T A 10 12
chrA01 2300 A G 3 3
chrA01 26034 A G 5 6
I want to get the results:
chrA01 2024 G A 10 11 10 12
chrA01 2026 T A 10 11 10 12
chrA01 26034 A G 4 5 5 6
I have tried command as like:
comm -12 <( sort BR.txt ) <( sort BS.txt )
awk -F'|' 'NR==FNR{c[$1$2$3$4]++;next};c[$1$2$3$4] > 0' BR.txt BS.txt
kdiff3 BR.txt BS.txt -m
kdiff3 BR.txt BS.txt -o SNP.txt
awk 'NR==FNR{tgts[$1$2$3$4]; next} $1$2$3$4 in tgts' BR.txt BS.txt > BRS.txt
join -1 1 -2 1 -3 1 -4 1 BR.txt BS.txt | awk '{print $1}' > BRS.txt.
But it does not work well. Could you help modified my commands?
Thanks, Fuyou
Thanks. It works well. Fuyou