From 690bf53d592d9d722b459228902dc4f42783b27f Mon Sep 17 00:00:00 2001 From: Martijn Vermaat <martijn@vermaat.name> Date: Mon, 20 Aug 2012 12:48:29 +0000 Subject: [PATCH] Fix descriptionExtract RPC method (for r595) git-svn-id: https://humgenprojects.lumc.nl/svn/mutalyzer/trunk@600 eb6bd6ab-9ccd-42b9-aceb-e2899b4a52f1 --- extras/soap-tools/descriptionExtract.py | 46 +++++++++++++++++++++++++ mutalyzer/services/rpc.py | 6 ++-- 2 files changed, 50 insertions(+), 2 deletions(-) create mode 100755 extras/soap-tools/descriptionExtract.py diff --git a/extras/soap-tools/descriptionExtract.py b/extras/soap-tools/descriptionExtract.py new file mode 100755 index 00000000..d1ff2b90 --- /dev/null +++ b/extras/soap-tools/descriptionExtract.py @@ -0,0 +1,46 @@ +#!/usr/bin/env python +""" +Extract the HGVS variant description from a reference sequence and an observed +sequence. + +Usage: + {command} reference observed + + reference: Reference DNA sequence. + observed: Observed DNA sequence. + +The extracted HGVS description is retrieved from the Mutalyzer SOAP webservice +and printed to standard output. +""" + + +from mutalyzer.util import monkey_patch_suds; monkey_patch_suds() + +import sys +from suds.client import Client + +from mutalyzer.util import format_usage + + +WSDL_LOCATION = 'http://localhost/mutalyzer/services/?wsdl' + + +def main(reference, observed): + """ + Extract the HGVS variant description from a reference sequence and an + observed sequence. + """ + service = Client(WSDL_LOCATION, cache=None).service + result = service.descriptionExtract(reference, observed) + + if result: + print result.description + else: + print 'No description returned.' + + +if __name__ == '__main__': + if len(sys.argv) != 3: + print format_usage() + sys.exit(1) + main(*sys.argv[1:]) diff --git a/mutalyzer/services/rpc.py b/mutalyzer/services/rpc.py index 6551e3df..0270a194 100644 --- a/mutalyzer/services/rpc.py +++ b/mutalyzer/services/rpc.py @@ -539,7 +539,7 @@ class MutalyzerService(ServiceBase): return result #chromosomeName - @srpc(Mandatory.String, Mandatory.String, String, + @srpc(Mandatory.String, Mandatory.String, String, _returns=Array(Mandatory.String)) def numberConversion(build, variant, gene=None): """ @@ -1029,6 +1029,8 @@ class MutalyzerService(ServiceBase): """ Extract the HGVS variant description from a reference sequence and an observed sequence. + + Note that this only works on DNA sequences for now. """ output = Output(__file__) @@ -1036,7 +1038,7 @@ class MutalyzerService(ServiceBase): 'Received request descriptionExtract') result = Allele() - result.allele = describe.describeDNA(reference, observed) + result.allele = describe.describe(reference, observed) result.description = describe.alleleDescription(result.allele) output.addMessage(__file__, -1, 'INFO', -- GitLab