@click.command('<STR_LIT>', short_help='<STR_LIT>')<EOL>@click.option('<STR_LIT>',<EOL>type=click.Choice(['<STR_LIT>', '<STR_LIT>']),<EOL>help="<STR_LIT>"<EOL>)<EOL>@click.option('<STR_LIT>', help='<STR_LIT>')<EOL>@click.pass_context<EOL>def genes(context, build, api_key):
LOG.info("<STR_LIT>")<EOL>adapter = context.obj['<STR_LIT>']<EOL>api_key = api_key or context.obj.get('<STR_LIT>')<EOL>if not api_key:<EOL><INDENT>LOG.warning("<STR_LIT>")<EOL>context.abort()<EOL><DEDENT>try:<EOL><INDENT>mim_files = fetch_mim_files(api_key, mim2genes=True, morbidmap=True, genemap2=True)<EOL><DEDENT>except Exception as err:<EOL><INDENT>LOG.warning(err)<EOL>context.abort()<EOL><DEDENT>LOG.warning("<STR_LIT>")<EOL>adapter.drop_genes(build)<EOL>LOG.info("<STR_LIT>")<EOL>LOG.warning("<STR_LIT>")<EOL>adapter.drop_transcripts(build)<EOL>LOG.info("<STR_LIT>")<EOL>hpo_genes = fetch_hpo_genes()<EOL>if build:<EOL><INDENT>builds = [build]<EOL><DEDENT>else:<EOL><INDENT>builds = ['<STR_LIT>', '<STR_LIT>']<EOL><DEDENT>hgnc_lines = fetch_hgnc()<EOL>exac_lines = fetch_exac_constraint()<EOL>for build in builds:<EOL><INDENT>ensembl_genes = fetch_ensembl_genes(build=build)<EOL>hgnc_genes = load_hgnc_genes(<EOL>adapter=adapter,<EOL>ensembl_lines=ensembl_genes,<EOL>hgnc_lines=hgnc_lines,<EOL>exac_lines=exac_lines,<EOL>mim2gene_lines=mim_files['<STR_LIT>'],<EOL>genemap_lines=mim_files['<STR_LIT>'],<EOL>hpo_lines=hpo_genes,<EOL>build=build,<EOL>)<EOL>ensembl_genes = {}<EOL>for gene_obj in hgnc_genes:<EOL><INDENT>ensembl_id = gene_obj['<STR_LIT>']<EOL>ensembl_genes[ensembl_id] = gene_obj<EOL><DEDENT>ensembl_transcripts = fetch_ensembl_transcripts(build=build)<EOL>transcripts = load_transcripts(adapter, ensembl_transcripts, build, ensembl_genes)<EOL><DEDENT>adapter.update_indexes()<EOL>LOG.info("<STR_LIT>")<EOL>
Load the hgnc aliases to the mongo database.