Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.047 X-Spam-Evidence: '*H*': 0.91; '*S*': 0.00; 'url:pipermail': 0.05; 'subject:Getting': 0.07; 'suppose': 0.07; 'except:': 0.09; 'received:209.85.219': 0.09; 'try:': 0.09; 'wrote:': 0.18; 'wed,': 0.18; 'seems': 0.21; 'appears': 0.22; 'example': 0.22; 'email addr:gmail.com>': 0.22; 'to:name:python-list@python.org': 0.22; 'error': 0.23; 'possibly': 0.26; 'header:In-Reply-To:1': 0.27; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'that.': 0.31; '25,': 0.31; 'could': 0.34; 'received:209.85': 0.35; 'connection': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'really': 0.36; 'false': 0.36; 'thanks': 0.36; 'url:org': 0.36; 'received:209': 0.37; 'jason': 0.38; 'to:addr:python-list': 0.38; 'pm,': 0.38; 'track': 0.38; 'sure': 0.39; 'to:addr:python.org': 0.39; 'either': 0.39; 'results.': 0.60; 'lost': 0.61; 'skip:n 10': 0.64; 'more': 0.64; 'internet': 0.71; 'blast': 0.84; 'dict()': 0.84; 'subject:long': 0.84; '2013': 0.98 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-type; bh=QRk/cgsMxUkyh0xjxBpkTG6otz0PfF/PfAWTX3ts6Tg=; b=Q7qppXX+K4BDoNDu35aeuTR6P8Rj/J7UYoed1dpt2E3vCmQ7X6rFpow7bZhbTP8VEL p0jCLLM9jsv97PfTDTYWp5XxmcqIHTdJo9F+NCwXsV+/6Apm4a13jaR7OBHsn9+Dwllv TZlUWhTEsXeYd77b0CVwGIOgzsouIQ5gnPe4a7Twq+Reffo+pRweIADV2gIQZgzT5kN9 Mw5QrpjloHMuPysFGU8RYlfzjI7WayT7RHc/GWnr3ff10XoaDJUZ2PKedeYWAhZF8Ftm UTVM7RJEIrN7+6WISkfBv5xyIdovnOMj1uHouaiTUyyIgcSTHM94UagrPwNYpgfWFPPh lT6A== X-Gm-Message-State: ALoCoQnH8ynNgE+hbQo4J/M4pRojdON9Vw8dZgwEcs+huOj2bjqpsgsphDuU7VnfYwWWVQF+wo6A X-Received: by 10.182.44.167 with SMTP id f7mr29721365obm.3.1388071022249; Thu, 26 Dec 2013 07:17:02 -0800 (PST) MIME-Version: 1.0 In-Reply-To: References: From: Vincent Davis Date: Thu, 26 Dec 2013 08:16:42 -0700 Subject: Re: Getting updates and restarting a long running url request. To: "python-list@python.org" Content-Type: multipart/alternative; boundary=001a11c1d7e0345c5804ee71787f X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 115 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1388074668 news.xs4all.nl 2859 [2001:888:2000:d::a6]:56805 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:62743 --001a11c1d7e0345c5804ee71787f Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable On Wed, Dec 25, 2013 at 11:24 PM, Jason Friedman wrote= : > Could you keep track of success? > > result_dict =3D dict() > for id in taxid_list: > result_dict[id] =3D 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 =3D get_BLAST(id) > result_dict[id] =3D True > except: > print("A warning.") > Thanks for your response.=E2=80=8B Would this not keep requesting/submitting additional (duplicate) BLAST queries? > try: > this_result =3D get_BLAST(id) > result_dict[id] =3D True =E2=80=8BIt seems like I need to use threading, and there appears to be no = way to know if NCBIWWW.qblast is still waiting on results. It will either give a result or possibly produce and error I suppose if the for example I lost the connection to the internet but I am not really sure about that. That said after some more research I found this tread. http://lists.open-bio.org/pipermail/biopython/2013-April/008507.html Vincent Davis --001a11c1d7e0345c5804ee71787f Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

= On Wed, Dec 25, 2013 at 11:24 PM, Jason Friedman <jsf80238@gmail.com&= gt; wrote:
Could you keep track of suc= cess?

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

Thanks for your response.=E2=80=8B
Would this not keep requesting/submitting additional (duplicate)= BLAST queries?
=C2=A0try:
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 this_result =3D get= _BLAST(id)
=C2=A0 =C2=A0 =C2=A0= =C2=A0 =C2=A0 =C2=A0 result_dict[id] =3D True
=C2=A0
=E2=80=8BIt seems like I need to use threading, and there=C2=A0appears=C2= =A0to be no way to know if=C2=A0NCBIWWW.qblast is still waiting on results. It will either g= ive a result or possibly produce and error I suppose if the for example I l= ost the connection to the=C2=A0internet=C2=A0but I am not really sure about= that.

That said after some more research I found = this tread.



Vincent Davis
--001a11c1d7e0345c5804ee71787f--