file1
chr1 123896 rs0987522 A T
chr5 678452 rs8733521 G C,A
file2
chr1 123896 rs0987522 A T,C,G
chr5 678452 rs8733521 G A,T
output
chr1 123896 rs0987522 A T*,C,G
chr5 678452 rs8733521 G C!,A*,T
If 4th col of file1 is matching with any character is 4th column of file2 (A==>> T,A,G,C) then rows from file2 should be printed as given above in output and matching character from file1 (here T from 1st row column5) should be represented by "" (T)and non-matching character from file1 should be represented by "!" (C!).
awk 'NR==FNR{firstfile[$1,$2,$4];next} ($1,$2,$4) in firstfile' File1 file2
I have used awk but only for (1,2,4) columns. Kindly help for the 5th one matching. 5th columns comma separated characters may have different orders in file1 & file2.