scout/load/hpo.py
def load_disease_terms(adapter, genemap_lines, genes=None, hpo_disease_lines=None):
    """Load the omim phenotypes into the database
    
    Parse the phenotypes from genemap2.txt and find the associated hpo terms
    from ALL_SOURCES_ALL_FREQUENCIES_diseases_to_genes_to_phenotypes.txt.

    Args:
        adapter(MongoAdapter)
        genemap_lines(iterable(str))
        genes(dict): Dictionary with all genes found in database
        hpo_disease_lines(iterable(str))

    """
    # Get a map with hgnc symbols to hgnc ids from scout
    if not genes:
        genes = adapter.genes_by_alias()

    # Fetch the disease terms from omim
    disease_terms = get_mim_phenotypes(genemap_lines=genemap_lines)

    if not hpo_disease_lines:
        hpo_disease_lines = fetch_hpo_phenotype_to_terms()
    hpo_diseases = parse_hpo_diseases(hpo_disease_lines)

    start_time = datetime.now()
    nr_diseases = None

    LOG.info("Loading the hpo disease...")
    for nr_diseases, disease_number in enumerate(disease_terms):
        disease_info = disease_terms[disease_number]
        disease_id = "OMIM:{0}".format(disease_number)
        
        if disease_id in hpo_diseases:
            hpo_terms = hpo_diseases[disease_id]['hpo_terms']
            if hpo_terms:
                disease_info['hpo_terms'] = hpo_terms
        disease_obj = build_disease_term(disease_info, genes)

        adapter.load_disease_term(disease_obj)

    LOG.info("Loading done. Nr of diseases loaded {0}".format(nr_diseases))
    LOG.info("Time to load diseases: {0}".format(datetime.now() - start_time))
def load_disease_terms(adapter, genemap_lines, genes=None, hpo_disease_lines=None):
    # Get a map with hgnc symbols to hgnc ids from scout
    if not genes:
        genes = adapter.genes_by_alias()

    # Fetch the disease terms from omim
    disease_terms = get_mim_phenotypes(genemap_lines=genemap_lines)

    if not hpo_disease_lines:
        hpo_disease_lines = fetch_hpo_phenotype_to_terms()
    hpo_diseases = parse_hpo_diseases(hpo_disease_lines)

    start_time = datetime.now()
    nr_diseases = None

    LOG.info("Loading the hpo disease...")
    for nr_diseases, disease_number in enumerate(disease_terms):
        disease_info = disease_terms[disease_number]
        disease_id = "OMIM:{0}".format(disease_number)
        
        if disease_id in hpo_diseases:
            hpo_terms = hpo_diseases[disease_id]['hpo_terms']
            if hpo_terms:
                disease_info['hpo_terms'] = hpo_terms
        disease_obj = build_disease_term(disease_info, genes)

        adapter.load_disease_term(disease_obj)

    LOG.info("Loading done. Nr of diseases loaded {0}".format(nr_diseases))
    LOG.info("Time to load diseases: {0}".format(datetime.now() - start_time))
def load_disease_terms ( adapter , genemap_lines , genes = None , hpo_disease_lines = None ) : # Get a map with hgnc symbols to hgnc ids from scout if not genes : genes = adapter . genes_by_alias ( ) # Fetch the disease terms from omim disease_terms = get_mim_phenotypes ( genemap_lines = genemap_lines ) if not hpo_disease_lines : hpo_disease_lines = fetch_hpo_phenotype_to_terms ( ) hpo_diseases = parse_hpo_diseases ( hpo_disease_lines ) start_time = datetime . now ( ) nr_diseases = None LOG . info ( "Loading the hpo disease..." ) for nr_diseases , disease_number in enumerate ( disease_terms ) : disease_info = disease_terms [ disease_number ] disease_id = "OMIM:{0}" . format ( disease_number ) if disease_id in hpo_diseases : hpo_terms = hpo_diseases [ disease_id ] [ 'hpo_terms' ] if hpo_terms : disease_info [ 'hpo_terms' ] = hpo_terms disease_obj = build_disease_term ( disease_info , genes ) adapter . load_disease_term ( disease_obj ) LOG . info ( "Loading done. Nr of diseases loaded {0}" . format ( nr_diseases ) ) LOG . info ( "Time to load diseases: {0}" . format ( datetime . now ( ) - start_time ) )
Load the omim phenotypes into the database
    
    Parse the phenotypes from genemap2.txt and find the associated hpo terms
    from ALL_SOURCES_ALL_FREQUENCIES_diseases_to_genes_to_phenotypes.txt.

    Args:
        adapter(MongoAdapter)
        genemap_lines(iterable(str))
        genes(dict): Dictionary with all genes found in database
        hpo_disease_lines(iterable(str))
Load the omim phenotypes into the database Parse the phenotypes from genemap2 . txt and find the associated hpo terms from ALL_SOURCES_ALL_FREQUENCIES_diseases_to_genes_to_phenotypes . txt .