scripts/export/genomes/genome_fetch.py
def proteome_rdf_scanner(proteome):
    """
    Scans a Uniprot's reference proteome rdf file and looks for all
    available accessions. Returns a dictionary with GCA and WGS accessions
    where applicable

    prot_rdf: Uniprot's proteome rdf url or file path
    """

    # need to do some http error handling here and if resource is unavailable
    # return None and or http error code

    prot_rdf = PROTEOME_URL % proteome

    accessions = {"GCA": -1, "WGS": -1}
    wgs_flag = False
    g = Graph()

    if requests.get(prot_rdf).status_code == httplib.OK:
        g.load(prot_rdf)

        # scan for accessions
        for s, p, o in g:
            # look for ENA accessions
            if string.find(o, "/embl/") != -1:
                if string.find(o, "GCA") != -1:
                    accessions["GCA"] = os.path.split(o)[1]

                elif wgs_flag is True:
                    accessions["WGS"] = os.path.split(o)[1]

            # if WGS keyword found, set flag to true
            elif string.find(o, "WGS") != -1:
                wgs_flag = True
    else:
        pass

    return accessions

    Scans a Uniprot's reference proteome rdf file and looks for all
    available accessions. Returns a dictionary with GCA and WGS accessions
    where applicable

    prot_rdf: Uniprot's proteome rdf url or file path
    
Scans a Uniprot's reference proteome rdf file and looks for all
available accessions. Returns a dictionary with GCA and WGS accessions
where applicable

Uniprot's proteome rdf url or file path
Scans a Uniprot ' s reference proteome rdf file and looks for all available accessions . Returns a dictionary with GCA and WGS accessions where applicable Uniprot ' s proteome rdf url or file path
def proteome_rdf_scanner(proteome):
    prot_rdf = PROTEOME_URL % proteome
    accessions = {"GCA": -1, "WGS": -1}
    wgs_flag = False
    g = Graph()
    if requests.get(prot_rdf).status_code == httplib.OK:
        g.load(prot_rdf)
        for s, p, o in g:
            if string.find(o, "/embl/") != -1:
                if string.find(o, "GCA") != -1:
                    accessions["GCA"] = os.path.split(o)[1]
                elif wgs_flag is True:
                    accessions["WGS"] = os.path.split(o)[1]
            elif string.find(o, "WGS") != -1:
                wgs_flag = True
    else:
        pass
    return accessions
def proteome_rdf_scanner ( proteome ) : prot_rdf = PROTEOME_URL % proteome accessions = { "GCA" : - 1 , "WGS" : - 1 } wgs_flag = False g = Graph ( ) if requests . get ( prot_rdf ) . status_code == httplib . OK : g . load ( prot_rdf ) for s , p , o in g : if string . find ( o , "/embl/" ) != - 1 : if string . find ( o , "GCA" ) != - 1 : accessions [ "GCA" ] = os . path . split ( o ) [ 1 ] elif wgs_flag is True : accessions [ "WGS" ] = os . path . split ( o ) [ 1 ] elif string . find ( o , "WGS" ) != - 1 : wgs_flag = True else : pass return accessions
Scans a Uniprot's reference proteome rdf file and looks for all
available accessions.
Scans a Uniprot ' s reference proteome rdf file and looks for all available accessions .
"""
    Scans a Uniprot's reference proteome rdf file and looks for all
    available accessions. Returns a dictionary with GCA and WGS accessions
    where applicable

    prot_rdf: Uniprot's proteome rdf url or file path
    """ # need to do some http error handling here and if resource is unavailable # return None and or http error code # scan for accessions # look for ENA accessions # if WGS keyword found, set flag to true
proteome