Ejemplo n.º 1
0
def database(context, institute_name, user_name, user_mail, api_key):
    """Setup a scout database."""
    LOG.info("Running scout setup database")

    # Fetch the omim information
    api_key = api_key or context.obj.get('omim_api_key')
    if not api_key:
        LOG.warning("Please provide a omim api key with --api-key")
        context.abort()

    institute_name = institute_name or context.obj['institute_name']
    user_name = user_name or context.obj['user_name']
    user_mail = user_mail or context.obj['user_mail']

    adapter = context.obj['adapter']

    LOG.info("Setting up database %s", context.obj['mongodb'])
    
    setup_scout(
        adapter=adapter,
        institute_id=institute_name, 
        user_name=user_name, 
        user_mail = user_mail, 
        api_key=api_key
    )
Ejemplo n.º 2
0
def test_setup_scout(real_adapter):
    """Test to populate a demo instance of scout"""
    adapter = real_adapter
    ## GIVEN an empty adapter
    assert adapter.all_genes().count() == 0
    
    ## WHEN setting up a demo instance of scout
    setup_scout(adapter=adapter, demo=True)
    
    ## THEN make sure that stuff has been added
    assert adapter.all_genes().count() > 0
    
Ejemplo n.º 3
0
def demo(context):
    """Setup a scout demo instance. This instance will be populated with a
       case, a gene panel and some variants.
    """
    LOG.info("Running scout setup demo")
    institute_name = context.obj['institute_name']
    user_name = context.obj['user_name']
    user_mail = context.obj['user_mail']

    adapter = context.obj['adapter']

    LOG.info("Setting up database %s", context.obj['mongodb'])
    
    setup_scout(
        adapter=adapter,
        institute_id=institute_name, 
        user_name=user_name, 
        user_mail = user_mail, 
        demo=True
    )
Ejemplo n.º 4
0
def database(context, institute_name, user_name, user_mail, api_key):
    """Setup a scout database."""

    LOG.info("Running scout setup database")
    # Fetch the omim information
    api_key = api_key or current_app.config.get('OMIM_API_KEY')
    if not api_key:
        LOG.warning("Please provide a omim api key with --api-key")
        raise click.Abort()

    institute_name = institute_name or context.obj['institute_name']
    user_name = user_name or context.obj['user_name']
    user_mail = user_mail or context.obj['user_mail']

    adapter = context.obj['adapter']
    LOG.info("Setting up database %s", context.obj['mongodb'])

    setup_scout(adapter=adapter,
                institute_id=institute_name,
                user_name=user_name,
                user_mail=user_mail,
                api_key=api_key)
Ejemplo n.º 5
0
def database(context, institute_name, user_name, user_mail, api_key):
    """Setup a scout database."""
    LOG.info("Running scout setup database")

    # Fetch the omim information
    api_key = api_key or context.obj.get('omim_api_key')
    if not api_key:
        LOG.warning(
            "Please provide a omim api key to load the omim gene panel")
        context.abort()

    institute_name = institute_name or context.obj['institute_name']
    user_name = user_name or context.obj['user_name']
    user_mail = user_mail or context.obj['user_mail']

    adapter = context.obj['adapter']

    LOG.info("Setting up database %s", context.obj['mongodb'])

    setup_scout(adapter=adapter,
                institute_id=institute_name,
                user_name=user_name,
                user_mail=user_mail,
                api_key=api_key)
Ejemplo n.º 6
0
def database(
    context,
    institute_name,
    user_name,
    user_mail,
    api_key,
    mim2gene,
    genemap,
    hgnc,
    exac,
    ensgenes37,
    ensgenes38,
    enstx37,
    enstx38,
    hpogenes,
    hpoterms,
    hpo_to_genes,
    files,
):
    """Setup a scout database."""

    LOG.info("Running scout setup database")
    # Fetch the omim information
    api_key = api_key or current_app.config.get("OMIM_API_KEY")
    if not api_key:
        LOG.warning("No omim api key provided. This means information will be lost in scout")
        LOG.info("Please request an OMIM api key and run scout update genes")

    institute_name = institute_name or context.obj["institute_name"]
    user_name = user_name or context.obj["user_name"]
    user_mail = user_mail or context.obj["user_mail"]

    adapter = context.obj["adapter"]

    resource_files = {
        "mim2gene_path": mim2gene,
        "genemap_path": genemap,
        "hgnc_path": hgnc,
        "exac_path": exac,
        "genes37_path": ensgenes37,
        "genes38_path": ensgenes38,
        "transcripts37_path": enstx37,
        "transcripts38_path": enstx38,
        "hpogenes_path": hpogenes,
        "hpoterms_path": hpoterms,
        "hpo_to_genes_path": hpo_to_genes,
    }
    LOG.info("Setting up database %s", context.obj["mongodb"])
    if files:
        for path in pathlib.Path(files).glob("**/*"):
            if path.stem == "mim2genes":
                resource_files["mim2gene_path"] = str(path.resolve())
            if path.stem == "genemap2":
                resource_files["genemap_path"] = str(path.resolve())
            if path.stem == "hgnc":
                resource_files["hgnc_path"] = str(path.resolve())
            if path.stem == "fordist_cleaned_exac_r03_march16_z_pli_rec_null_data":
                resource_files["exac_path"] = str(path.resolve())
            if path.stem == "ensembl_genes_37":
                resource_files["genes37_path"] = str(path.resolve())
            if path.stem == "ensembl_genes_38":
                resource_files["genes38_path"] = str(path.resolve())
            if path.stem == "ensembl_transcripts_37":
                resource_files["transcripts37_path"] = str(path.resolve())
            if path.stem == "ensembl_transcripts_38":
                resource_files["transcripts38_path"] = str(path.resolve())
            if path.stem == "genes_to_phenotype":
                resource_files["hpogenes_path"] = str(path.resolve())
            if path.stem == "hpo":
                resource_files["hpoterms_path"] = str(path.resolve())
            if path.stem == "phenotype_to_genes":
                resource_files["hpo_to_genes_path"] = str(path.resolve())

    setup_scout(
        adapter=adapter,
        institute_id=institute_name,
        user_name=user_name,
        user_mail=user_mail,
        api_key=api_key,
        resource_files=resource_files,
    )