def parse_genes(transcripts):
<EOL>genes_to_transcripts = {}<EOL>genes = []<EOL>hgvs_identifier = None<EOL>canonical_transcript = None<EOL>exon = None<EOL>for transcript in transcripts:<EOL><INDENT>hgnc_id = transcript['<STR_LIT>']<EOL>hgnc_symbol = transcript['<STR_LIT>']<EOL>if (transcript['<STR_LIT>'] and transcript.get('<STR_LIT>')):<EOL><INDENT>hgvs_identifier = transcript.get('<STR_LIT>')<EOL>canonical_transcript = transcript['<STR_LIT>']<EOL>exon = transcript['<STR_LIT>']<EOL><DEDENT>if hgnc_id:<EOL><INDENT>if hgnc_id in genes_to_transcripts:<EOL><INDENT>genes_to_transcripts[hgnc_id].append(transcript)<EOL><DEDENT>else:<EOL><INDENT>genes_to_transcripts[hgnc_id] = [transcript]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>if hgnc_symbol:<EOL><INDENT>if hgnc_symbol in genes_to_transcripts:<EOL><INDENT>genes_to_transcripts[hgnc_symbol].append(transcript)<EOL><DEDENT>else:<EOL><INDENT>genes_to_transcripts[hgnc_symbol] = [transcript]<EOL><DEDENT><DEDENT><DEDENT><DEDENT>for gene_id in genes_to_transcripts:<EOL><INDENT>gene_transcripts = genes_to_transcripts[gene_id]<EOL>most_severe_consequence = None<EOL>most_severe_rank = float('<STR_LIT>')<EOL>most_severe_transcript = None<EOL>most_severe_region = None<EOL>most_severe_sift = None<EOL>most_severe_polyphen = None<EOL>for transcript in gene_transcripts:<EOL><INDENT>hgnc_id = transcript['<STR_LIT>']<EOL>hgnc_symbol = transcript['<STR_LIT>']<EOL>for consequence in transcript['<STR_LIT>']:<EOL><INDENT>new_rank = SO_TERMS[consequence]['<STR_LIT>']<EOL>if new_rank < most_severe_rank:<EOL><INDENT>most_severe_rank = new_rank<EOL>most_severe_consequence = consequence<EOL>most_severe_transcript = transcript<EOL>most_severe_sift = transcript['<STR_LIT>']<EOL>most_severe_polyphen = transcript['<STR_LIT>']<EOL>most_severe_region = SO_TERMS[consequence]['<STR_LIT>']<EOL><DEDENT><DEDENT><DEDENT>gene = {<EOL>'<STR_LIT>': gene_transcripts,<EOL>'<STR_LIT>': most_severe_transcript,<EOL>'<STR_LIT>': most_severe_consequence,<EOL>'<STR_LIT>': most_severe_sift,<EOL>'<STR_LIT>': most_severe_polyphen,<EOL>'<STR_LIT>': hgnc_id,<EOL>'<STR_LIT>': hgnc_symbol,<EOL>'<STR_LIT>': most_severe_region,<EOL>'<STR_LIT>': transcript['<STR_LIT>'],<EOL>'<STR_LIT>': transcript['<STR_LIT>'],<EOL>'<STR_LIT>': transcript['<STR_LIT>'],<EOL>}<EOL>genes.append(gene)    <EOL><DEDENT>return genes<EOL>
Parse transcript information and get the gene information from there.

    Use hgnc_id as identifier for genes and ensembl transcript id to identify transcripts

    Args:
        transcripts(iterable(dict))

    Returns:
      genes (list(dict)): A list with dictionaries that represents genes