# HG changeset patch # User pablocarb # Date 1556795800 14400 # Node ID 856bd14e6e96da9bd382e94a2fee70a20e194cea # Parent b0b7deebb71ea501665e6d3d32cf1a7511fae0f9 planemo upload commit 6a252d04f4b2f79606ab6679b6a91f957e33da7b-dirty diff -r b0b7deebb71e -r 856bd14e6e96 README.md --- 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/). diff -r b0b7deebb71e -r 856bd14e6e96 maketool.sh --- 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 diff -r b0b7deebb71e -r 856bd14e6e96 optbiodes.xml --- /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 @@ + + optimal synbio design + + requests + + + + + + + + + + + + \ No newline at end of file diff -r b0b7deebb71e -r 856bd14e6e96 selenzyme.xml --- 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 @@ ]]> - + diff -r b0b7deebb71e -r 856bd14e6e96 toolOptBioDes.py --- /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 )