def parse_genes(gene_lines):
genes = []<EOL>header = []<EOL>hgnc_identifiers = set()<EOL>delimiter = '<STR_LIT:\t>'<EOL>delimiters = ['<STR_LIT:\t>', '<STR_LIT:U+0020>', '<STR_LIT:;>']<EOL>for i,line in enumerate(gene_lines):<EOL><INDENT>line = line.rstrip()<EOL>if not len(line) > <NUM_LIT:0>:<EOL><INDENT>continue<EOL><DEDENT>if line.startswith('<STR_LIT:#>'):<EOL><INDENT>if not line.startswith('<STR_LIT>'):<EOL><INDENT>line_length = <NUM_LIT:0><EOL>delimiter = None<EOL>for alt in delimiters:<EOL><INDENT>head_line = line.split(alt)<EOL>if len(head_line) > line_length:<EOL><INDENT>line_length = len(head_line)<EOL>delimiter = alt<EOL><DEDENT><DEDENT>header = [word.lower() for word in line[<NUM_LIT:1>:].split(delimiter)]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if i == <NUM_LIT:0>:<EOL><INDENT>line_length = <NUM_LIT:0><EOL>for alt in delimiters:<EOL><INDENT>head_line = line.split(alt)<EOL>if len(head_line) > line_length:<EOL><INDENT>line_length = len(head_line)<EOL>delimiter = alt<EOL><DEDENT><DEDENT>if ('<STR_LIT>' in line or '<STR_LIT>' in line):<EOL><INDENT>header = [word.lower() for word in line.split(delimiter)]<EOL>continue<EOL><DEDENT>if line.split(delimiter)[<NUM_LIT:0>].isdigit():<EOL><INDENT>header = ['<STR_LIT>']<EOL><DEDENT>else:<EOL><INDENT>header = ['<STR_LIT>']<EOL><DEDENT><DEDENT>splitted_line = line.split(delimiter)<EOL>gene_info = dict(zip(header, splitted_line))<EOL>info_found = False<EOL>for key in gene_info:<EOL><INDENT>if gene_info[key]:<EOL><INDENT>info_found = True<EOL>break<EOL><DEDENT><DEDENT>if not info_found:<EOL><INDENT>continue<EOL><DEDENT>try:<EOL><INDENT>gene = parse_gene(gene_info)<EOL><DEDENT>except Exception as e:<EOL><INDENT>LOG.warning(e)<EOL>raise SyntaxError("<STR_LIT>".format(i + <NUM_LIT:1>))<EOL><DEDENT>identifier = gene.pop('<STR_LIT>')<EOL>if not identifier in hgnc_identifiers:<EOL><INDENT>hgnc_identifiers.add(identifier)<EOL>genes.append(gene)<EOL><DEDENT><DEDENT><DEDENT>return genes<EOL>
Parse a file with genes and return the hgnc ids

    Args:
        gene_lines(iterable(str)): Stream with genes

    Returns:
        genes(list(dict)): Dictionaries with relevant gene info