[BioPython] Non blocking blast.

Andrew Dalke dalke at dalkescientific.com
Tue Apr 6 01:00:49 EDT 2004


pieter at kotnet.org:
> Is there a way to use biopython to submit let say 100 jobs to blast.
> Without waiting for them, storing the request ids. And than afterwards
> reading the ids and checking which results are available?

NCBI won't like it if you do 100 BLASTs at once, but let's suppose
it's a hypothetical.

Biopython's BLAST looks like a function call.  That it, it hides
that it's doing network I/O.  The standard way to parallalize it
is to use threads, and for this the standard idiom is boss/worker.
One thread creates two Queue.Queue instances, one for job
requests and the other for job results.  It then starts up N
other threads, each of which know about the Queues.  The boss
thread submits the jobs (as a simple data structure) to the
queue.  Each worker thread does a get on the queue to get the
next job and does the Biopython BLAST request.  When done, the
worker thread returns the information in the results Queue.
While waiting the boss thread can do whatever else is needed.

Aahz wrote some documentation about this idiom ... probably
   http://starship.python.net/crew/aahz/OSCON2001/

					Andrew
					dalke at dalkescientific.com



More information about the BioPython mailing list