diff toolOptBioDes.py @ 8:6572347b3e1a draft

planemo upload commit 6a252d04f4b2f79606ab6679b6a91f957e33da7b-dirty
author pablocarb
date Thu, 02 May 2019 10:21:32 -0400
parents 93eb36300900
children f9aef3df1fc8
line wrap: on
line diff
--- a/toolOptBioDes.py	Thu May 02 09:27:23 2019 -0400
+++ b/toolOptBioDes.py	Thu May 02 10:21:32 2019 -0400
@@ -16,7 +16,7 @@
 def arguments():
     parser = argparse.ArgumentParser(description='toolOptBioDes: Optimal SynBio Design. Pablo Carbonell, SYNBIOCHEM, 2019')
     parser.add_argument('infile', 
-                        help='Input xlsx file (DoE specificiations).')
+                        help='Input csv file (DoE specificiations).')
     parser.add_argument('size', 
                         help='Library size.')
     parser.add_argument('outfile', 
@@ -34,7 +34,7 @@
     
 def sheetUpload(doefile, size, outfile, diagfile, url):
     files = { 'file': open(doefile, 'rb' ) }
-    values = {'size': int(size)}
+    values = {'size': int(size), 'format': 'csv'}
     r = requests.post( os.path.join(url, 'Query' ), files=files, data=values )
     res = json.loads( r.content.decode('utf-8') )
     M = res['data']['M']
@@ -43,6 +43,10 @@
         cw.writerow( res['data']['names'] )
         for row in M:
             cw.writerow( row )
+    with open(diagfile. 'w') as h:
+        cw = csv.writer(h)
+        cw.writerow( ['Size', 'Efficiency'] )
+        cw.writerow( [res['data']['libsize'], res['data']['J']] )
     print( 'Size:', res['data']['libsize'], 'Efficiency:', res['data']['J'] )