Example #1
0
def test_load_hpo(
    gene_database,
    hpo_terms_handle,
    hpo_to_genes_handle,
    genemap_file,
    hpo_disease_handle,
):
    adapter = gene_database

    # GIVEN a populated database with genes but no hpo terms
    assert len([term for term in adapter.hpo_terms()]) == 0
    genemap_handle = get_file_handle(genemap_file)

    # WHEN loading the disease and hpo terms
    load_hpo(
        adapter=gene_database,
        hpo_lines=hpo_terms_handle,
        hpo_gene_lines=hpo_to_genes_handle,
        disease_lines=genemap_handle,
        hpo_disease_lines=hpo_disease_handle,
    )

    # THEN make sure that the disease terms are in the database
    hpo_terms_objs = adapter.hpo_terms()
    disease_objs = adapter.disease_terms()

    assert len([term for term in hpo_terms_objs]) > 0
    assert len([disease for disease in disease_objs]) > 0
Example #2
0
def real_hpo_database(request, real_gene_database, hpo_terms_handle,
                      genemap_handle):
    "Returns an adapter to a database populated with hpo terms"
    adapter = real_gene_database

    load_hpo(adapter=gene_database,
             hpo_lines=hpo_terms_handle,
             disease_lines=genemap_handle,
             hpo_disease_lines=hpo_disease_handle)

    return adapter
Example #3
0
def hpo_database(request, gene_database, hpo_terms_handle, hpo_to_genes_handle,
                 hpo_disease_handle):
    "Returns an adapter to a database populated with hpo terms"
    adapter = gene_database

    load_hpo(
        adapter=gene_database,
        hpo_lines=get_file_handle(hpoterms_reduced_path),
        hpo_gene_lines=get_file_handle(hpo_to_genes_reduced_path),
        disease_lines=get_file_handle(genemap2_reduced_path),
        hpo_disease_lines=get_file_handle(hpo_phenotype_to_terms_reduced_path),
    )

    return adapter
Example #4
0
def test_load_hpo(gene_database, hpo_terms_handle, hpo_to_genes_handle, genemap_file, hpo_disease_handle):
    adapter = gene_database
    
    # GIVEN a populated database with genes but no hpo terms
    assert len([term for term in adapter.hpo_terms()]) == 0
    genemap_handle = get_file_handle(genemap_file)

    # WHEN loading the disease and hpo terms
    load_hpo(
        adapter=gene_database,
        hpo_lines=hpo_terms_handle,
        hpo_gene_lines=hpo_to_genes_handle,
        disease_lines=genemap_handle,
        hpo_disease_lines=hpo_disease_handle,
    )

    # THEN make sure that the disease terms are in the database
    hpo_terms_objs = adapter.hpo_terms()
    disease_objs = adapter.disease_terms()

    assert len([term for term in hpo_terms_objs]) > 0
    assert len([disease for disease in disease_objs]) > 0