You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am reporting a problem about NCBIWWW in Bio.Blast
previous=time.time()
whileTrue:
current=time.time()
wait=previous+delay-currentifwait>0:
time.sleep(wait)
previous=current+waitelse:
previous=currentifdelay+.5*delay<=120:
delay+=.5*delayelse:
delay=120request=_Request(url_base,
message,
{"User-Agent": "BiopythonClient"})
handle=_urlopen(request,context=context)
results=_as_string(handle.read())
# Can see an "\n\n" page while results are in progress,# if so just wait a bit longer...ifresults=="\n\n":
continue# XML results don't have the Status tag when finishedif"Status="notinresults:
breaki=results.index("Status=")
j=results.index("\n", i)
status=results[i+len("Status="):j].strip()
ifstatus.upper() =="READY":
break
I think 120s is too long....I change it to 20s and it can work well.
Emm,I 'm in China.When the value is 120s,I always wait for connecting success for a long time (>>120s),which I can not bear.Then I change it to 20s........Ok,work well.It could prove to connect NCBI in about one minute.
So the current code does work for you, it is just taking a very long time?
I decided to try to see if there was any specific for the NCBI documentation on this, and found as often seems to happen that the old pages I was looking for seem to have been replaced.
Usage Guidelines
The NCBI BLAST servers are a shared resource. We give priority to interactive users. In order to ensure availability of the service to the entire community, we may limit searches for some high volume users. Interactive users of the NCBI webpages through a web browser should not encounter problems. We will move searches of users who submit more than 100 searches in a 24 hour period to a slower queue, or, in extreme cases, will block the requests. To avoid problems, API users should comply with the following guidelines:
Do not contact the server more often than once every 10 seconds.
Do not poll for any single RID more often than once a minute.
Use the URL parameter email and tool, so that the NCBI can contact you if there is a problem.
Run scripts weekends or between 9 pm and 5 am Eastern time on weekdays if more than 50 searches will be submitted.
BLAST often runs more efficiently if multiple queries are sent as one search rather than if each query is sent as an individual search. This is especially true for blastn, megablast, and tblastn. If your queries are short (less than a few hundred bases) we suggest you merge them into one search of up to 1,000 bases
The NCBI servers are a shared resource and not intended for projects that involve a large number of BLAST searches. We provide Stand-alone BLAST and the RESTful API at a cloud provider for such projects.
So, in fact we are being too aggressive by starting with a 2s delay - we should wait 10s and our first re-try should be after 1 minute. In light of this, slowing down to a 2 minute delay on long running searches seems reasonable.
With the changes on #1684, the code should start with a 20s wait before requesting the results, and then try once a minute. Hopefully this works better for you.
Are you able to test the latest code from GitHub, or could you test this after we have released Biopython 1.72? Thank you!
Activity
peterjc commentedon Jun 7, 2018
Are you saying if we wait 120s (2 minutes) BLAST fails (perhaps the NCBI drops the connection)?
The current value has literally worked for years, see 950696f, but perhaps there has been a recent NCBI change.
Do you have more information? e.g. time of day (and timezone)? This might only happen during USA working hours (i.e. peak usage times)
voidxb commentedon Jun 8, 2018
Emm,I 'm in China.When the value is 120s,I always wait for connecting success for a long time (>>120s),which I can not bear.Then I change it to 20s........Ok,work well.It could prove to connect NCBI in about one minute.
peterjc commentedon Jun 12, 2018
So the current code does work for you, it is just taking a very long time?
I decided to try to see if there was any specific for the NCBI documentation on this, and found as often seems to happen that the old pages I was looking for seem to have been replaced.
However, https://blast.ncbi.nlm.nih.gov/Blast.cgi?CMD=Web&PAGE_TYPE=BlastDocs&DOC_TYPE=DeveloperInfo seems to cover it:
So, in fact we are being too aggressive by starting with a 2s delay - we should wait 10s and our first re-try should be after 1 minute. In light of this, slowing down to a 2 minute delay on long running searches seems reasonable.
[-]about NCBIWWW.qblast connection[/-][+]Review request timing for NCBIWWW.qblast[/+]peterjc commentedon Jun 14, 2018
With the changes on #1684, the code should start with a 20s wait before requesting the results, and then try once a minute. Hopefully this works better for you.
Are you able to test the latest code from GitHub, or could you test this after we have released Biopython 1.72? Thank you!
peterjc commentedon Jul 4, 2018
@voidxb We have now released Biopython 1.72 - could you retest with this? Is is any better, or are you still seeing problems? Thanks!
voidxb commentedon Jul 23, 2018
OK,I see,I will try it now