def get_mim_genes(genemap_lines, mim2gene_lines):
    """Get a dictionary with genes and their omim information
    
    Args:
        genemap_lines(iterable(str))
        mim2gene_lines(iterable(str))
    
    Returns.
        hgnc_genes(dict): A dictionary with hgnc_symbol as keys
    
    """
    LOG.info("Get the mim genes")
    
    genes = {}
    hgnc_genes = {}
    
    gene_nr = 0
    no_hgnc = 0
    
    for entry in parse_mim2gene(mim2gene_lines):
        if 'gene' in entry['entry_type']:
            mim_nr = entry['mim_number']
            gene_nr += 1
            if not 'hgnc_symbol' in entry:
                no_hgnc += 1
            else:
                genes[mim_nr] = entry
    
    LOG.info("Number of genes without hgnc symbol %s", str(no_hgnc))
    
    for entry in parse_genemap2(genemap_lines):
        mim_number = entry['mim_number']
        inheritance = entry['inheritance']
        phenotype_info = entry['phenotypes']
        hgnc_symbol = entry['hgnc_symbol']
        hgnc_symbols = entry['hgnc_symbols']
        if mim_number in genes:
            genes[mim_number]['inheritance'] = inheritance
            genes[mim_number]['phenotypes'] = phenotype_info
            genes[mim_number]['hgnc_symbols'] = hgnc_symbols

    for mim_nr in genes:
        gene_info = genes[mim_nr]
        hgnc_symbol = gene_info['hgnc_symbol']
        
        if hgnc_symbol in hgnc_genes:
            existing_info = hgnc_genes[hgnc_symbol]
            if not existing_info['phenotypes']:
                hgnc_genes[hgnc_symbol] = gene_info
            
        else:
            hgnc_genes[hgnc_symbol] = gene_info
    
    return hgnc_genes
def get_mim_genes(genemap_lines, mim2gene_lines):
    """Get a dictionary with genes and their omim information
    
    Args:
        genemap_lines(iterable(str))
        mim2gene_lines(iterable(str))
    
    Returns.
        hgnc_genes(dict): A dictionary with hgnc_symbol as keys
    
    """
    LOG.info("Get the mim genes")
    
    genes = {}
    hgnc_genes = {}
    
    gene_nr = 0
    no_hgnc = 0
    
    for entry in parse_mim2gene(mim2gene_lines):
        if 'gene' in entry['entry_type']:
            mim_nr = entry['mim_number']
            gene_nr += 1
            if not 'hgnc_symbol' in entry:
                no_hgnc += 1
            else:
                genes[mim_nr] = entry
    
    LOG.info("Number of genes without hgnc symbol %s", str(no_hgnc))
    
    for entry in parse_genemap2(genemap_lines):
        mim_number = entry['mim_number']
        inheritance = entry['inheritance']
        phenotype_info = entry['phenotypes']
        hgnc_symbol = entry['hgnc_symbol']
        hgnc_symbols = entry['hgnc_symbols']
        if mim_number in genes:
            genes[mim_number]['inheritance'] = inheritance
            genes[mim_number]['phenotypes'] = phenotype_info
            genes[mim_number]['hgnc_symbols'] = hgnc_symbols

    for mim_nr in genes:
        gene_info = genes[mim_nr]
        hgnc_symbol = gene_info['hgnc_symbol']
        
        if hgnc_symbol in hgnc_genes:
            existing_info = hgnc_genes[hgnc_symbol]
            if not existing_info['phenotypes']:
                hgnc_genes[hgnc_symbol] = gene_info
            
        else:
            hgnc_genes[hgnc_symbol] = gene_info
    
    return hgnc_genes
def get_mim_genes ( genemap_lines , mim2gene_lines ) : LOG . info ( "Get the mim genes" ) genes = { } hgnc_genes = { } gene_nr = 0 no_hgnc = 0 for entry in parse_mim2gene ( mim2gene_lines ) : if 'gene' in entry [ 'entry_type' ] : mim_nr = entry [ 'mim_number' ] gene_nr += 1 if not 'hgnc_symbol' in entry : no_hgnc += 1 else : genes [ mim_nr ] = entry LOG . info ( "Number of genes without hgnc symbol %s" , str ( no_hgnc ) ) for entry in parse_genemap2 ( genemap_lines ) : mim_number = entry [ 'mim_number' ] inheritance = entry [ 'inheritance' ] phenotype_info = entry [ 'phenotypes' ] hgnc_symbol = entry [ 'hgnc_symbol' ] hgnc_symbols = entry [ 'hgnc_symbols' ] if mim_number in genes : genes [ mim_number ] [ 'inheritance' ] = inheritance genes [ mim_number ] [ 'phenotypes' ] = phenotype_info genes [ mim_number ] [ 'hgnc_symbols' ] = hgnc_symbols for mim_nr in genes : gene_info = genes [ mim_nr ] hgnc_symbol = gene_info [ 'hgnc_symbol' ] if hgnc_symbol in hgnc_genes : existing_info = hgnc_genes [ hgnc_symbol ] if not existing_info [ 'phenotypes' ] : hgnc_genes [ hgnc_symbol ] = gene_info else : hgnc_genes [ hgnc_symbol ] = gene_info return hgnc_genes
Get a dictionary with genes and their omim information
    
    Args:
        genemap_lines(iterable(str))
        mim2gene_lines(iterable(str))
    
    Returns.
        hgnc_genes(dict): A dictionary with hgnc_symbol as keys
Get a dictionary with genes and their omim information Args : genemap_lines ( iterable ( str )) mim2gene_lines ( iterable ( str )) Returns . hgnc_genes ( dict ) : A dictionary with hgnc_symbol as keys