scout/parse/omim.py
def get_mim_phenotypes(genemap_lines):
    """Get a dictionary with phenotypes
    
    Use the mim numbers for phenotypes as keys and phenotype information as 
    values.

    Args:
        genemap_lines(iterable(str))
    
    Returns:
        phenotypes_found(dict): A dictionary with mim_numbers as keys and 
        dictionaries with phenotype information as values.
    
        {
             'description': str, # Description of the phenotype
             'hgnc_symbols': set(), # Associated hgnc symbols
             'inheritance': set(),  # Associated phenotypes
             'mim_number': int, # mim number of phenotype
        }
    """
    # Set with all omim numbers that are phenotypes
    # Parsed from mim2gene.txt
    phenotype_mims = set()
    
    phenotypes_found = {}

    # Genemap is a file with one entry per gene.
    # Each line hold a lot of information and in specific it
    # has information about the phenotypes that a gene is associated with
    # From this source we collect inheritane patterns and what hgnc symbols
    # a phenotype is associated with
    for entry in parse_genemap2(genemap_lines):
        hgnc_symbol = entry['hgnc_symbol']
        for phenotype in entry['phenotypes']:
            mim_nr = phenotype['mim_number']
            if mim_nr in phenotypes_found:
                phenotype_entry = phenotypes_found[mim_nr]
                phenotype_entry['inheritance'] = phenotype_entry['inheritance'].union(phenotype['inheritance'])
                phenotype_entry['hgnc_symbols'].add(hgnc_symbol)
            else:
                phenotype['hgnc_symbols'] = set([hgnc_symbol])
                phenotypes_found[mim_nr] = phenotype

    return phenotypes_found
def get_mim_phenotypes(genemap_lines):
    # Set with all omim numbers that are phenotypes
    # Parsed from mim2gene.txt
    phenotype_mims = set()
    
    phenotypes_found = {}

    # Genemap is a file with one entry per gene.
    # Each line hold a lot of information and in specific it
    # has information about the phenotypes that a gene is associated with
    # From this source we collect inheritane patterns and what hgnc symbols
    # a phenotype is associated with
    for entry in parse_genemap2(genemap_lines):
        hgnc_symbol = entry['hgnc_symbol']
        for phenotype in entry['phenotypes']:
            mim_nr = phenotype['mim_number']
            if mim_nr in phenotypes_found:
                phenotype_entry = phenotypes_found[mim_nr]
                phenotype_entry['inheritance'] = phenotype_entry['inheritance'].union(phenotype['inheritance'])
                phenotype_entry['hgnc_symbols'].add(hgnc_symbol)
            else:
                phenotype['hgnc_symbols'] = set([hgnc_symbol])
                phenotypes_found[mim_nr] = phenotype

    return phenotypes_found
def get_mim_phenotypes ( genemap_lines ) : # Set with all omim numbers that are phenotypes # Parsed from mim2gene.txt phenotype_mims = set ( ) phenotypes_found = { } # Genemap is a file with one entry per gene. # Each line hold a lot of information and in specific it # has information about the phenotypes that a gene is associated with # From this source we collect inheritane patterns and what hgnc symbols # a phenotype is associated with for entry in parse_genemap2 ( genemap_lines ) : hgnc_symbol = entry [ 'hgnc_symbol' ] for phenotype in entry [ 'phenotypes' ] : mim_nr = phenotype [ 'mim_number' ] if mim_nr in phenotypes_found : phenotype_entry = phenotypes_found [ mim_nr ] phenotype_entry [ 'inheritance' ] = phenotype_entry [ 'inheritance' ] . union ( phenotype [ 'inheritance' ] ) phenotype_entry [ 'hgnc_symbols' ] . add ( hgnc_symbol ) else : phenotype [ 'hgnc_symbols' ] = set ( [ hgnc_symbol ] ) phenotypes_found [ mim_nr ] = phenotype return phenotypes_found
Get a dictionary with phenotypes
    
    Use the mim numbers for phenotypes as keys and phenotype information as 
    values.

    Args:
        genemap_lines(iterable(str))
    
    Returns:
        phenotypes_found(dict): A dictionary with mim_numbers as keys and 
        dictionaries with phenotype information as values.
    
        {
             'description': str, # Description of the phenotype
             'hgnc_symbols': set(), # Associated hgnc symbols
             'inheritance': set(),  # Associated phenotypes
             'mim_number': int, # mim number of phenotype
        }
Get a dictionary with phenotypes Use the mim numbers for phenotypes as keys and phenotype information as values .