I have file called pangenome.txt which has only one column containing the names of the genes
head pangenome.txt
Ha1_00044161
Ha11_00031248
Ha16_00021664
Ha8_00042762
Ha4_00025807
I have another bunch of files in a tabular blast format (330 in total: individual1.blast.txt,individual2.blast.txt, ...,individual330.blast.txt ) which are the outputs of Diamond protein aligner. Below is part of individual1.blast.txt file
head blast.individual1.txt
HWI-ST913:300:C5W5DACXX:7:1101:1477:2147 Ha16_00021664 77.4 31 7 0 94 2 49 79 7.3e-159.3
HWI-ST913:300:C5W5DACXX:7:1101:1477:2147 Ha8_00042762 74.2 31 8 0 94 2 1 31 9.6e-158.9
HWI-ST913:300:C5W5DACXX:7:1101:1477:2147 Ha4_00025807 77.4 31 7 0 94 2 1 31 1.3e-058.5
HWI-ST913:300:C5W5DACXX:7:1101:1477:2147 Ha16_00022939 77.4 31 7 0 94 2 295 325 2.1e-057.8
HWI-ST913:300:C5W5DACXX:7:1101:1477:2147 Ha12_00032339 71.0 31 9 0 94 2 2 32 2.8e-057.4
HWI-ST913:300:C5W5DACXX:7:1101:1477:2147 Ha16_00021553 71.0
I want to know which genes from the pangemome.txt is present in my individuals file and which are absent. for the example above this is my desired output:
head output.individual1.txt
Ha1_00044161 0
Ha11_00031248 0
Ha16_00021664 1
Ha8_00042762 1
Ha4_00025807 1
My desired out put is a file with 2 columns (tabular format), the first column the list of the all genes form pangemome.txt pan, and the second column is the presence and absence of these genes in the individuals files if the gene is present present in the blast.individual1.txt, I want to assign 1 and if it is absent I want to assign 0. Can anyone help me to do this? Thanks a lot