comparison toolOptBioDes.py @ 4:6dbb43bdf2f4 draft

planemo upload commit 6a252d04f4b2f79606ab6679b6a91f957e33da7b-dirty
author pablocarb
date Thu, 02 May 2019 07:46:26 -0400
parents f3771c0a2327
children 93eb36300900
comparison
equal deleted inserted replaced
3:f3771c0a2327 4:6dbb43bdf2f4
15 15
16 def arguments(): 16 def arguments():
17 parser = argparse.ArgumentParser(description='toolOptBioDes: Optimal SynBio Design. Pablo Carbonell, SYNBIOCHEM, 2019') 17 parser = argparse.ArgumentParser(description='toolOptBioDes: Optimal SynBio Design. Pablo Carbonell, SYNBIOCHEM, 2019')
18 parser.add_argument('infile', 18 parser.add_argument('infile',
19 help='Input xlsx file (DoE specificiations).') 19 help='Input xlsx file (DoE specificiations).')
20 parser.add_argument('size',
21 help='Library size.')
20 parser.add_argument('outfile', 22 parser.add_argument('outfile',
21 help='Output csv design file.') 23 help='Output csv design file.')
22 parser.add_argument('diagfile', 24 parser.add_argument('diagfile',
23 help='Output csv diagnostics file.') 25 help='Output csv diagnostics file.')
24 parser.add_argument('-server', default='http://doe.synbiochem.co.uk/REST', 26 parser.add_argument('-server', default='http://doe.synbiochem.co.uk/REST',
28 def testApp(url): 30 def testApp(url):
29 r = requests.get( url ) 31 r = requests.get( url )
30 res = json.loads( r.content.decode('utf-8') ) 32 res = json.loads( r.content.decode('utf-8') )
31 print( res ) 33 print( res )
32 34
33 def sheetUpload(doefile, outfile, diagfile, url): 35 def sheetUpload(doefile, size, outfile, diagfile, url):
34 files = { 'file': open(doefile, 'rb' ) } 36 files = { 'file': open(doefile, 'rb' ) }
35 values = {'size': 64} 37 values = {'size': int(size)}
36 r = requests.post( os.path.join(url, 'Query' ), files=files, data=values ) 38 r = requests.post( os.path.join(url, 'Query' ), files=files, data=values )
37 res = json.loads( r.content.decode('utf-8') ) 39 res = json.loads( r.content.decode('utf-8') )
38 M = res['data']['M'] 40 M = res['data']['M']
39 with open(outfile, 'w') as h: 41 with open(outfile, 'w') as h:
40 cw = csv.writer(h) 42 cw = csv.writer(h)