#!/usr/bin/python # Description: Use eFetch to retrieve a protein sequence given its id and predict if it's a signalling peptide # Author: Francisco Roque # Email: chico@cbs.dtu.dk # Version: SignalP 3.1 # Date: 2008-01-23 # test with sequence Q9BS26 import sys, time from SOAPpy import WSDL # Define wsdl locations SignalPWSDL = 'http://www.cbs.dtu.dk/ws/SignalP/SignalP_3_1.wsdl' header = "" seq = "" #expect one fasta sequence from stdin for line in sys.stdin: if line == "": break if line.startswith(">"): header = line.rstrip("\n").split(">")[1] pass else: seq = seq + line.rstrip("\n") # Define Signalp input data SignalPIn = {'organism' : 'euk', 'sequences' : { 'entry' : { 'ident' : header, 'seq' : seq } }} # Establish the endpoint for the SignalP wsdl SignalPProxy = WSDL.Proxy(SignalPWSDL) # The service will return a jobid (Asynchronous service) jobid = SignalPProxy.runService(SignalPIn) print 'SignalP service launched with jobid: %s' % jobid.jobid # The pollQueue service needs to be run to get the job status job = SignalPProxy.pollQueue(jobid) # do not continue until the job is finished while job.status != 'FINISHED': job = SignalPProxy.pollQueue(jobid) print 'The job is %s' % job.status time.sleep(5) print 'The job is FINISHED, fetching results.' # Getting the output of the server SignalPOut = SignalPProxy.fetchResult(jobid) # loop over the output and print if predicted as a signalling peptide for record in SignalPOut.prediction.gff_record: if record.comment == 'Y': print "%s is a signaling peptide" % header