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

Some cleanup in SOAP tools.

parent c70bc59e
No related branches found
No related tags found
No related merge requests found
Showing
with 182 additions and 128 deletions
#!/usr/bin/env python
"""
Command-line interface to the nomenclature checker.
......
#!/usr/bin/env python
"""
Daemon for processing scheduled batch jobs.
......
#!/usr/bin/env python
"""
Synchronize the database cache with other Mutalyzer instances.
......
#!/usr/bin/env python
"""
Update the database with mapping information from the NCBI.
......
#!/usr/bin/env python
"""
WSGI interface to the Mutalyzer SOAP webservice.
......
#!/usr/bin/env python
"""
WSGI interface to the Mutalyzer website.
......
#!/usr/bin/env python
"""
Add a column and index 'created' to the 'GBInfo' table.
......
#!/usr/bin/env python
"""
Convert the old 'map' tables to the new 'Mapping' tables.
......
#!/usr/bin/env python
"""
Get cache entries from a Mutalyzer installation.
Usage:
{command} days
days: Retrieve entries of at most this number of days old.
The cache entries are retrieved from the Mutalyzer SOAP webservice and printed
to standard output.
"""
from mutalyzer.util import monkey_patch_suds; monkey_patch_suds()
import sys
from datetime import datetime, timedelta
from suds.client import Client
from mutalyzer.util import format_usage
WSDL_LOCATION = 'http://localhost/mutalyzer/services/?wsdl'
def main(days):
"""
Get cache entries and print them to standard output.
"""
created_since = datetime.today() - timedelta(days=days)
service = Client(WSDL_LOCATION, cache=None).service
result = service.getCache(created_since)
if result:
for entry in result.CacheEntry:
print 'Entry %s created at %s' % (entry.name, entry.created)
if __name__ == '__main__':
if len(sys.argv) != 2:
print format_usage()
sys.exit(1)
try:
main(int(sys.argv[1]))
except ValueError:
print 'First argument must be an integer'
sys.exit(1)
#!/usr/bin/env python
from mutalyzer.util import monkey_patch_suds; monkey_patch_suds()
import sys
from datetime import datetime, timedelta
from suds.client import Client
URL = 'http://localhost/mutalyzer/services/?wsdl'
c = Client(URL, cache=None)
o = c.service
days = 1
if len(sys.argv) > 1:
days = int(sys.argv[1])
created_since = datetime.today() - timedelta(days=days)
print 'Getting cache...'
cache = o.getCache(created_since)
if cache:
for r in cache.CacheEntry:
print r.name
if 'gi' in r:
print 'GI: %s' % r.gi
print 'Hash: %s' % r.hash
if 'chromosomeName' in r:
print r.chromosomeName
if 'chromosomeStart' in r:
print r.chromosomeStart
if 'chromosomeStop' in r:
print r.chromosomeStop
if 'chromosomeOrientation' in r:
print r.chromosomeOrientation
if 'url' in r:
print r.url
print 'Created: %s' % r.created
if 'cached' in r:
print 'Cached as %s' % r.cached
print
#!/usr/bin/env python
"""
Get HGVS descriptions for a dbSNP rs number.
Usage:
{command} rs_number
rs_number: A valid dbSNP rs number, e.g. 'rs9919552'.
The HGVS descriptions are 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(rs_number):
"""
Get HGVS descriptions and print them to standard output.
"""
service = Client(WSDL_LOCATION, cache=None).service
result = service.getdbSNPDescriptions(rs_number)
if result:
for description in result.string:
print description
if __name__ == '__main__':
if len(sys.argv) != 2:
print format_usage()
sys.exit(1)
main(sys.argv[1])
#!/usr/bin/env python
from mutalyzer.util import monkey_patch_suds; monkey_patch_suds()
import sys
from suds.client import Client
URL = 'http://localhost/mutalyzer/services/?wsdl'
if len(sys.argv) < 2:
print 'Please provide a dbSNP rs number'
sys.exit(1)
c = Client(URL, cache=None)
o = c.service
# Example: rs9919552
print 'Getting HGVS descriptions for ' + sys.argv[1] + ' ...'
r = o.getdbSNPDescriptions(sys.argv[1])
if r:
for description in r.string:
print description
#!/usr/bin/env python
"""
Convert a variant description from c. to g. notation or vice versa.
Usage:
{command} build description
build: Human genome reference build to use, i.e. 'hg18' or 'hg19'.
description: Variant description to convert.
The converted HGVS description(s) is (are) 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(build, description):
"""
Convert variant description from c. to g. notation or vice versa.
"""
service = Client(WSDL_LOCATION, cache=None).service
result = service.numberConversion(build, description)
if result:
for description in result.string:
print description
else:
print 'No descriptions returned.'
if __name__ == '__main__':
if len(sys.argv) != 3:
print format_usage()
sys.exit(1)
main(*sys.argv[1:])
#!/usr/bin/env python
# Usage:
# ./positionconvert.py hg18 'NC_000011.9:g.111959695G>T'
from mutalyzer.util import monkey_patch_suds; monkey_patch_suds()
import sys
from suds.client import Client # https://fedorahosted.org/suds/
URL = 'http://localhost/mutalyzer/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
"""
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
is created with the Mutalyzer SOAP webservice. The resulting UD number is
printed to standard output.
"""
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])
#!/usr/bin/env python
from mutalyzer.util import monkey_patch_suds; monkey_patch_suds()
import sys
from suds.client import Client
from suds import WebFault
URL = 'http://localhost/mutalyzer/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
"""HGVS variant nomenclature checker."""
"""
HGVS variant nomenclature checker.
"""
import os
......
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