changeset 2:856bd14e6e96 draft

planemo upload commit 6a252d04f4b2f79606ab6679b6a91f957e33da7b-dirty
author pablocarb
date Thu, 02 May 2019 07:16:40 -0400
parents b0b7deebb71e
children f3771c0a2327
files README.md maketool.sh optbiodes.xml selenzyme.xml toolOptBioDes.py
diffstat 5 files changed, 114 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/README.md	Mon Apr 29 10:53:09 2019 -0400
+++ b/README.md	Thu May 02 07:16:40 2019 -0400
@@ -1,4 +1,6 @@
-# galaxy_selenzyme
+# Galaxy wrappers for SynBio Design Tools 
+
+## galaxy_selenzyme
 
 Creating a tool within Galaxy to run Selenzyme.
 
@@ -13,6 +15,9 @@
 - [x] Create a Galaxy Tool XML file.
 - [x] Check that the Galaxy container has `requests` installed, otherwise add to the `docker-compose` file.
 - [x] Mount the folder with the tool in the container.
-- [x] Install the tool in Galaxy.
+- [x] Install the tool locally in Galaxy.
+- [x] Use planemo in order to create a repository in the toolshed.
+- [x] Register in the toolshed.
+- [x] Install in the Galaxy container from the toolshed.
 - [ ] Create a tool using Galaxy XML that post JSON request and receives a JSON response (no local tool running in the Galaxy server).
-- [ ] Submit the purely XML tool to the [Galaxy Tool Shed](https://toolshed.g2.bx.psu.edu/).
\ No newline at end of file
+- [ ] Submit the purely XML tool to the [Galaxy Tool Shed](https://toolshed.g2.bx.psu.edu/).
--- a/maketool.sh	Mon Apr 29 10:53:09 2019 -0400
+++ b/maketool.sh	Thu May 02 07:16:40 2019 -0400
@@ -16,6 +16,17 @@
     --example_output 'out.csv' \
     --doi 10.1093/bioinformatics/bty065 \
     --help_from_command 'python3 toolSelenzyme.py -h'
+    
+# Generate tool backbone (additional params need to be entered manually 
+planemo tool_init --force \
+    --id 'optbiodes' \
+    --name 'OptBioDes' \
+    --description 'optimal synbio design' \
+    --requirement requests@2 \
+    --example_command 'python $__tool_directory__/toolOptBioDes.py $input1 $output1 $output2 -server $server' \
+    --example_input 'example.xlsx' \
+    --example_output 'out.csv out2.csv' \
+    --help_from_command 'python3 toolOptBioDes.py -h'
    
 # Init shed repository
 planemo shed_init . --force \
@@ -30,8 +41,18 @@
     --shed_target toolshed \
     --shed_key_from_env TOOLSHED 
 
+# Create repository in the toolshed
+planemo shed_create \
+    --shed_target testtoolshed \
+    --shed_key_from_env TESTTOOLSHED 
+
+
 # Update repository in the toolshed
 planemo shed_update \
     --check_diff --shed_target toolshed \
     --shed_key_from_env TOOLSHED
 
+# Update repository in the toolshed
+planemo shed_update \
+    --check_diff --shed_target testtoolshed \
+    --shed_key_from_env TESTTOOLSHED
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/optbiodes.xml	Thu May 02 07:16:40 2019 -0400
@@ -0,0 +1,32 @@
+<tool id="optbiodes" name="OptBioDes" version="0.1.0">
+    <description>optimal synbio design</description>
+    <requirements>
+        <requirement type="package" version="2">requests</requirement>
+    </requirements>
+    <command detect_errors="exit_code"><![CDATA[
+        python $__tool_directory__/toolOptBioDes.py $input1 $output1 $output2 -server $server
+    ]]></command>
+    <inputs>
+        <param type="data" name="input1" format="xlsx" />
+    	<param name="server" type="text" label="OptBioDes RES server" value="http://doe.synbiochem.co.uk/REST" help="OptBioDes REST server" />
+    </inputs>
+    <outputs>
+        <data name="output1" format="csv" from_work_dir="out1.csv" />
+        <data name="output2" format="csv" from_work_dir="out2.csv" />
+    </outputs>
+    <help><![CDATA[
+        usage: toolOptBioDes.py [-h] [-server SERVER] infile outfile diagfile
+
+toolOptBioDes: Optimal SynBio Design. Pablo Carbonell, SYNBIOCHEM, 2019
+
+positional arguments:
+  infile          Input xlsx file (DoE specificiations).
+  outfile         Output csv design file.
+  diagfile        Output csv diagnostics file.
+
+optional arguments:
+  -h, --help      show this help message and exit
+  -server SERVER  OptBioDes server.
+
+    ]]></help>
+</tool>
\ No newline at end of file
--- a/selenzyme.xml	Mon Apr 29 10:53:09 2019 -0400
+++ b/selenzyme.xml	Thu May 02 07:16:40 2019 -0400
@@ -8,7 +8,7 @@
     ]]></command>
     <inputs>
         <param type="data" name="input1" format="csv" />
-	<param name="server" type="text" label="Selenzyme RES server" value="http://selenzyme.synbiochem.co.uk/REST" help="Selenzyme REST server" />
+    	<param name="server" type="text" label="Selenzyme RES server" value="http://selenzyme.synbiochem.co.uk/REST" help="Selenzyme REST server" />
     </inputs>
     <outputs>
         <data name="output1" format="csv" from_work_dir="out.csv" />
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toolOptBioDes.py	Thu May 02 07:16:40 2019 -0400
@@ -0,0 +1,52 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+"""
+Created on Mar 19
+
+@author: Pablo Carbonell
+@description: Query OptBioDes: optimal synbio design.
+
+"""
+import requests
+import argparse
+import csv
+import os
+import json
+
+def arguments():
+    parser = argparse.ArgumentParser(description='toolOptBioDes: Optimal SynBio Design. Pablo Carbonell, SYNBIOCHEM, 2019')
+    parser.add_argument('infile', 
+                        help='Input xlsx file (DoE specificiations).')
+    parser.add_argument('outfile', 
+                        help='Output csv design file.')
+    parser.add_argument('diagfile', 
+                        help='Output csv diagnostics file.')
+    parser.add_argument('-server', default='http://doe.synbiochem.co.uk/REST',
+                        help='OptBioDes server.')
+    return parser
+
+def testApp(url):
+    r = requests.get( url )
+    res = json.loads( r.content.decode('utf-8') )
+    print( res )
+    
+def sheetUpload(doefile, outfile, diagfile, url):
+    files = { 'file': open(doefile, 'rb' ) }
+    values = {'size': 64}
+    r = requests.post( os.path.join(url, 'Query' ), files=files, data=values )
+    res = json.loads( r.content.decode('utf-8') )
+    M = res['data']['M']
+    with open(outfile, 'w') as h:
+        cw = csv.writer(h)      
+        cw.writerow( res['data']['names'] )
+        for row in M:
+            cw.writerow( row )
+    print( 'Size:', res['data']['libsize'], 'Efficiency:', res['data']['J'] )
+
+
+
+if __name__ == "__main__":
+    parser = arguments()
+    arg = parser.parse_args()
+    assert os.path.exists(arg.infile)
+    sheetUpload( arg.infile, arg.outfile, arg.diagfile, arg.url )