<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def make_related_protein_fasta_from_dataframe(self, input_df):

        '''
        DataFrame should have 
        '''

        dirname = './group_fastas'

        if not os.path.exists(dirname):
            os.makedirs(dirname)

        unique_hit_queries = set(input_df.hit_query)

        for hq in unique_hit_queries:

            fasta = []

            subdf = input_df[input_df.hit_query==hq].reset_index()

            for i in range(0, len(subdf)):

                fasta.append('>' + subdf.ix[i].org_name.replace(" ", "-") +
                             "," + subdf.ix[i].hit_query +
                             "," + subdf.ix[i].prot_acc + 
                             '\n' + subdf.ix[i].prot_translation + '\n')

            faastring = "".join(fasta)

            filename = './group_fastas/' + hq + '.fasta'
            write_fasta = open(filename, 'w')
            write_fasta.write(faastring)
            write_fasta.close()