scout/parse/hpo.py
def parse_hpo_phenotypes(hpo_lines):
    """Parse hpo phenotypes
    
        Group the genes that a phenotype is associated to in 'genes'
    
    Args:
        hpo_lines(iterable(str)): A file handle to the hpo phenotypes file
    
    Returns:
        hpo_terms(dict): A dictionary with hpo_ids as keys and terms as values
    
        {
            <hpo_id>: {
                'hpo_id':str,
                'description': str,
                'hgnc_symbols': list(str), # [<hgnc_symbol>, ...]
                }
        }
    """
    hpo_terms = {}
    LOG.info("Parsing hpo phenotypes...")
    for index, line in enumerate(hpo_lines):
        if index > 0 and len(line) > 0:
            hpo_info = parse_hpo_phenotype(line)
            hpo_term = hpo_info['hpo_id']
            hgnc_symbol = hpo_info['hgnc_symbol']
            if hpo_term in hpo_terms:
                hpo_terms[hpo_term]['hgnc_symbols'].append(hgnc_symbol)
            else:
                hpo_terms[hpo_term] = {
                    'hpo_id':hpo_term,
                    'description': hpo_info['description'],
                    'hgnc_symbols': [hgnc_symbol]
                }
    LOG.info("Parsing done.")
    return hpo_terms
def parse_hpo_phenotypes(hpo_lines):
    """Parse hpo phenotypes
    
        Group the genes that a phenotype is associated to in 'genes'
    
    Args:
        hpo_lines(iterable(str)): A file handle to the hpo phenotypes file
    
    Returns:
        hpo_terms(dict): A dictionary with hpo_ids as keys and terms as values
    
        {
            <hpo_id>: {
                'hpo_id':str,
                'description': str,
                'hgnc_symbols': list(str), # [<hgnc_symbol>, ...]
                }
        }
    """
    hpo_terms = {}
    LOG.info("Parsing hpo phenotypes...")
    for index, line in enumerate(hpo_lines):
        if index > 0 and len(line) > 0:
            hpo_info = parse_hpo_phenotype(line)
            hpo_term = hpo_info['hpo_id']
            hgnc_symbol = hpo_info['hgnc_symbol']
            if hpo_term in hpo_terms:
                hpo_terms[hpo_term]['hgnc_symbols'].append(hgnc_symbol)
            else:
                hpo_terms[hpo_term] = {
                    'hpo_id':hpo_term,
                    'description': hpo_info['description'],
                    'hgnc_symbols': [hgnc_symbol]
                }
    LOG.info("Parsing done.")
    return hpo_terms
Parse hpo phenotypes
    
        Group the genes that a phenotype is associated to in 'genes'
    
    Args:
        hpo_lines(iterable(str)): A file handle to the hpo phenotypes file
    
    Returns:
        hpo_terms(dict): A dictionary with hpo_ids as keys and terms as values
    
        {
            <hpo_id>: {
                'hpo_id':str,
                'description': str,
                'hgnc_symbols': list(str), # [<hgnc_symbol>, ...]
                }
        }