comparison get_genetree.py @ 2:840ea71e6318 draft

planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/Ensembl-REST commit 099d38157cec200f0a343579ca9babcd8acb266f
author earlhaminst
date Wed, 21 Dec 2016 15:16:22 -0500
parents 396f0f54d115
children 70e4134eb0ed
comparison
equal deleted inserted replaced
1:396f0f54d115 2:840ea71e6318
1 # A simple tool to connect to the Ensembl server and retrieve genetree using 1 # A simple tool to connect to the Ensembl server and retrieve genetree using
2 # the Ensembl REST API. 2 # the Ensembl REST API.
3 from __future__ import print_function
4
3 import optparse 5 import optparse
4 from urlparse import urljoin
5 6
6 import requests 7 import requests
8 from six.moves.urllib.parse import urljoin
7 9
8 parser = optparse.OptionParser() 10 parser = optparse.OptionParser()
9 parser.add_option('--id_type', type='choice', default='gene_id', 11 parser.add_option('--id_type', type='choice', default='gene_id',
10 choices=['gene_id', 'gene_tree_id'], help='Input type') 12 choices=['gene_id', 'gene_tree_id'], help='Input type')
11 parser.add_option('-i', '--input', help='Ensembl ID') 13 parser.add_option('-i', '--input', help='Ensembl ID')
53 r = requests.get(urljoin(server, '/'.join([ext, options.input])), params=params, headers=headers) 55 r = requests.get(urljoin(server, '/'.join([ext, options.input])), params=params, headers=headers)
54 56
55 if not r.ok: 57 if not r.ok:
56 r.raise_for_status() 58 r.raise_for_status()
57 59
58 print r.text 60 print(r.text)