Skip to content
Snippets Groups Projects
Commit 2595121b authored by Vermaat's avatar Vermaat
Browse files

Added SOAP example clients.

parent 528bd312
No related branches found
No related tags found
No related merge requests found
......@@ -21,6 +21,8 @@ The web and SOAP interfaces depend on the following packages:
- apache2 >= 2.2.11
- libapache2-mod-wsgi >= 2.8
Copy ./examples/config to /etc/mutalyzer/config and edit to your needs.
Add Apache configuration for Mutalyzer. For example, add the following to
the file /etc/apache2/sites-available/mutalyzer (change the path
/var/www/mutalyzer2 when appropriate) and run 'a2ensite mutalyzer'.
......
......@@ -20,6 +20,7 @@ Coding style guide:
Todo:
* https://www.mutalyzer.nl/projects/mutalyzer2/changeset?old_path=%2Ftrunk&old=228&new_path=%2Fbranches%2Fexon-deletions-branch&new=228#file5
* Accept a --config command line argument for a configuration file location.
* Document integration, deployment, release management, etc.
* Use standard logging module, with rotating functionality. Race conditions
......@@ -36,6 +37,9 @@ Todo:
Non-trivial thing here would be the requirement of database contents.
* Make the batch checker a real system service, using /var/run and a Upstart
init script.
http://wiki.debian.org/LSBInitScripts
http://celeryproject.org/docs/cookbook/daemonizing.html
http://www.debian-administration.org/articles/28
* Migrate Javascript to JQuery.
* I think in the long run, the Output object is not really the way to go. It
obscures the control flow. The logging part should use the standard logging
......@@ -44,6 +48,7 @@ Todo:
* Migrate from TAL to a more mondern and maintained Python template library.
* Develop a large test suite.
* Create a web interface url to watch the progress of a batch job.
* Use virtualenv?
Notes for server setup (Europium VM copy):
......
File moved
#!/usr/bin/env python
import sys
from suds.client import Client
URL = 'http://www.mutalyzer.nl/2.0/services/?wsdl'
if len(sys.argv) < 3:
print 'Please provide a genomic reference and a transcript reference'
sys.exit(1)
c = Client(URL, cache=None)
o = c.service
print 'Getting gene and transcript ' + sys.argv[1] + ' / ' + sys.argv[2] + ' ...'
r = o.getGeneAndTranscript(sys.argv[1], sys.argv[2])
print r
#!/usr/bin/env python
import sys
from suds.client import Client
URL = 'http://www.mutalyzer.nl/2.0/services/?wsdl'
if len(sys.argv) < 2:
print 'Please provide a transcript'
sys.exit(1)
c = Client(URL, cache=None)
o = c.service
print 'Getting transcript info ' + sys.argv[1] + ' ...'
r = o.transcriptInfo(LOVD_ver="123", build="hg19", accNo=sys.argv[1])
print 'CDS stop: %s' % r.CDS_stop
print 'Trans start: %s' % r.trans_start
print 'Trans stop: %s' % r.trans_stop
#!/usr/bin/env python
import sys
from suds.client import Client
URL = 'http://www.mutalyzer.nl/2.0/services/?wsdl'
if len(sys.argv) < 2:
print 'Please provide a genomic reference'
sys.exit(1)
c = Client(URL, cache=None)
o = c.service
# Example: AL449423.14
print 'Getting transcript and info ' + sys.argv[1] + ' ...'
gene = None
if len(sys.argv) > 2:
print 'Restricting transcripts to ' + sys.argv[2]
gene = sys.argv[2]
r = o.getTranscriptsAndInfo(sys.argv[1], gene)
if r:
for t in r.TranscriptInfo:
print '%s' % t.name
print
print 'ID: %s' % t.id
print 'Product: %s' % t.product
print 'Locus tag: %s' % t.locusTag
print 'Link method: %s' % t.linkMethod
print
print 'Translation start: %s (c), %s (g)' % (t.cTransStart, t.gTransStart)
print 'Translation end: %s (c), %s (g)' % (t.cTransEnd, t.gTransEnd)
print 'Sortable end: %s' % t.sortableTransEnd
print
print 'Coding start: %s (c), %s (g)' % (t.cCDSStart, t.gCDSStart)
print 'Coding stop: %s (c), %s (g)' % (t.cCDSStop, t.gCDSStop)
print
if t.proteinTranscript:
print 'Protein name: %s' % t.proteinTranscript.name
print 'Protein ID: %s' % t.proteinTranscript.id
print 'Protein product: %s' % t.proteinTranscript.product
else:
print 'No protein transcript'
print
if t.exons:
for e in t.exons.ExonInfo:
print 'Exon: %s - %s (c), %s - %s (g)' % (e.cStart, e.cStop, e.gStart, e.gStop)
else:
print 'Huh, no exons?!'
print
print
#!/usr/bin/env python
import sys
from suds.client import Client
URL = 'http://www.mutalyzer.nl/2.0/services/?wsdl'
if len(sys.argv) < 2:
print 'Please provide a gene name'
sys.exit(1)
c = Client(URL, cache=None)
o = c.service
print 'Getting transcripts ' + sys.argv[1] + ' ...'
r = o.getTranscriptsByGeneName('hg19', sys.argv[1])
if r:
for t in r.string:
print t
#!/usr/bin/env python
# Given a variant in HGVS notation, print raw variants with ASCII-art
# visualisation and alternative descriptions. If VERBOSE is True, also print
# original and mutated sequences.
#
# See http://www.mutalyzer.nl/2.0/webservices
#
# Usage:
# python namecheck.py 'AB026906.1:c.274delG'
#
# 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 # https://fedorahosted.org/suds/
VERBOSE = True
URL = 'http://www.mutalyzer.nl/2.0/services/?wsdl'
if len(sys.argv) < 2:
print 'Please provide a variant'
sys.exit(1)
c = Client(URL)
o = c.service
print 'Running name checker for variant ' + sys.argv[1] + ' ...\n'
r = o.runMutalyzer(sys.argv[1])
if r.rawVariants:
for v in r.rawVariants.RawVariant:
print 'Raw variant: %s' % v.description
print '%s\n' % v.visualisation
if VERBOSE:
print 'Original:\n%s\n' % r.original
print 'Mutated:\n%s\n' % r.mutated
print 'origMRNA:\n%s\n' % r.origMRNA
print 'mutatedMRNA:\n%s\n' % r.mutatedMRNA
print 'origCDS:\n%s\n' % r.origCDS
print 'newCDS:\n%s\n' % r.newCDS
print 'origProtein:\n%s\n' % r.origProtein
print 'newProtein:\n%s\n' % r.newProtein
print 'altProtein:\n%s\n' % r.altProtein
print 'Errors: %s' % r.errors
print 'Warnings: %s' % r.warnings
print 'Summary: %s\n' % r.summary
if r.messages:
for m in r.messages.SoapMessage:
print 'Error %s: %s\n' % (m.errorcode, m.message)
print 'Chromosomal description: %s' % r.chromDescription
print 'Genomic description: %s' % r.genomicDescription
if r.transcriptDescriptions:
print 'Affected transcripts:'
print '\n'.join(r.transcriptDescriptions.string)
if r.proteinDescriptions:
print 'Affected proteins:'
print '\n'.join(r.proteinDescriptions.string)
#!/usr/bin/env python
# Usage:
# ./positionconvert.py hg18 'NC_000011.9:g.111959695G>T'
import sys
from suds.client import Client # https://fedorahosted.org/suds/
URL = 'http://www.mutalyzer.nl/2.0/services/?wsdl'
if len(sys.argv) < 3:
print 'Please provide a human genome build and a variant'
sys.exit(1)
c = Client(URL)
o = c.service
print 'Running position converter for variant ' + sys.argv[1] + ' ...\n'
r = o.numberConversion(sys.argv[1], sys.argv[2])
if r:
for v in r.string:
print v
else:
print 'No variants returned.'
#!/usr/bin/env python
import sys
from suds.client import Client
from suds import WebFault
URL = 'http://www.mutalyzer.nl/2.0/services/?wsdl'
if len(sys.argv) < 2:
print 'Please provide a gene symbol'
sys.exit(1)
c = Client(URL, cache=None)
o = c.service
print 'Slicing chromosome for gene ' + sys.argv[1] + ' (Human, 5000 upstream, 2000 downstream) ...'
try:
r = o.sliceChromosomeByGene(sys.argv[1], 'Human', 5000, 2000)
print r
except WebFault as message:
print message
#!/usr/bin/env python
# Example SOAP client for the Mutalyzer webservice in Python using the
# SOAPpy library.
#
# See http://www.mutalyzer.nl/2.0/webservices
#
# Usage:
# python sp.py
#
# This code is in the public domain; it can be used for whatever purpose
# with absolutely no restrictions.
import sys
from SOAPpy import WSDL
o = WSDL.Proxy("http://www.mutalyzer.nl/2.0/service.wsdl")
# Get all transcripts that are hit when we look at position 159272155 on
# chromosome 1.
print "hg19", "chr1", 159272155
r = o.getTranscripts(build="hg19", chrom="chr1", pos=159272155)
if r:
# This seems to be a bug in SOAPpy. Arrays of length 1 are
# flattened, so we cannot iterate over them.
if not isinstance(r.string, list):
r.string = [r.string]
for i in r.string:
print i, o.getGeneName(build="hg19", accno=i)
# Get all transcripts and genes that have (part of) a transcript in the range
# 159272155-159372155 on chromosome 1.
print "\n", "hg19", "chr1", 159272155, 159372155, 1
r = o.getTranscriptsRange(build="hg19", chrom="chr1", pos1=159272155,
pos2=159372155, method=1)
if r:
# This seems to be a bug in SOAPpy. Arrays of length 1 are
# flattened, so we cannot iterate over them.
if not isinstance(r.string, list):
r.string = [r.string]
for i in r.string:
print i, o.getGeneName(build="hg19", accno=i)
# Get all transcripts and genes that have the entire transcript in the range
# 159272155-159372155 on chromosome 1.
print "\n", "hg19", "chr1", 159272155, 159372155, 0
r = o.getTranscriptsRange(build="hg19", chrom="chr1", pos1=159272155,
pos2=159372155, method=0)
if r:
# This seems to be a bug in SOAPpy. Arrays of length 1 are
# flattened, so we cannot iterate over them.
if not isinstance(r.string, list):
r.string = [r.string]
for i in r.string:
print i, o.getGeneName(build="hg19", accno=i)
print "\n", "hg19", "NM_002001.2", "c.2del"
r = o.mappingInfo(LOVD_ver="123", build="hg19", accNo="NM_002001.2",
variant="c.1del")
print r.mutationType
print r.start_g
print r.end_g
print "\n", "hg19", "NM_002002.2"
r = o.transcriptInfo(LOVD_ver="123", build="hg19", accNo="NM_002001.2")
print r.CDS_stop
print r.trans_start
print r.trans_stop
print "\n", "hg19", "NM_002001.2:c.1del"
r = o.numberConversion(build="hg19", variant="NM_002001.2:c.1del")
if r:
# This seems to be a bug in SOAPpy. Arrays of length 1 are
# flattened, so we cannot iterate over them.
if not isinstance(r.string, list):
r.string = [r.string]
for i in r.string:
print i
print "\n", "hg19", "DMD"
r = o.getTranscriptsByGeneName(build="hg19", name="DMD")
if r:
# This seems to be a bug in SOAPpy. Arrays of length 1 are
# flattened, so we cannot iterate over them.
if not isinstance(r.string, list):
r.string = [r.string]
for i in r.string:
print i
print "\n", "NM_002001.2:g.1del"
r = o.runMutalyzer(variant="NM_002001.2:g.1del")
print r.original
print r.mutated
print r.origMRNA
print r.mutatedMRNA
print r.origCDS
print r.newCDS
print r.origProtein
print r.newProtein
print r.altProtein
print r.errors
print r.warnings
print r.summary
......@@ -365,6 +365,8 @@ class Mutator() :
@type sites: list of int
@todo: Resulting list of ignored sites should always be even.
@todo: Don't remove CDS start/stop, as happens e.g. with
AL449423.14(CDKN2A_v002):c.5_400del.
"""
for site in sites:
self.__removed_sites.add(site)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment