def setup_scout(adapter, institute_id='<STR_LIT>', user_name='<STR_LIT>',<EOL>user_mail='<STR_LIT>', api_key=None, demo=False):
<EOL>LOG.info("<STR_LIT>")<EOL>for collection_name in adapter.db.collection_names():<EOL><INDENT>if not collection_name.startswith('<STR_LIT>'):<EOL><INDENT>LOG.info("<STR_LIT>", collection_name)<EOL>adapter.db.drop_collection(collection_name)<EOL><DEDENT><DEDENT>LOG.info("<STR_LIT>")<EOL>institute_obj = build_institute(<EOL>internal_id=institute_id,<EOL>display_name=institute_id,<EOL>sanger_recipients=[user_mail]<EOL>)<EOL>adapter.add_institute(institute_obj)<EOL>user_obj = dict(<EOL>_id=user_mail,<EOL>email=user_mail,<EOL>name=user_name,<EOL>roles=['<STR_LIT>'],<EOL>institutes=[institute_id]<EOL>)<EOL>adapter.add_user(user_obj)<EOL>if not demo:<EOL><INDENT>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>raise err<EOL><DEDENT>mim2gene_lines = mim_files['<STR_LIT>']<EOL>genemap_lines = mim_files['<STR_LIT>']<EOL>hpo_gene_lines = fetch_hpo_genes()<EOL>hgnc_lines = fetch_hgnc()<EOL>exac_lines = fetch_exac_constraint()<EOL><DEDENT>else:<EOL><INDENT>mim2gene_lines = [line for line in get_file_handle(mim2gene_reduced_path)]<EOL>genemap_lines = [line for line in get_file_handle(genemap2_reduced_path)]<EOL>hpo_gene_lines = [line for line in get_file_handle(hpogenes_reduced_path)]<EOL>hgnc_lines = [line for line in get_file_handle(hgnc_reduced_path)]<EOL>exac_lines = [line for line in get_file_handle(exac_reduced_path)]<EOL><DEDENT>builds = ['<STR_LIT>', '<STR_LIT>']<EOL>for build in builds:<EOL><INDENT>if not demo:<EOL><INDENT>ensembl_genes = fetch_ensembl_genes(build=build)<EOL><DEDENT>else:<EOL><INDENT>ensembl_genes = get_file_handle(genes37_reduced_path)<EOL><DEDENT>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=mim2gene_lines,<EOL>genemap_lines=genemap_lines,<EOL>hpo_lines=hpo_gene_lines,<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>if not demo:<EOL><INDENT>ensembl_transcripts = fetch_ensembl_transcripts(build=build)<EOL><DEDENT>else:<EOL><INDENT>ensembl_transcripts = get_file_handle(transcripts37_reduced_path)<EOL><DEDENT>transcripts = load_transcripts(adapter, ensembl_transcripts, build, ensembl_genes)<EOL><DEDENT>hpo_terms_handle = None<EOL>hpo_to_genes_handle = None<EOL>hpo_disease_handle = None<EOL>if demo:<EOL><INDENT>hpo_terms_handle = get_file_handle(hpoterms_reduced_path)<EOL>hpo_to_genes_handle = get_file_handle(hpo_to_genes_reduced_path)<EOL>hpo_disease_handle = get_file_handle(hpo_phenotype_to_terms_reduced_path)<EOL><DEDENT>load_hpo(<EOL>adapter=adapter,<EOL>hpo_lines=hpo_terms_handle,<EOL>hpo_gene_lines=hpo_to_genes_handle,<EOL>disease_lines=genemap_lines,<EOL>hpo_disease_lines=hpo_disease_handle<EOL>)<EOL>if demo:<EOL><INDENT>parsed_panel = parse_gene_panel(<EOL>path=panel_path,<EOL>institute='<STR_LIT>',<EOL>panel_id='<STR_LIT>',<EOL>version=<NUM_LIT:1.0>,<EOL>display_name='<STR_LIT>'<EOL>)<EOL>adapter.load_panel(parsed_panel)<EOL>case_handle = get_file_handle(load_path)<EOL>case_data = yaml.load(case_handle)<EOL>adapter.load_case(case_data)<EOL><DEDENT>LOG.info("<STR_LIT>")<EOL>adapter.load_indexes()<EOL>LOG.info("<STR_LIT>")<EOL>
docstring for setup_scout