sliceChromosomeByGene.py 1023 Bytes
Newer Older
Vermaat's avatar
Vermaat committed
1
2
3
4
5
6
7
8
9
10
#!/usr/bin/env python
"""
Create a slice of a chromosome by gene.

Usage:
  {command} gene

  gene: Gene symbol of the gene to slice.

A slice containing the gene with 5000 upstream bases and 2000 downstream bases
11
is created with the Mutalyzer SOAP web service. The resulting UD number is
Vermaat's avatar
Vermaat committed
12
13
14
15
printed to standard output.
"""


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

Vermaat's avatar
Vermaat committed
18
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
from mutalyzer.util import monkey_patch_suds; monkey_patch_suds()

import sys
from suds.client import Client
from suds import WebFault

from mutalyzer.util import format_usage


WSDL_LOCATION = 'http://localhost/mutalyzer/services/?wsdl'


def main(gene):
    """
    Slice chromosome by gene and print UD number to standard output.
    """
    service = Client(WSDL_LOCATION, cache=None).service

    try:
        print service.sliceChromosomeByGene(gene, 'Human', 5000, 2000)
    except WebFault as message:
        print message


if __name__ == '__main__':
    if len(sys.argv) != 2:
        print format_usage()
        sys.exit(1)
    main(sys.argv[1])