descriptionExtract.py 1.07 KB
Newer Older
1
2
3
4
5
6
7
8
9
10
11
#!/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.

12
13
The extracted HGVS description is retrieved from the Mutalyzer SOAP web
service and printed to standard output.
14
15
16
"""


Vermaat's avatar
Vermaat committed
17
18
from __future__ import unicode_literals

19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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:])