scout/server/links.py
def add_gene_links(gene_obj, build=37):
    """Update a gene object with links

    Args:
        gene_obj(dict)
        build(int)

    Returns:
        gene_obj(dict): gene_obj updated with many links
    """
    try:
        build = int(build)
    except ValueError:
        build = 37
    # Add links that use the hgnc_id
    hgnc_id = gene_obj['hgnc_id']

    gene_obj['hgnc_link'] = genenames(hgnc_id)
    gene_obj['omim_link'] = omim(hgnc_id)
    # Add links that use ensembl_id
    if not 'ensembl_id' in gene_obj:
        ensembl_id = gene_obj.get('common',{}).get('ensembl_id')
    else:
        ensembl_id = gene_obj['ensembl_id']
    ensembl_37_link = ensembl(ensembl_id, build=37)
    ensembl_38_link = ensembl(ensembl_id, build=38)
    gene_obj['ensembl_37_link'] = ensembl_37_link
    gene_obj['ensembl_38_link'] = ensembl_38_link
    gene_obj['ensembl_link'] = ensembl_37_link
    if build == 38:
        gene_obj['ensembl_link'] = ensembl_38_link
    gene_obj['hpa_link'] = hpa(ensembl_id)
    gene_obj['string_link'] = string(ensembl_id)
    gene_obj['reactome_link'] = reactome(ensembl_id)
    gene_obj['clingen_link'] = clingen(hgnc_id)
    gene_obj['expression_atlas_link'] = expression_atlas(ensembl_id)
    gene_obj['exac_link'] = exac(ensembl_id)
    # Add links that use entrez_id
    gene_obj['entrez_link'] = entrez(gene_obj.get('entrez_id'))
    # Add links that use omim id
    gene_obj['omim_link'] = omim(gene_obj.get('omim_id'))
    # Add links that use hgnc_symbol
    gene_obj['ppaint_link'] = ppaint(gene_obj['hgnc_symbol'])
    # Add links that use vega_id
    gene_obj['vega_link'] = vega(gene_obj.get('vega_id'))
    # Add links that use ucsc link
    gene_obj['ucsc_link'] = ucsc(gene_obj.get('ucsc_id'))
def add_gene_links(gene_obj, build=37):
    try:
        build = int(build)
    except ValueError:
        build = 37
    # Add links that use the hgnc_id
    hgnc_id = gene_obj['hgnc_id']

    gene_obj['hgnc_link'] = genenames(hgnc_id)
    gene_obj['omim_link'] = omim(hgnc_id)
    # Add links that use ensembl_id
    if not 'ensembl_id' in gene_obj:
        ensembl_id = gene_obj.get('common',{}).get('ensembl_id')
    else:
        ensembl_id = gene_obj['ensembl_id']
    ensembl_37_link = ensembl(ensembl_id, build=37)
    ensembl_38_link = ensembl(ensembl_id, build=38)
    gene_obj['ensembl_37_link'] = ensembl_37_link
    gene_obj['ensembl_38_link'] = ensembl_38_link
    gene_obj['ensembl_link'] = ensembl_37_link
    if build == 38:
        gene_obj['ensembl_link'] = ensembl_38_link
    gene_obj['hpa_link'] = hpa(ensembl_id)
    gene_obj['string_link'] = string(ensembl_id)
    gene_obj['reactome_link'] = reactome(ensembl_id)
    gene_obj['clingen_link'] = clingen(hgnc_id)
    gene_obj['expression_atlas_link'] = expression_atlas(ensembl_id)
    gene_obj['exac_link'] = exac(ensembl_id)
    # Add links that use entrez_id
    gene_obj['entrez_link'] = entrez(gene_obj.get('entrez_id'))
    # Add links that use omim id
    gene_obj['omim_link'] = omim(gene_obj.get('omim_id'))
    # Add links that use hgnc_symbol
    gene_obj['ppaint_link'] = ppaint(gene_obj['hgnc_symbol'])
    # Add links that use vega_id
    gene_obj['vega_link'] = vega(gene_obj.get('vega_id'))
    # Add links that use ucsc link
    gene_obj['ucsc_link'] = ucsc(gene_obj.get('ucsc_id'))
def add_gene_links ( gene_obj , build = 37 ) : try : build = int ( build ) except ValueError : build = 37 # Add links that use the hgnc_id hgnc_id = gene_obj [ 'hgnc_id' ] gene_obj [ 'hgnc_link' ] = genenames ( hgnc_id ) gene_obj [ 'omim_link' ] = omim ( hgnc_id ) # Add links that use ensembl_id if not 'ensembl_id' in gene_obj : ensembl_id = gene_obj . get ( 'common' , { } ) . get ( 'ensembl_id' ) else : ensembl_id = gene_obj [ 'ensembl_id' ] ensembl_37_link = ensembl ( ensembl_id , build = 37 ) ensembl_38_link = ensembl ( ensembl_id , build = 38 ) gene_obj [ 'ensembl_37_link' ] = ensembl_37_link gene_obj [ 'ensembl_38_link' ] = ensembl_38_link gene_obj [ 'ensembl_link' ] = ensembl_37_link if build == 38 : gene_obj [ 'ensembl_link' ] = ensembl_38_link gene_obj [ 'hpa_link' ] = hpa ( ensembl_id ) gene_obj [ 'string_link' ] = string ( ensembl_id ) gene_obj [ 'reactome_link' ] = reactome ( ensembl_id ) gene_obj [ 'clingen_link' ] = clingen ( hgnc_id ) gene_obj [ 'expression_atlas_link' ] = expression_atlas ( ensembl_id ) gene_obj [ 'exac_link' ] = exac ( ensembl_id ) # Add links that use entrez_id gene_obj [ 'entrez_link' ] = entrez ( gene_obj . get ( 'entrez_id' ) ) # Add links that use omim id gene_obj [ 'omim_link' ] = omim ( gene_obj . get ( 'omim_id' ) ) # Add links that use hgnc_symbol gene_obj [ 'ppaint_link' ] = ppaint ( gene_obj [ 'hgnc_symbol' ] ) # Add links that use vega_id gene_obj [ 'vega_link' ] = vega ( gene_obj . get ( 'vega_id' ) ) # Add links that use ucsc link gene_obj [ 'ucsc_link' ] = ucsc ( gene_obj . get ( 'ucsc_id' ) )
Update a gene object with links

    Args:
        gene_obj(dict)
        build(int)

    Returns:
        gene_obj(dict): gene_obj updated with many links
Update a gene object with links