comparison get_sequences.py @ 5:675fd774314e draft

"planemo upload for repository https://github.com/TGAC/earlham-galaxytools/tree/master/tools/Ensembl-REST commit ed32f2e6d8174873cefcbe141084f857f84b0586"
author earlhaminst
date Thu, 31 Oct 2019 07:49:30 -0400
parents 950d9d11b6fb
children 0618e3bd5138
comparison
equal deleted inserted replaced
4:0602dcf02768 5:675fd774314e
10 from six.moves.urllib.parse import urljoin 10 from six.moves.urllib.parse import urljoin
11 11
12 parser = optparse.OptionParser() 12 parser = optparse.OptionParser()
13 parser.add_option('-i', '--input', help='List of Ensembl IDs') 13 parser.add_option('-i', '--input', help='List of Ensembl IDs')
14 14
15 parser.add_option('-s', '--species', type='choice',
16 choices=['ensembl', 'ensemblgenomes'], default='ensembl',
17 help='Specify the genome databases for vertebrates and other eukaryotic species')
18
19 parser.add_option('-t', '--type', type='choice', 15 parser.add_option('-t', '--type', type='choice',
20 choices=['genomic', 'cds', 'cdna', 'protein'], 16 choices=['genomic', 'cds', 'cdna', 'protein'],
21 default='genomic', help='Type of sequence') 17 default='genomic', help='Type of sequence')
22 parser.add_option('--expand_3prime', type='int', default=0, 18 parser.add_option('--expand_3prime', type='int', default=0,
23 help='Expand the sequence downstream of the sequence by this many basepairs. Only available when using genomic sequence type') 19 help='Expand the sequence downstream of the sequence by this many basepairs. Only available when using genomic sequence type')
25 help='Expand the sequence upstream of the sequence by this many basepairs. Only available when using genomic sequence type') 21 help='Expand the sequence upstream of the sequence by this many basepairs. Only available when using genomic sequence type')
26 options, args = parser.parse_args() 22 options, args = parser.parse_args()
27 if options.input is None: 23 if options.input is None:
28 raise Exception('-i option must be specified') 24 raise Exception('-i option must be specified')
29 25
30 server = 'http://rest.%s.org' % options.species 26 server = 'http://rest.ensembl.org'
31 ext = 'sequence/id' 27 ext = 'sequence/id'
32 28
33 headers = {'Content-Type': 'text/x-fasta', 'Accept': 'text/x-fasta'} 29 headers = {'Content-Type': 'text/x-fasta', 'Accept': 'text/x-fasta'}
34 params = dict((k, getattr(options, k)) for k in ['type', 'expand_3prime', 'expand_5prime']) 30 params = dict((k, getattr(options, k)) for k in ['type', 'expand_3prime', 'expand_5prime'])
35 with open(options.input) as f: 31 with open(options.input) as f: