Getting updates and restarting a long running url request.

Jason Friedman jsf80238 at gmail.com
Thu Dec 26 01:24:40 EST 2013


> 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.")



More information about the Python-list mailing list