# HG changeset patch # User pablocarb # Date 1560430611 14400 # Node ID dbc40b3060148999cd67ef7c0c9e5c761e7f3b18 # Parent 612a2f94522f0f621ee8527dcb4c8a9e5335231b planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5-dirty diff -r 612a2f94522f -r dbc40b306014 outfile.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/outfile.html Thu Jun 13 08:56:51 2019 -0400 @@ -0,0 +1,139 @@ + + + + + + Viewer + + + + + + + + + +
+
+
+
+
+
+ Choose a pathway : + +
+
+ + diff -r 612a2f94522f -r dbc40b306014 rpVisualizer.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpVisualizer.xml Thu Jun 13 08:56:51 2019 -0400 @@ -0,0 +1,25 @@ + + Pathway visualizer + + python-libsbml + networkx + beautifulsoup4 + rdkit + + $__tool_directory__/info.log; + PYTHONPATH="$__tool_directory__" python $__tool_directory__/toolVisualizer.py $input1 $output1 + ]]> + + + + + + + + diff -r 612a2f94522f -r dbc40b306014 rpviz.xml --- a/rpviz.xml Tue Jun 11 12:09:38 2019 -0400 +++ b/rpviz.xml Thu Jun 13 08:56:51 2019 -0400 @@ -1,25 +1,19 @@ - + Pathway visualizer - python-libsbml - networkx - beautifulsoup4 - rdkit + requests $__tool_directory__/info.log; - PYTHONPATH="$__tool_directory__" python $__tool_directory__/toolVisualizer.py $input1 $output1 + python $__tool_directory__/toolRPViz.py $input1 $output1 -server $server ]]> + diff -r 612a2f94522f -r dbc40b306014 toolRPViz.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/toolRPViz.py Thu Jun 13 08:56:51 2019 -0400 @@ -0,0 +1,51 @@ +#!/usr/bin/env python3 +# -*- coding: utf-8 -*- +""" +Created on Mar 19 + +@author: Pablo Carbonell +@description: Query RPViz: pathway visualizer. + +""" +import requests +import argparse +import csv +import os +import json + +def arguments(): + parser = argparse.ArgumentParser(description='toolRPViz: Pathway visualizer. Pablo Carbonell, SYNBIOCHEM, 2019') + parser.add_argument('infile', + help='Pathways in SBML format.') + parser.add_argument('outfile', + help='HTML visualizer file.') + parser.add_argument('-server', default='http://rpviz.synbiochem.co.uk/REST', + help='RPViz server.') + return parser + +def testApp(url): + r = requests.get( url ) + res = json.loads( r.content.decode('utf-8') ) + print( res ) + +def pathwayUpload(infile, outfile, url): + files = { 'file': open(infile, 'rb' ) } + r = requests.post( os.path.join(url, 'Query' ), files=files ) + res = json.loads( r.content.decode('utf-8') ) + html = res['data']['html'] + with open(outfile, 'w') as h: + h.write(html) + print( 'Success!') + +def testHTML(f='outfile.html', outfile): + content = open(f).read() + with open(outfile, 'w') as h: + outfile.write(content) + + +if __name__ == "__main__": + parser = arguments() + arg = parser.parse_args() + assert os.path.exists(arg.infile) + testHTML( 'outfile.html', arg.outfile ) +# pathwayUpload( arg.infile, arg.outfile, arg.server )