[BioPython] Pise client
Catherine Letondal
letondal@pasteur.fr
Mon, 26 Aug 2002 20:28:58 +0200
Hi,
I have written a Python package to run jobs on a Pise Web server from a python
program (Pise is a tool to generate user interfaces for programs running under Unix
described here: http://www-alt.pasteur.fr/~letondal/Pise).
For example, the following script run a toppred job on a SeqRecord instance, displays
the standard output of this job, and save the graphical output in a file. Sequences
or alignments can be input either as Seq, SeqRecord, files or just strings.
from Pise import PiseFactory
import Bio.Fasta
import sys
factory = PiseFactory(email='user@domain')
program = factory.program("toppred",
graph_output=1,
profile_format="ps")
handle = open(sys.argv[1])
it = Bio.Fasta.Iterator(handle, Bio.Fasta.SequenceParser())
seq = it.next()
job = program.run(query=seq)
if job.error():
print job.error_message()
else:
print "url of the job: " + job.jobid()
print job.stdout()
print "Results: ", job.get_results()
job.save('.ps')
The package is available at: http://www-alt.pasteur.fr/~letondal/Pise/#pisepython
The package is organized in 4 main classes (the package is organized about the same
way as in the bioperl API in fact):
PiseFactory
-----------
builds PiseApplication
instances
program()
|
|
v
PiseApplication PiseJob PiseJobParser
--------------- ------- -------------
object --> actual job (an xml.sax.handler) to parse
to set (methods to XHTML server output
parameters actually submit
and launch the http request
jobs via httplib,
get job state
| and results)
|
+----------------------------------------------+
| toppred fasta hmmbuild nnssp blast2 clustalw |
| genscan tacg dnapars wublast2 ... |
| |
+----------------------------------------------+
I'm aware about the Bio.Application framework, but I have understood it's more for local
run. For instance, AbstractCommandline would have been useful on a server, but
there is no such thing in the client, which does not deal with command lines.
It should be possible to wrap PiseApplication classes in Bio.Application classes though
(and ApplicationResult sub-class could re-use PiseJob methods for instance).
I have tried to put the minimum information in the numerous files that belongs to this
package (there is a small file for each program, and there are about 287 programs).
I would be very happy to get some feedback about this code!
--
Catherine Letondal -- Pasteur Institute Computing Center