Ejemplo n.º 1
0
def hpo():
    """
    Update the hpo terms in the database. Fetch the latest release and update terms.
    """
    LOG.info("Running scout update hpo")
    adapter = store

    LOG.info("Dropping HPO terms")
    adapter.hpo_term_collection.drop()
    LOG.debug("HPO terms dropped")

    load_hpo_terms(adapter)
Ejemplo n.º 2
0
def hpo(context):
    """
    Update the hpo terms in the database. Fetch the latest release and update terms.
    """
    LOG.info("Running scout update hpo")
    adapter = context.obj['adapter']

    LOG.info("Dropping HPO terms")
    adapter.hpo_term_collection.drop()
    LOG.debug("HPO terms dropped")

    load_hpo_terms(adapter)
Ejemplo n.º 3
0
def test_load_hpo_terms(gene_database, hpo_terms_handle):
    adapter = gene_database
    alias_genes = adapter.genes_by_alias()
    # GIVEN a populated database with genes
    assert len([term for term in adapter.hpo_terms()]) == 0
    assert len([gene for gene in adapter.all_genes()]) > 0

    # WHEN loading the disease terms
    load_hpo_terms(adapter=adapter,
                   hpo_lines=hpo_terms_handle,
                   genes=alias_genes)

    # THEN make sure that the disease terms are in the database
    hpo_terms_objs = adapter.hpo_terms()
    assert len([term for term in hpo_terms_objs]) > 0
Ejemplo n.º 4
0
def hpo(context):
    """
    Update the hpo terms in the database. Fetch the latest release and update terms.
    """
    LOG.info("Running scout update hpo")
    adapter = context.obj['adapter']
    
    LOG.info("Dropping HPO terms")
    adapter.hpo_term_collection.drop()
    LOG.debug("HPO terms dropped")
    
    # Fetch the latest version of the hpo terms
    hpo_lines = fetch_hpo_terms()
    # Fetch the connection to genes from hpo source
    hpo_gene_lines = fetch_hpo_to_genes()
    
    load_hpo_terms(adapter, hpo_lines, hpo_gene_lines)
Ejemplo n.º 5
0
def hpo(hpoterms, hpo_to_genes):
    """
    Update the hpo terms in the database. Fetch the latest release and update terms.
    """
    LOG.info("Running scout update hpo")
    adapter = store

    LOG.info("Dropping HPO terms")
    adapter.hpo_term_collection.delete_many({})
    LOG.debug("HPO terms dropped")

    if hpoterms:
        hpoterms = get_file_handle(hpoterms)
    if hpo_to_genes:
        hpo_to_genes = get_file_handle(hpo_to_genes)

    load_hpo_terms(adapter, hpo_lines=hpoterms, hpo_gene_lines=hpo_to_genes)
Ejemplo n.º 6
0
def test_load_hpo_terms(gene_database, hpo_terms_handle, hpo_to_genes_handle):
    adapter = gene_database
    alias_genes = adapter.genes_by_alias()
    
    # GIVEN a populated database with genes but no hpo terms
    assert len([term for term in adapter.hpo_terms()]) == 0
    assert len([gene for gene in adapter.all_genes()]) > 0
    
    # WHEN loading the hpo terms
    load_hpo_terms(
        adapter=adapter, 
        hpo_lines=hpo_terms_handle,
        hpo_gene_lines=hpo_to_genes_handle,
        alias_genes=alias_genes
    )
    
    # THEN make sure that the disease terms are in the database
    hpo_terms_objs = adapter.hpo_terms()
    assert len([term for term in hpo_terms_objs]) > 0
Ejemplo n.º 7
0
def hpo(ctx, hpo_terms):
    """
    Load the hpo terms to the mongo database.
    """
    adapter = ctx.obj['adapter']

    logger.info("Dropping HpoTerms")
    adapter.hpo_term_collection.drop()
    logger.debug("HpoTerms dropped")

    logger.info("Loading hpo terms from file {0}".format(hpo_terms))

    hpo_terms_handle = get_file_handle(hpo_terms)

    alias_genes = adapter.genes_by_alias()

    load_hpo_terms(
        adapter=adapter,
        hpo_lines=hpo_terms_handle,
        genes=alias_genes,
    )

    logger.info("Successfully loaded all hpo terms")