Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #62728

Re: Getting updates and restarting a long running url request.

References <CALyJZZXX4cBtx_VVFpEWB8WEkVPNbgj0r-T1XX5nttmZWkNHDw@mail.gmail.com>
Date 2013-12-25 23:24 -0700
Subject Re: Getting updates and restarting a long running url request.
From Jason Friedman <jsf80238@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.4624.1388039088.18130.python-list@python.org> (permalink)

Show all headers | View raw


> I am using the following code to submit the query/
> def get_BLAST(taxid, queryseq, args=None):
>     '''
>     Input taxid to BLAST queryseq against
>     '''
>     e_query = "txid" + taxid + " [ORGN]"
>     #, other_advanced='-G 4 -E 1'
>     blast_result = NCBIWWW.qblast("blastn", "nt", queryseq, megablast=True,
> entrez_query=e_query, word_size='11', other_advanced='-G 5 -E 2')
>     return NCBIXML.read(blast_result)

Could you keep track of success?

result_dict = dict()
for id in taxid_list:
    result_dict[id] = False
while not all(result_dict.values()): # continue if not every ID was successful
    for id in taxid_list:
        if result_dict[id]:
            continue # We were already successful with this ID
        try:
            this_result = get_BLAST(id)
            result_dict[id] = True
        except:
            print("A warning.")

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Getting updates and restarting a long running url request. Jason Friedman <jsf80238@gmail.com> - 2013-12-25 23:24 -0700

csiph-web