comparison get_sequences.py @ 2:950d9d11b6fb 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:35 -0500
parents 98aba0efe77a
children 675fd774314e
comparison
equal deleted inserted replaced
1:98aba0efe77a 2:950d9d11b6fb
1 # A simple tool to connect to the Ensembl server and retrieve sequences using 1 # A simple tool to connect to the Ensembl server and retrieve sequences using
2 # the Ensembl REST API. 2 # the Ensembl REST API.
3 from __future__ import print_function
4
3 import json 5 import json
4 import optparse 6 import optparse
5 from itertools import islice 7 from itertools import islice
6 from urlparse import urljoin
7 8
8 import requests 9 import requests
10 from six.moves.urllib.parse import urljoin
9 11
10 parser = optparse.OptionParser() 12 parser = optparse.OptionParser()
11 parser.add_option('-i', '--input', help='List of Ensembl IDs') 13 parser.add_option('-i', '--input', help='List of Ensembl IDs')
12 14
13 parser.add_option('-s', '--species', type='choice', 15 parser.add_option('-s', '--species', type='choice',
41 data=json.dumps(data)) 43 data=json.dumps(data))
42 44
43 if not r.ok: 45 if not r.ok:
44 r.raise_for_status() 46 r.raise_for_status()
45 47
46 print r.text 48 print(r.text)