scripts/export/genomes/genome_fetch.py
def fetch_genome_accessions(upid, gca_acc):
    """
    Fetches and returns a list of all accessions for a specific ref. proteome

    upid: Uniprot's ref. proteome id
    gca_acc: An ENA GCA accession associated with the upid (if available or -1)
    """

    gen_accs = []
    gca_acc = str(gca_acc)

    # there's a GCA accession
    if gca_acc != "-1":
        gca_acc = gca_acc.split('.')[0]
        gen_accs = extract_assembly_accs(gca_acc)

    else:
        prot_accs = proteome_rdf_scanner(upid)

        # no GCA or WGS, get any accessions from proteome rdf
        if prot_accs["GCA"] == -1 and prot_accs["WGS"] == -1:
            gen_accs = rdf_accession_search(upid, "/embl/")

        # found a GCA accession in the rdf file
        elif prot_accs["GCA"] != -1 and prot_accs["WGS"] == -1:
            gen_accs = extract_assembly_accs(prot_accs["GCA"])

        # WGS found
        elif prot_accs["GCA"] == -1 and prot_accs["WGS"] != -1:
            # call get_wgs_range directly here
            gen_accs = extract_assembly_accs(prot_accs["WGS"])

    # for all other cases this function will return an empty list

    return gen_accs

    Fetches and returns a list of all accessions for a specific ref. proteome

    upid: Uniprot's ref. proteome id
    gca_acc: An ENA GCA accession associated with the upid (if available or -1)
    
Fetches and returns a list of all accessions for a specific ref. proteome
upid: Uniprot's ref. proteome id
gca_acc: An ENA GCA accession associated with the upid (if available or -1)
Fetches and returns a list of all accessions for a specific ref . proteome upid : Uniprot ' s ref . proteome id gca_acc : An ENA GCA accession associated with the upid ( if available or - 1 )
def fetch_genome_accessions(upid, gca_acc):
    gen_accs = []
    gca_acc = str(gca_acc)
    if gca_acc != "-1":
        gca_acc = gca_acc.split('.')[0]
        gen_accs = extract_assembly_accs(gca_acc)
    else:
        prot_accs = proteome_rdf_scanner(upid)
        if prot_accs["GCA"] == -1 and prot_accs["WGS"] == -1:
            gen_accs = rdf_accession_search(upid, "/embl/")
        elif prot_accs["GCA"] != -1 and prot_accs["WGS"] == -1:
            gen_accs = extract_assembly_accs(prot_accs["GCA"])
        elif prot_accs["GCA"] == -1 and prot_accs["WGS"] != -1:
            gen_accs = extract_assembly_accs(prot_accs["WGS"])
    return gen_accs
def fetch_genome_accessions ( upid , gca_acc ) : gen_accs = [ ] gca_acc = str ( gca_acc ) if gca_acc != "-1" : gca_acc = gca_acc . split ( '.' ) [ 0 ] gen_accs = extract_assembly_accs ( gca_acc ) else : prot_accs = proteome_rdf_scanner ( upid ) if prot_accs [ "GCA" ] == - 1 and prot_accs [ "WGS" ] == - 1 : gen_accs = rdf_accession_search ( upid , "/embl/" ) elif prot_accs [ "GCA" ] != - 1 and prot_accs [ "WGS" ] == - 1 : gen_accs = extract_assembly_accs ( prot_accs [ "GCA" ] ) elif prot_accs [ "GCA" ] == - 1 and prot_accs [ "WGS" ] != - 1 : gen_accs = extract_assembly_accs ( prot_accs [ "WGS" ] ) return gen_accs
Fetches and returns a list of all accessions for a specific ref.
Fetches and returns a list of all accessions for a specific ref .
"""
    Fetches and returns a list of all accessions for a specific ref. proteome

    upid: Uniprot's ref. proteome id
    gca_acc: An ENA GCA accession associated with the upid (if available or -1)
    """ # there's a GCA accession # no GCA or WGS, get any accessions from proteome rdf # found a GCA accession in the rdf file # WGS found # call get_wgs_range directly here # for all other cases this function will return an empty list
upid
gca_acc