comparison uniprot.py @ 5:f7ebd1b4783b draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/uniprot_rest_interface commit f4fd11072886b30675afb8f8bb459eba9c4671bb
author bgruening
date Sat, 15 Sep 2018 10:23:35 -0400
parents 144e9558d3fd
children bfdc6a7ffd3a
comparison
equal deleted inserted replaced
4:144e9558d3fd 5:f7ebd1b4783b
17 17
18 18
19 def _retrieve(query, format='txt'): 19 def _retrieve(query, format='txt'):
20 """_retrieve is not meant for use with the python interface, use `retrieve` 20 """_retrieve is not meant for use with the python interface, use `retrieve`
21 instead""" 21 instead"""
22 tool = 'batch/' 22 tool = 'uploadlists/'
23 23
24 query = list(set(query.split('\n'))) 24 query = list(set(query.split('\n')))
25 queries = [query[i:i+100] for i in range(0, len(query), 100)] 25 queries = [query[i:i+100] for i in range(0, len(query), 100)]
26 26
27 data = {'format': format} 27 data = {
28 'format': format,
29 'from': 'ACC+ID',
30 'to': 'ACC'
31 }
28 32
29 responses = [requests.post(url + tool, data=data, files={'file': ' '.join(_)}) for _ in queries] 33 responses = [requests.post(url + tool, data=data, files={'file': ' '.join(_)}) for _ in queries]
30 page = ''.join(response.text for response in responses) 34 page = ''.join(response.text for response in responses)
31 return page 35 return page
32 36
33 37
34 def _map(query, f, t, format='tab'): 38 def _map(query, f, t, format='tab'):
35 """ _map is not meant for use with the python interface, use `map` instead 39 """ _map is not meant for use with the python interface, use `map` instead
36 """ 40 """
37 tool = 'mapping/' 41 tool = 'uploadlists/'
38 42
39 data = { 43 data = {
40 'from': f, 44 'from': f,
41 'to': t, 45 'to': t,
42 'format': format, 46 'format': format,