#!/usr/bin/python # Description: Client script in Python (suds) running the RNAmmer Web Service # Author: Karunakar Bayyapu # Email: karun@cbs.dtu.dk # Version: 1.2 ws1 # Date: 2012-04-23 ### for installation and usage notes please see below ### client code starts here from suds.client import Client from suds.bindings import binding import logging logging.basicConfig(level=logging.INFO) logging.getLogger('suds.client').setLevel(logging.DEBUG) wsdl = 'http://www.cbs.dtu.dk/ws/RNAmmer/RNAmmer_1_2_ws1.wsdl' client = Client(wsdl,cache=None) #runService --You need to change the sequences and ids as per your requirement. #organism and method are optional as per wsdl document seq1 = client.factory.create('runService.parameters.sequencedata.sequence') seq1.id="IPI:IPI00000005.1" seq1.seq="""MTEYKLVVVGAGGVGKSALTIQLIQNHFVDEYDPTIEDSYRKQVVIDGETCLLDILDTAG QEEYSAMRDQYMRTGEGFLCVFAINNSKSFADINLYREQIKRVKDSDDVPMVLVGNKCDL PTRTVDTKQAHELAKSYGIPFIETSAKTRQGVEDAFYTLVREIRQYRMKKLNSSDDGTQG CMGLPCVVM""" seq2 = client.factory.create('runService.parameters.sequencedata.sequence') seq2.id="IPI:IPI00000013.1"; seq2.seq="""MNLSLVLAAFCLGIASAVPKFDQNLDTKWYQWKATHRRLYGANEEGWRRAVWEKNMKMIE LHNGEYSQGKHGFTMAMNAFGDMTNEEFRQMMGCFRNQKFRKGKVFREPLFLDLPKSVDW RKKGYVTPVKNQKQCGSCWAFSATGALEGQMFRKTGKLVSLSEQNLVDCSRPQGNQGCNG GFMARAFQYVKENGGLDSEESYPYVAVDEICKYRPENSVANDTGFTVVAPGKEKALMKAV ATVGPISVAMDAGHSSFQFYKSGIYFEPDCSSKNLDHGVLVVGYGFEGANSNNSKYWLVK NSWGPEWGSNGYVKIAKDKNNHCGIATAASYPNV""" request=client.factory.create('runService.parameters') request.sequencedata.sequence=[seq1,seq2] response = client.service.runService(request) #pollQueue --jobid needs to be changed as which you got from runService seq = client.factory.create('pollQueue.job') seq.jobid="5DBA18D0-3C44-11E1-BD82-8CB1A79C20B1" response = client.service.pollQueue(seq) #fetchResults --jobid needs to be changed as which you got from runService seq = client.factory.create('fetchResult.job') seq.jobid="D75E7706-7279-11E1-864F-F32F2EB4B995" response = client.service.fetchResult(seq) ### client code ends here ######################################################################################### ############################# ############################# ############################# DOCUMENTATION ############################# ############################# ############################# ######################################################################################### # Introduction: # Suds are very pythonic, and easy to create WSDL-consuming SOAP clients. The Suds web # services client is a lightweight soap-based client. # Basic features are: no class generation, provides an object-like API.,reads wsdl at # runtime for encoding/decoding and provides SOAP(style) binding/encoding. # Installation: # Required/Tested version: Python v2.6 and Suds -v 0.4 # Download and install suds on Linux with these following commands # * wget suds # * tar -zxvf python-suds-0.4.tar.gz # * cd python-suds-0.4 # * sudo python setup.py install # Implementation: # The library is now ready to use. We start by importing the suds library, creating a client # based on a WSDl url, and asking the library to do process for the SOAP web service methods # that are available to us. # Access Web sevices: # Ths RNAmmer service code access to see one method results at once. If you would like to # see runService method results then you would need to comment the rest of the methods code # and for rest also same. In the runService, you need to submit required fileds like one id # and corresponding sequence or more ids and their corresponding sequences as a input(STDIN) # data to convert FASTA format to get the results. # For input data/FASTA format see example: # http://www.cbs.dtu.dk/ws/RNAmmer/examples/example) # After getting jobid from runService then you would need to submit jobid in the pollQueue # to know the status of the job. After knowing the status of the job from pollQueue then # you need to submit jobid in the fetchResult to see complete final results. # It means you can only see final results in the fetchResult since RNAmmer is implemented # in asynchronous way # Compile: # Save above client code under name client.py and compile client with this command on Linux # (make sure that you are in same directory). # >python client.py # Results: # We can see SOAP envelope request/response through logging.DEBUG while compile the code. # The response from suds is based on debug level since we are using Python standard # lib logging package for input/output. Once the console handler is configured, enabled # module specific debugging doing the following: # logging.getLogger('suds.client').setLevel(logging.(logging.DEBUG). # It is useful when debugging a client to be able to see the actual SOAP messages exchanged.