Mercurial > repos > pablocarb > synbiodesign
view Selenzyme_query.ipynb @ 9:f9aef3df1fc8 draft
planemo upload commit 6a252d04f4b2f79606ab6679b6a91f957e33da7b-dirty
author | pablocarb |
---|---|
date | Thu, 02 May 2019 10:24:13 -0400 |
parents | ac027c9ace4d |
children |
line wrap: on
line source
{ "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 }