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


Groups > comp.lang.python > #62728 > unrolled thread

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

Started byJason Friedman <jsf80238@gmail.com>
First post2013-12-25 23:24 -0700
Last post2013-12-25 23:24 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

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

FromJason Friedman <jsf80238@gmail.com>
Date2013-12-25 23:24 -0700
SubjectRe: Getting updates and restarting a long running url request.
Message-ID<mailman.4624.1388039088.18130.python-list@python.org>
> 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.")

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web