assigning different characters to present and absent genes from blast output using perl or python
I wouldn't do this in Python, myself. This is a very simple text parsing problem and the standard *nix tools will be able to do it very easily. For example with awk:

$ awk 'NR==FNR{a[$1]=0; next}
       { 
        if($2 in a){
            a[$2]=1
        }
       }END{
        for(i in a){
            print i,a[i]
        }
       }' pangenome.txt blast.individual1.txt 
Ha1_00044161 0
Ha4_00025807 1
Ha11_00031248 0
Ha16_00021664 1
Ha8_00042762 1


The above is just a one-liner, I expanded it for clarity. You can run it on as many files as you like:

awk 'NR==FNR{a[$1]=0; next}{if($2 in a){a[$2]=1}}END{for(i in a){print i,a[i]}}' pangenome.txt blast.individual*.txt 


For many large files, the fastest approach would probably be to just grep the names (unlike the awk, this will also match if the target gene is in the 1st field, but that's probably not an issue for you):

$ grep -wof pangenome.txt blast.individual1.txt.orig 
Ha16_00021664
Ha8_00042762
Ha4_00025807


That will give you the list of genes found in the target blast files. To get the 1 and 0, you can do:

$ sort &lt;(grep -owf pangenome.txt blast.individual1.txt) pangenome.txt | 
    uniq -c | awk '{print $2,$1-1}'
Ha1_00044161 0
Ha11_00031248 0
Ha16_00021664 1
Ha4_00025807 1
Ha8_00042762 1


For multiple files, just run it on all of them:

$ sort &lt;(grep -owf pangenome.txt blast.individual*.txt) pangenome.txt | 
    uniq -c | awk '{print $2,$1-1}'