#!/usr/bin/env python

# Example SOAP client for the VariO web service in Python using the
# suds library.
#
#
# Usage:
#   python VariO-client-suds.py 'NM_002001.2:c.1del'
#
# This code is in the public domain; it can be used for whatever purpose
# with absolutely no restrictions.

import sys
from suds.client import Client

URL = 'http://variationontology.org/VariOService/?wsdl'
if len(sys.argv) < 2:
    print 'Please provide a variant'
    sys.exit(1)

c = Client(URL, cache=None)
o = c.service

r = o.findTerms(sys.argv[1])

if r and not r[0][0].startswith("No terms matching your variant description"):
    print "For variant description %s the following annotation is suggested" % r[0][0]
    for i in range(1, len(r[0])) :
        print r[0][i]
    # for
else:
    print r[0][0]
# if else
