changeset 0:ac027c9ace4d draft

planemo upload commit 9e24fae395aeaca30c5bcdef80a21b7decb04042-dirty
author pablocarb
date Mon, 29 Apr 2019 09:49:36 -0400
parents
children b0b7deebb71e
files LICENSE README.md Selenzyme_query.ipynb maketool.sh out.csv reaction.csv reaction2.csv selenzyme.xml selenzyme_tool.py toolSelenzyme.py
diffstat 10 files changed, 477 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/LICENSE	Mon Apr 29 09:49:36 2019 -0400
@@ -0,0 +1,8 @@
+MIT License
+Copyright (c) <year> <copyright holders>
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md	Mon Apr 29 09:49:36 2019 -0400
@@ -0,0 +1,18 @@
+# galaxy_selenzyme
+
+Creating a tool within Galaxy to run Selenzyme.
+
+See:
+
+* Tutorial to create a Galaxy tool: https://galaxyproject.org/admin/tools/add-tool-tutorial/
+* How to install it in the Galaxy container: https://github.com/bgruening/docker-galaxy-stable
+* Example for Uniprot: https://toolshed.g2.bx.psu.edu/repository?repository_id=c8774310981b07c5
+
+Plan:
+- [x] Create a basic command line tool using Python `requests` that submits a the reaction SMILES and gets the predicted sequences.
+- [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.
+- [ ] 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
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Selenzyme_query.ipynb	Mon Apr 29 09:49:36 2019 -0400
@@ -0,0 +1,280 @@
+{
+ "cells": [
+  {
+   "cell_type": "code",
+   "execution_count": 1,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "import json\n",
+    "import os\n",
+    "import sys\n",
+    "import time\n",
+    "import signal\n",
+    "import datetime\n",
+    "import logging\n",
+    "import copy\n",
+    "import requests"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 15,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "smarts = \"O=C([O-])CCC(=O)C(=O)[O-].NC(CC(=O)[O-])C(=O)O>>O=C([O-])CC(=O)C(=O)[O-].NC(CCC(=O)[O-])C(=O)O\"\n",
+    "targets = 2\n",
+    "noMSA = False"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "Request with smarts string"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 16,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "all_request_data = {'smarts': smarts, \"targets\": targets, \"noMSA\": noMSA}\n"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 18,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "url = 'http://selenzyme.synbiochem.co.uk/REST'\n",
+    "url = 'http://localhost:5000/REST'\n",
+    "r = requests.post( os.path.join(url, 'Query') , json=all_request_data )\n",
+    "res = json.loads( r.content.decode('utf-8') )\n",
+    "assert res['data'] is not None\n",
+    "val = json.loads( res['data'] )\n",
+    "assert 'Seq. ID' in val and len(val['Seq. ID'])>0"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 19,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "{'app': 'Selenzy',\n",
+       " 'author': 'Synbiochem',\n",
+       " 'data': '{\"Score\":{\"1\":163.7,\"2\":155.9},\"Seq. ID\":{\"1\":\"Q68XV9\",\"2\":\"P85951\"},\"Description\":{\"1\":\"Aspartate aminotransferase\",\"2\":\"Aspartate aminotransferase 2 (Fragments)\"},\"Organism Source\":{\"1\":\"Rickettsia typhi (strain ATCC VR-144 \\\\/ Wilmington) \",\"2\":\"Pseudotsuga menziesii PE=1 SV=1\"},\"Tax. distance\":{\"1\":15,\"2\":23},\"Rxn. ID\":{\"1\":\"MNXR32641\",\"2\":\"MNXR32641\"},\"EC Number\":{\"1\":\"2.6.1.1\",\"2\":\"2.6.1.1\"},\"Uniprot protein evidence\":{\"1\":3,\"2\":1},\"Consv. Score\":{\"1\":79.0,\"2\":79.0},\"Rxn Sim.\":{\"1\":1.0,\"2\":1.0},\"Direction Used\":{\"1\":1,\"2\":1},\"Direction Preferred\":{\"1\":0,\"2\":0},\"% helices\":{\"1\":42.6,\"2\":27.8},\"% sheets\":{\"1\":24.8,\"2\":72.2},\"% turns\":{\"1\":19.6,\"2\":5.6},\"% coils\":{\"1\":17.2,\"2\":83.3},\"Mol. Weight\":{\"1\":44337.23,\"2\":3587.11},\"Isoelec. Point\":{\"1\":8.3119,\"2\":10.4338},\"Polar %\":{\"1\":45.113,\"2\":41.176},\"Query\":{\"1\":\"O=C([O-])CCC(=O)C(=O)[O-].NC(CC(=O)[O-])C(=O)O>>O=C([O-])CC(=O)C(=O)[O-].NC(CCC(=O)[O-])C(=O)O\",\"2\":\"O=C([O-])CCC(=O)C(=O)[O-].NC(CC(=O)[O-])C(=O)O>>O=C([O-])CC(=O)C(=O)[O-].NC(CCC(=O)[O-])C(=O)O\"},\"Hit\":{\"1\":\"O=C([O-])CC(=O)C(=O)[O-].NC(CCC(=O)[O-])C(=O)O>>O=C([O-])CCC(=O)C(=O)[O-].NC(CC(=O)[O-])C(=O)O\",\"2\":\"O=C([O-])CC(=O)C(=O)[O-].NC(CCC(=O)[O-])C(=O)O>>O=C([O-])CCC(=O)C(=O)[O-].NC(CC(=O)[O-])C(=O)O\"}}',\n",
+       " 'version': '1.0'}"
+      ]
+     },
+     "execution_count": 19,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "res"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 5,
+   "metadata": {},
+   "outputs": [
+    {
+     "name": "stdout",
+     "output_type": "stream",
+     "text": [
+      "{'Score': {'1': 136.7, '2': 125.9}, 'Seq. ID': {'1': 'P39643', '2': 'E9L7A5'}, 'Description': {'1': 'Probable aspartate aminotransferase', '2': 'Bifunctional aspartate aminotransferase and glutamate/aspartate-prephenate aminotransferase'}, 'Organism Source': {'1': 'Bacillus subtilis (strain 168) ', '2': 'Petunia hybrida PE=1 SV=1'}, 'Tax. distance': {'1': 18, '2': 29}, 'Rxn. ID': {'1': 'MNXR32641', '2': 'MNXR32641'}, 'EC Number': {'1': '2.6.1.1', '2': '2.6.1.1'}, 'Uniprot protein evidence': {'1': 3, '2': 1}, 'Consv. Score': {'1': 55.0, '2': 55.0}, 'Rxn Sim.': {'1': 1.0, '2': 1.0}, 'Direction Used': {'1': 1, '2': 1}, 'Direction Preferred': {'1': 0, '2': 0}, '% helices': {'1': 51.4, '2': 31.3}, '% sheets': {'1': 16.2, '2': 29.4}, '% turns': {'1': 13.8, '2': 18.6}, '% coils': {'1': 22.7, '2': 24.2}, 'Mol. Weight': {'1': 44702.91, '2': 51743.31}, 'Isoelec. Point': {'1': 5.4491, '2': 8.6228}, 'Polar %': {'1': 42.105, '2': 43.841}, 'Query': {'1': 'O=C([O-])CCC(=O)C(=O)[O-].NC(CC(=O)[O-])C(=O)O>>O=C([O-])CC(=O)C(=O)[O-].NC(CCC(=O)[O-])C(=O)O', '2': 'O=C([O-])CCC(=O)C(=O)[O-].NC(CC(=O)[O-])C(=O)O>>O=C([O-])CC(=O)C(=O)[O-].NC(CCC(=O)[O-])C(=O)O'}, 'Hit': {'1': 'O=C([O-])CC(=O)C(=O)[O-].NC(CCC(=O)[O-])C(=O)O>>O=C([O-])CCC(=O)C(=O)[O-].NC(CC(=O)[O-])C(=O)O', '2': 'O=C([O-])CC(=O)C(=O)[O-].NC(CCC(=O)[O-])C(=O)O>>O=C([O-])CCC(=O)C(=O)[O-].NC(CC(=O)[O-])C(=O)O'}}\n"
+     ]
+    }
+   ],
+   "source": [
+    "print(val)"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "Request with reaction DB and reaction ID following indications on http://selenzyme.synbiochem.co.uk/"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 6,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "all_request_data = {\"db\": \"mnx\", \"rxnid\": \"MNXR141534\", \"targets\": targets, \"noMSA\": noMSA}"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 7,
+   "metadata": {
+    "scrolled": true
+   },
+   "outputs": [
+    {
+     "ename": "AssertionError",
+     "evalue": "",
+     "output_type": "error",
+     "traceback": [
+      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+      "\u001b[0;31mAssertionError\u001b[0m                            Traceback (most recent call last)",
+      "\u001b[0;32m<ipython-input-7-b6f4ae0ef527>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      2\u001b[0m \u001b[0mr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mrequests\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpost\u001b[0m\u001b[0;34m(\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Query'\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m,\u001b[0m \u001b[0mjson\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mall_request_data\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mjson\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mloads\u001b[0m\u001b[0;34m(\u001b[0m \u001b[0mr\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcontent\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdecode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'utf-8'\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0;32massert\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'data'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      5\u001b[0m \u001b[0mval\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mjson\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mloads\u001b[0m\u001b[0;34m(\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'data'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      6\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0;34m'Seq. ID'\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mval\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mval\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Seq. ID'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m>\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+      "\u001b[0;31mAssertionError\u001b[0m: "
+     ]
+    }
+   ],
+   "source": [
+    "url = 'http://selenzyme.synbiochem.co.uk/REST'\n",
+    "r = requests.post( os.path.join(url, 'Query') , json=all_request_data )\n",
+    "res = json.loads( r.content.decode('utf-8') )\n",
+    "assert res['data'] is not None\n",
+    "val = json.loads( res['data'] )\n",
+    "assert 'Seq. ID' in val and len(val['Seq. ID'])>0"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "Same reaction with its sabiork id"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 8,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "all_request_data = {\"db\": \"sabiork\", \"rxnid\": \"12346\", \"targets\": targets, \"noMSA\": noMSA}"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 9,
+   "metadata": {},
+   "outputs": [
+    {
+     "ename": "AssertionError",
+     "evalue": "",
+     "output_type": "error",
+     "traceback": [
+      "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
+      "\u001b[0;31mAssertionError\u001b[0m                            Traceback (most recent call last)",
+      "\u001b[0;32m<ipython-input-9-b6f4ae0ef527>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m()\u001b[0m\n\u001b[1;32m      2\u001b[0m \u001b[0mr\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mrequests\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpost\u001b[0m\u001b[0;34m(\u001b[0m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpath\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mjoin\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0murl\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m'Query'\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m,\u001b[0m \u001b[0mjson\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mall_request_data\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      3\u001b[0m \u001b[0mres\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mjson\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mloads\u001b[0m\u001b[0;34m(\u001b[0m \u001b[0mr\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mcontent\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdecode\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'utf-8'\u001b[0m\u001b[0;34m)\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 4\u001b[0;31m \u001b[0;32massert\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'data'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m      5\u001b[0m \u001b[0mval\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mjson\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mloads\u001b[0m\u001b[0;34m(\u001b[0m \u001b[0mres\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'data'\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m      6\u001b[0m \u001b[0;32massert\u001b[0m \u001b[0;34m'Seq. ID'\u001b[0m \u001b[0;32min\u001b[0m \u001b[0mval\u001b[0m \u001b[0;32mand\u001b[0m \u001b[0mlen\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mval\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0;34m'Seq. ID'\u001b[0m\u001b[0;34m]\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m>\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
+      "\u001b[0;31mAssertionError\u001b[0m: "
+     ]
+    }
+   ],
+   "source": [
+    "url = 'http://selenzyme.synbiochem.co.uk/REST'\n",
+    "r = requests.post( os.path.join(url, 'Query') , json=all_request_data )\n",
+    "res = json.loads( r.content.decode('utf-8') )\n",
+    "assert res['data'] is not None\n",
+    "val = json.loads( res['data'] )\n",
+    "assert 'Seq. ID' in val and len(val['Seq. ID'])>0"
+   ]
+  },
+  {
+   "cell_type": "markdown",
+   "metadata": {},
+   "source": [
+    "same reaction with its EC number"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 73,
+   "metadata": {},
+   "outputs": [],
+   "source": [
+    "all_request_data = {\"db\": \"ec\", \"rxnid\": \"3.2.1.2\", \"targets\": targets, \"noMSA\": noMSA}"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 74,
+   "metadata": {
+    "scrolled": true
+   },
+   "outputs": [],
+   "source": [
+    "url = 'http://selenzyme.synbiochem.co.uk/REST'\n",
+    "r = requests.post( os.path.join(url, 'Query') , json=all_request_data )\n",
+    "res = json.loads( r.content.decode('utf-8') )\n",
+    "assert res['data'] is not None\n",
+    "val = json.loads( res['data'] )\n",
+    "assert 'Seq. ID' in val and len(val['Seq. ID'])>0"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": 75,
+   "metadata": {},
+   "outputs": [
+    {
+     "data": {
+      "text/plain": [
+       "{'app': 'Selenzy',\n",
+       " 'author': 'Synbiochem',\n",
+       " 'data': '{\"Score\":{\"1\":134.6,\"2\":121.9},\"Seq. ID\":{\"1\":\"Q9HHC8\",\"2\":\"O23553\"},\"Description\":{\"1\":\"Cyclomaltodextrinase\",\"2\":\"Beta-amylase 3; chloroplastic\"},\"Organism Source\":{\"1\":\"Thermococcus sp. B1001 \",\"2\":\"Arabidopsis thaliana \"},\"Tax. distance\":{\"1\":16,\"2\":29},\"Rxn. ID\":{\"1\":\"MNXR87651\",\"2\":\"MNXR87683\"},\"EC Number\":{\"1\":\"3.2.1\",\"2\":\"3.2.1.2\"},\"Uniprot protein evidence\":{\"1\":4,\"2\":1},\"Consv. Score\":{\"1\":51.0,\"2\":51.0},\"Rxn Sim.\":{\"1\":1.0,\"2\":1.0},\"Direction Used\":{\"1\":-1,\"2\":-1},\"Direction Preferred\":{\"1\":-1,\"2\":-1},\"% helices\":{\"1\":45.7,\"2\":33.8},\"% sheets\":{\"1\":20.7,\"2\":17.9},\"% turns\":{\"1\":18.5,\"2\":24.6},\"% coils\":{\"1\":17.7,\"2\":26.7},\"Mol. Weight\":{\"1\":78842.79,\"2\":61353.16},\"Isoelec. Point\":{\"1\":9.1162,\"2\":7.0599},\"Polar %\":{\"1\":45.455,\"2\":47.993},\"Query\":{\"1\":\"O.[*]OC1C(CO)OC(OC2C(CO)OC(O)C(O)C2O)C(O)C1O>>OCC1OC(OC2C(CO)OC(O)C(O)C2O)C(O)C(O)C1O\",\"2\":\"O.[*]OC1C(CO)OC(OC2C(CO)OC(O)C(O)C2O)C(O)C1O>>OCC1OC(OC2C(CO)OC(O)C(O)C2O)C(O)C(O)C1O\"},\"Hit\":{\"1\":\"O.[*]OC1C(CO)OC(OC2C(CO)OC(OC3C(CO)OC(O)C(O)C3O)C(O)C2O)C(O)C1O>>OCC1OC(OC2C(CO)OC(O)C(O)C2O)C(O)C(O)C1O.OCC1OC(O)C(O)C(O)C1O\",\"2\":\"O.[*]OC1C(CO)OC(OC2C(CO)OC(O)C(O)C2O)C(O)C1O>>OCC1OC(OC2C(CO)OC(O)C(O)C2O)C(O)C(O)C1O.[*]OC1C(CO)OC(OC2C(CO)OC(O)C(O)C2O)C(O)C1O\"}}',\n",
+       " 'version': '1.0'}"
+      ]
+     },
+     "execution_count": 75,
+     "metadata": {},
+     "output_type": "execute_result"
+    }
+   ],
+   "source": [
+    "res"
+   ]
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": []
+  },
+  {
+   "cell_type": "code",
+   "execution_count": null,
+   "metadata": {},
+   "outputs": [],
+   "source": []
+  }
+ ],
+ "metadata": {
+  "anaconda-cloud": {},
+  "kernelspec": {
+   "display_name": "Python 3",
+   "language": "python",
+   "name": "python3"
+  },
+  "language_info": {
+   "codemirror_mode": {
+    "name": "ipython",
+    "version": 3
+   },
+   "file_extension": ".py",
+   "mimetype": "text/x-python",
+   "name": "python",
+   "nbconvert_exporter": "python",
+   "pygments_lexer": "ipython3",
+   "version": "3.6.6"
+  }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/maketool.sh	Mon Apr 29 09:49:36 2019 -0400
@@ -0,0 +1,31 @@
+#!/bin/bash
+# author: Pablo Carbonell
+# Create Selenzyme Galaxy tool using planemo.
+#    --example_input reaction.csv \
+#    --example_output out.csv \
+#    --example_command 'python $__tool_directory__/toolSelenzyme.py $input1 $output1 -server $server' \
+
+planemo tool_init --force \
+    --id 'selenzyme' \
+    --name 'Selenzyme' \
+    --description 'enzyme sequence selection from reaction template' \
+    --requirement requests@2 \
+    --example_command 'python $__tool_directory__/toolSelenzyme.py $input1 $output1' \
+    --example_input 'reaction.csv' \
+    --example_output 'out.csv' \
+    --doi 10.1093/bioinformatics/bty065 \
+    --help_from_command 'python3 toolSelenzyme.py -h'
+    
+planemo shed_init . --force \
+    --name synbiodesign \
+    --owner pablocarb \
+    --description 'BioCAD for Industrial Biotechnology' \
+    --category 'Systems Biology' \
+    --homepage_url 'https://github.com/pablocarb/galaxysynbiodesign'
+
+planemo shed_create \
+    --shed_target toolshed \
+    --shed_key_from_env TOOLSHED 
+
+planemo shed_update \
+    --check_diff --shed_target toolshed
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/out.csv	Mon Apr 29 09:49:36 2019 -0400
@@ -0,0 +1,51 @@
+Seq. ID,Score,Organism Source,Description
+Q56114,91.7,Salmonella typhi ,Aspartate aminotransferase
+Q53IZ1,89.9,Pseudomonas sp. ,Bifunctional aspartate aminotransferase and L-aspartate beta-decarboxylase
+P44425,88.7,Haemophilus influenzae (strain ATCC 51907 / DSM 11121 / KW20 / Rd) ,Aspartate aminotransferase
+Q3IED5,88.7,Pseudoalteromonas haloplanktis (strain TAC 125) ,AspC protein
+Q93QX0,87.9,Comamonas testosteroni ,Bifunctional aspartate aminotransferase and L-aspartate beta-decarboxylase
+P52069,86.7,Methylobacterium extorquens PE=3 SV=1,Putative aspartate aminotransferase (Fragment)
+O86459,85.7,Rhizobium leguminosarum bv. phaseoli ,Aspartate aminotransferase
+Q54SF7,84.7,Dictyostelium discoideum ,Aspartate aminotransferase; cytoplasmic
+Q55F21,84.7,Dictyostelium discoideum ,Aspartate aminotransferase; mitochondrial
+Q9ZE56,84.7,Rickettsia prowazekii (strain Madrid E) ,Aspartate aminotransferase
+O67781,84.7,Aquifex aeolicus (strain VF5) ,Aspartate aminotransferase
+O33822,84.7,Thermus aquaticus ,Aspartate aminotransferase
+Q60013,84.7,Streptomyces virginiae ,Aspartate aminotransferase
+Q68XV9,84.7,Rickettsia typhi (strain ATCC VR-144 / Wilmington) ,Aspartate aminotransferase
+Q1RGV0,84.7,Rickettsia bellii (strain RML369-C) ,Aspartate aminotransferase
+Q56232,83.9,Thermus thermophilus (strain HB8 / ATCC 27634 / DSM 579) ,Aspartate aminotransferase
+P9WQ90,82.7,Mycobacterium tuberculosis (strain CDC 1551 / Oshkosh) ,Probable aspartate aminotransferase
+Q9V0L2,82.7,Pyrococcus abyssi (strain GE5 / Orsay) ,Aspartate aminotransferase
+Q60317,82.7,Methanocaldococcus jannaschii (strain ATCC 43067 / DSM 2661 / JAL-1 / JCM 10045 / NBRC 100440) ,Probable aspartate aminotransferase 1
+O93744,82.7,Thermococcus kodakarensis (strain ATCC BAA-918 / JCM 12380 / KOD1) ,Aspartate aminotransferase
+P39643,81.7,Bacillus subtilis (strain 168) ,Probable aspartate aminotransferase
+Q972A2,81.7,Sulfolobus tokodaii (strain DSM 16993 / JCM 10545 / NBRC 100140 / 7) ,Aspartate aminotransferase
+Q4J8X2,81.7,Sulfolobus acidocaldarius (strain ATCC 33909 / DSM 639 / JCM 8929 / NBRC 15157 / NCIMB 11770) ,Aspartate aminotransferase
+P53001,81.7,Bacillus subtilis (strain 168) ,Aspartate aminotransferase
+O42652,78.7,Schizosaccharomyces pombe (strain 972 / ATCC 24843) ,Aspartate aminotransferase; cytoplasmic
+O94320,78.7,Schizosaccharomyces pombe (strain 972 / ATCC 24843) ,Aspartate aminotransferase; mitochondrial
+P23542,77.9,Saccharomyces cerevisiae (strain ATCC 204508 / S288c) ,Aspartate aminotransferase; cytoplasmic
+P85951,76.9,Pseudotsuga menziesii PE=1 SV=1,Aspartate aminotransferase 2 (Fragments)
+P85906,76.9,Pseudotsuga menziesii PE=1 SV=1,Aspartate aminotransferase 1 (Fragments)
+Q5F4K8,75.9,Pinus pinaster ,Aspartate aminotransferase
+E9L7A5,70.9,Petunia hybrida PE=1 SV=1,Bifunctional aspartate aminotransferase and glutamate/aspartate-prephenate aminotransferase
+P46645,70.9,Arabidopsis thaliana ,Aspartate aminotransferase; cytoplasmic isozyme 1
+Q9SIE1,70.9,Arabidopsis thaliana ,Bifunctional aspartate aminotransferase and glutamate/aspartate-prephenate aminotransferase
+P26563,69.8,Lupinus angustifolius PE=2 SV=1,Aspartate aminotransferase P2; mitochondrial (Fragment)
+P85310,68.9,Catharanthus roseus PE=1 SV=1,Aspartate aminotransferase; mitochondrial (Fragments)
+Q42391,68.8,Panicum miliaceum ,Aspartate aminotransferase
+P37833,68.8,Oryza sativa subsp. japonica ,Aspartate aminotransferase; cytoplasmic
+Q43305,68.8,Panicum miliaceum ,Aspartate aminotransferase
+P12343,64.9,Oryctolagus cuniculus ,Aspartate aminotransferase; cytoplasmic (Fragment)
+P08907,64.9,Equus caballus ,Aspartate aminotransferase; mitochondrial
+P00506,64.9,Sus scrofa ,Aspartate aminotransferase; mitochondrial
+P12344,62.9,Bos taurus ,Aspartate aminotransferase; mitochondrial
+P33097,62.9,Bos taurus ,Aspartate aminotransferase; cytoplasmic
+P13221,61.9,Rattus norvegicus ,Aspartate aminotransferase; cytoplasmic
+P05202,60.9,Mus musculus ,Aspartate aminotransferase; mitochondrial
+P05201,60.9,Mus musculus ,Aspartate aminotransferase; cytoplasmic
+P17174,60.9,Homo sapiens ,Aspartate aminotransferase; cytoplasmic
+Q5R691,60.8,Pongo abelii ,Aspartate aminotransferase; cytoplasmic
+A5A6K8,60.8,Pan troglodytes ,Aspartate aminotransferase; cytoplasmic
+P00504,58.9,Gallus gallus ,Aspartate aminotransferase; cytoplasmic
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/reaction.csv	Mon Apr 29 09:49:36 2019 -0400
@@ -0,0 +1,3 @@
+name,smarts
+test,"O=C([O-])CCC(=O)C(=O)[O-].NC(CC(=O)[O-])C(=O)O>>O=C([O-])CC(=O)C(=O)[O-].NC(CCC(=O)[O-])C(=O)O"
+test2,"([#7&v3:1](=[#6&v4:2](-[#8&v2:3]-[#1&v1:4])-[#6&v4:5]1:[#6&v4:6](:[#6&v4:7](:[#6&v4:8](:[#7&+&v4:9](:[#6&v4:10]:1-[#1&v1:11])-[#6&v4:12]1(-[#8&v2:13]-[#6&v4:14](-[#6&v4:15](-[#8&v2:16]-[#15&v5:17])(-[#1&v1:18])-[#1&v1:19])(-[#6&v4:20](-[#8&v2:21]-[#1&v1:22])(-[#6&v4:23]-1(-[#8&v2:24]-[#1&v1:25])-[#1&v1:26])-[#1&v1:27])-[#1&v1:28])-[#1&v1:29])-[#1&v1:30])-[#1&v1:31])-[#1&v1:32])-[#1&v1:33])>>([#7&v3:1](=[#6&v4:2](-[#8&v2:3]-[#1&v1:4])-[#6&v4:5]1-[#6&v4:6](-[#6&v4:7](=[#6&v4:8](-[#7&+0&v3:9](-[#6&v4:10]=1-[#1&v1:11])-[#6&v4:12]1(-[#8&v2:13]-[#6&v4:14](-[#6&v4:15](-[#8&v2:16]-[#15&v5:17])(-[#1&v1:18])-[#1&v1:19])(-[#6&v4:20](-[#8&v2:21]-[#1&v1:22])(-[#6&v4:23]-1(-[#8&v2:24]-[#1&v1:25])-[#1&v1:26])-[#1&v1:27])-[#1&v1:28])-[#1&v1:29])-[#1&v1:30])-[#1&v1:31])(-[#1&v1:32])-[#1&v1])-[#1&v1:33])"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/reaction2.csv	Mon Apr 29 09:49:36 2019 -0400
@@ -0,0 +1,2 @@
+name,smarts
+test2,"([#7&v3:1](=[#6&v4:2](-[#8&v2:3]-[#1&v1:4])-[#6&v4:5]1:[#6&v4:6](:[#6&v4:7](:[#6&v4:8](:[#7&+&v4:9](:[#6&v4:10]:1-[#1&v1:11])-[#6&v4:12]1(-[#8&v2:13]-[#6&v4:14](-[#6&v4:15](-[#8&v2:16]-[#15&v5:17])(-[#1&v1:18])-[#1&v1:19])(-[#6&v4:20](-[#8&v2:21]-[#1&v1:22])(-[#6&v4:23]-1(-[#8&v2:24]-[#1&v1:25])-[#1&v1:26])-[#1&v1:27])-[#1&v1:28])-[#1&v1:29])-[#1&v1:30])-[#1&v1:31])-[#1&v1:32])-[#1&v1:33])>>([#7&v3:1](=[#6&v4:2](-[#8&v2:3]-[#1&v1:4])-[#6&v4:5]1-[#6&v4:6](-[#6&v4:7](=[#6&v4:8](-[#7&+0&v3:9](-[#6&v4:10]=1-[#1&v1:11])-[#6&v4:12]1(-[#8&v2:13]-[#6&v4:14](-[#6&v4:15](-[#8&v2:16]-[#15&v5:17])(-[#1&v1:18])-[#1&v1:19])(-[#6&v4:20](-[#8&v2:21]-[#1&v1:22])(-[#6&v4:23]-1(-[#8&v2:24]-[#1&v1:25])-[#1&v1:26])-[#1&v1:27])-[#1&v1:28])-[#1&v1:29])-[#1&v1:30])-[#1&v1:31])(-[#1&v1:32])-[#1&v1])-[#1&v1:33])"
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/selenzyme.xml	Mon Apr 29 09:49:36 2019 -0400
@@ -0,0 +1,33 @@
+<tool id="selenzyme" name="Selenzyme" version="0.1.0">
+    <description>enzyme sequence selection from reaction template</description>
+    <requirements>
+        <requirement type="package" version="2">requests</requirement>
+    </requirements>
+    <command detect_errors="exit_code"><![CDATA[
+        python $__tool_directory__/toolSelenzyme.py $input1 $output1
+    ]]></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" />
+    </inputs>
+    <outputs>
+        <data name="output1" format="csv" from_work_dir="out.csv" />
+    </outputs>
+    <help><![CDATA[
+        usage: toolSelenzyme.py [-h] [-server SERVER] infile outfile
+
+toolSelenzyme: Enzyme sequence selection. Pablo Carbonell, SYNBIOCHEM, 2019
+
+positional arguments:
+  infile          Input csv file.
+  outfile         Input csv file.
+
+optional arguments:
+  -h, --help      show this help message and exit
+  -server SERVER  Selenzyme server.
+
+    ]]></help>
+    <citations>
+        <citation type="doi">10.1093/bioinformatics/bty065</citation>
+    </citations>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/selenzyme_tool.py	Mon Apr 29 09:49:36 2019 -0400
@@ -0,0 +1,3 @@
+import requests
+url = 'http://selenzyme.synbiochem.co.uk/REST'
+r = requests.post(url, data= {'smarts': O=C([O-])CCC(=O)C(=O)[O-].NC(CC(=O)[O-])C(=O)O>>O=C([O-])CC(=O)C(=O)[O-].NC(CCC(=O)[O-])C(=O)O
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/toolSelenzyme.py	Mon Apr 29 09:49:36 2019 -0400
@@ -0,0 +1,48 @@
+#!/usr/bin/env python3
+# -*- coding: utf-8 -*-
+"""
+Created on Mar 19
+
+@author: Pablo Carbonell
+@description: Query Selenzme: Enzyme sequence selection.
+
+"""
+import requests
+import argparse
+import csv
+import os
+import json
+
+def arguments():
+    parser = argparse.ArgumentParser(description='toolSelenzyme: Enzyme sequence selection. Pablo Carbonell, SYNBIOCHEM, 2019')
+    parser.add_argument('infile', 
+                        help='Input csv file.')
+    parser.add_argument('outfile', 
+                        help='Input csv file.')
+    parser.add_argument('-server', default='http://selenzyme.synbiochem.co.uk/REST',
+                        help='Selenzyme server.')
+    return parser
+
+# Output columns, to be improved
+columns = ['Seq. ID', 'Score', 'Organism Source', 'Description']
+
+if __name__ == "__main__":
+    parser = arguments()
+    arg = parser.parse_args()
+    assert os.path.exists(arg.infile)
+    with open(arg.infile) as handler:
+        cv = csv.DictReader(handler)
+        row = next(cv)
+        url = arg.server
+        assert 'smarts' in row
+        r = requests.post( os.path.join(url, 'Query') , json={'smarts': row['smarts']} )
+        res = json.loads( r.content.decode('utf-8') )
+        assert res['data'] is not None
+        val = json.loads( res['data'] )
+        assert 'Seq. ID' in val and len(val['Seq. ID'])>0
+        with open(arg.outfile, 'w' ) as writer:
+            cw = csv.writer( writer )
+            cw.writerow( columns )
+            for ix in sorted(val['Seq. ID'], key=lambda z: int(z)):
+                cw.writerow( [val[j][ix] for j in columns] )
+