scripts/export/genomes/genome_fetch.py
def load_upid_gca_pairs():
    """
    This is an alternative version to load_upid_gca_file loading the pairs from
    Uniprot's REST API. Returns a dictionary of upid, gca accession pairs,
    including the species kingdom
    """

    id_pairs = {}
    response = requests.get(gc.REF_PROT_REST_URL)

    if response.status_code == 200:
        content = response.content
        prot_lines = content.split('\n')

        # remove header line
        prot_lines.pop(0)

        for prot_line in prot_lines:
            if prot_line != '':
                prot_line = prot_line.strip().split('\t')
                tax_str = prot_line[2].split(',')[0].lower().strip()
                gca_acc = prot_line[1]
                if gca_acc != '':
                    id_pairs[prot_line[0]] = {
                        "GCA": prot_line[1], "DOM": tax_str}
                else:
                    id_pairs[prot_line[0]] = {"GCA": -1, "DOM": tax_str}
    else:
        # raise an error here
        pass

    return id_pairs

    This is an alternative version to load_upid_gca_file loading the pairs from
    Uniprot's REST API. Returns a dictionary of upid, gca accession pairs,
    including the species kingdom
    
This is an alternative version to load_upid_gca_file loading the pairs from
Uniprot's REST API. Returns a dictionary of upid, gca accession pairs,
including the species kingdom
This is an alternative version to load_upid_gca_file loading the pairs from Uniprot ' s REST API . Returns a dictionary of upid gca accession pairs including the species kingdom
def load_upid_gca_pairs():
    id_pairs = {}
    response = requests.get(gc.REF_PROT_REST_URL)
    if response.status_code == 200:
        content = response.content
        prot_lines = content.split('\n')
        prot_lines.pop(0)
        for prot_line in prot_lines:
            if prot_line != '':
                prot_line = prot_line.strip().split('\t')
                tax_str = prot_line[2].split(',')[0].lower().strip()
                gca_acc = prot_line[1]
                if gca_acc != '':
                    id_pairs[prot_line[0]] = {
                        "GCA": prot_line[1], "DOM": tax_str}
                else:
                    id_pairs[prot_line[0]] = {"GCA": -1, "DOM": tax_str}
    else:
        pass
    return id_pairs
def load_upid_gca_pairs ( ) : id_pairs = { } response = requests . get ( gc . REF_PROT_REST_URL ) if response . status_code == 200 : content = response . content prot_lines = content . split ( '\n' ) prot_lines . pop ( 0 ) for prot_line in prot_lines : if prot_line != '' : prot_line = prot_line . strip ( ) . split ( '\t' ) tax_str = prot_line [ 2 ] . split ( ',' ) [ 0 ] . lower ( ) . strip ( ) gca_acc = prot_line [ 1 ] if gca_acc != '' : id_pairs [ prot_line [ 0 ] ] = { "GCA" : prot_line [ 1 ] , "DOM" : tax_str } else : id_pairs [ prot_line [ 0 ] ] = { "GCA" : - 1 , "DOM" : tax_str } else : pass return id_pairs
This is an alternative version to load_upid_gca_file loading the pairs from
Uniprot's REST API.
This is an alternative version to load_upid_gca_file loading the pairs from Uniprot ' s REST API .
"""
    This is an alternative version to load_upid_gca_file loading the pairs from
    Uniprot's REST API. Returns a dictionary of upid, gca accession pairs,
    including the species kingdom
    """ # remove header line # raise an error here