def get_query_file_type(query_file):
    """Takes an input query file and determines whether it is a FASTA file or
    an HMM file. Returns either "FASTA" or "HMM".
    """
    file_type = None
    with open(query_file) as infh:
        first_line = infh.readline().strip()
        if first_line.startswith('>'):
            file_type = 'FASTA'
        elif first_line.startswith('HMM'):
            file_type = 'HMM'

    # Check that it worked.
    assert file_type is not None, """Error: Input file type could not be
    determined: %s""" % query_file

    # Return file type.
    return file_type