def make_related_protein_fasta_from_dataframe(self, input_df):
dirname = '<STR_LIT>'<EOL>if not os.path.exists(dirname):<EOL><INDENT>os.makedirs(dirname)<EOL><DEDENT>unique_hit_queries = set(input_df.hit_query)<EOL>for hq in unique_hit_queries:<EOL><INDENT>fasta = []<EOL>subdf = input_df[input_df.hit_query==hq].reset_index()<EOL>for i in range(<NUM_LIT:0>, len(subdf)):<EOL><INDENT>fasta.append('<STR_LIT:>>' + subdf.ix[i].org_name.replace("<STR_LIT:U+0020>", "<STR_LIT:->") +<EOL>"<STR_LIT:U+002C>" + subdf.ix[i].hit_query +<EOL>"<STR_LIT:U+002C>" + subdf.ix[i].prot_acc + <EOL>'<STR_LIT:\n>' + subdf.ix[i].prot_translation + '<STR_LIT:\n>')<EOL><DEDENT>faastring = "<STR_LIT>".join(fasta)<EOL>filename = '<STR_LIT>' + hq + '<STR_LIT>'<EOL>write_fasta = open(filename, '<STR_LIT:w>')<EOL>write_fasta.write(faastring)<EOL>write_fasta.close()<EOL><DEDENT>
DataFrame should have