Previous changeset 15:785b6253af1f (2019-06-11) Next changeset 17:e97e43516c61 (2019-06-11) |
Commit message:
planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5 |
modified:
rpviz.xml |
added:
rpviz/LICENSE rpviz/README.md rpviz/Test with Ecoli ntwk/Copy_of_All_genes_of_E._coli_K-12_substr._MG1655.txt rpviz/Test with Ecoli ntwk/E coli PPI network.py rpviz/Test with Ecoli ntwk/HT.PMID-15690043.EcoliNet.303gene.3446link.txt rpviz/__init__.py rpviz/__pycache__/__init__.cpython-37.pyc rpviz/__pycache__/main.cpython-37.pyc rpviz/__pycache__/network2json.cpython-37.pyc rpviz/__pycache__/py2html2.cpython-37.pyc rpviz/__pycache__/sbml2lists.cpython-37.pyc rpviz/__pycache__/smile2picture.cpython-37.pyc rpviz/csv_network.py rpviz/images_report/node diagram.png rpviz/images_report/script diagram.png rpviz/images_report/workflow.PNG rpviz/main.py rpviz/network2json.py rpviz/new_html/cytoscape.min.js rpviz/new_html/output.html rpviz/new_html/template2.html rpviz/nxvisualizer.py rpviz/py2html2.py rpviz/sbml2lists.py rpviz/smile2picture.py |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz.xml --- a/rpviz.xml Tue Jun 11 10:03:06 2019 -0400 +++ b/rpviz.xml Tue Jun 11 11:42:40 2019 -0400 |
b |
@@ -1,7 +1,7 @@ <tool id="rpviz" name="rpVisualizer" version="0.1.0" python_template_version="3.5"> <description>Pathway visualizer</description> <requirements> - <requirement type="package">python-libsbml</requirement> + <requirement type="package" version="5.18">python-libsbml</requirement> <requirement type="package">networkx</requirement> <requirement type="package">beautifulsoup4</requirement> <requirement type="package">rdkit</requirement> |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/LICENSE --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/LICENSE Tue Jun 11 11:42:40 2019 -0400 |
b |
@@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2019 Pablo Carbonell + +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. |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/README.md --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/README.md Tue Jun 11 11:42:40 2019 -0400 |
b |
@@ -0,0 +1,18 @@ +# rpviz +Metabolic engineering visualizer + +csv_network.py : To read information from a csv file +sbml2list.py : To read information from a sbml file + +smile2picture.py : To convert SMILES into svg image + +network2json.py : To convert the network in a json file + +## 1 html/pathway +py2html : To create an html file from a json file, using a template (in html/template.html) with jinja2 and to use it with + +## 1 html updated for each pathway +py2html2 : To create a .js file with the json file and to open it with the template2 (in html/template2.html) and the network_viewer.js + +nxvisualizer.py : To open the network directly in Cytoscape + |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/Test with Ecoli ntwk/Copy_of_All_genes_of_E._coli_K-12_substr._MG1655.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/Test with Ecoli ntwk/Copy_of_All_genes_of_E._coli_K-12_substr._MG1655.txt Tue Jun 11 11:42:40 2019 -0400 |
b |
b'@@ -0,0 +1,4632 @@\n+"Gene Name"\t"Accession-1"\t"Left-End-Position"\t"Right-End-Position"\t"Product"\t"Map to Escherichia coli CFT073"\t"Accession-1"\t"Accession-1"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11979"\t"b2038"\t2109581\t2110138\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=DTDPDEHYDRHAMEPIM-MONOMER"\t""\t"b2038"\t"b2038"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11991"\t"b2112"\t2192515\t2192796\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11991-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C2640"\t"b2112"\t"b2112"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG12302"\t"b1098"\t1155124\t1155765\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=DTMPKI-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C1370"\t"b1098"\t"b1098"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG12320"\t"b0127"\t142779\t143705\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=YADG-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C0156"\t"b0127"\t"b0127"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11428"\t"b3962"\t4159390\t4160790\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=UDHA-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C4923"\t"b3962"\t"b3962"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG10649"\t"b1109"\t1166085\t1167389\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=NADH-DHII-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C1382"\t"b1109"\t"b1109"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11650"\t"b0209"\t231122\t231922\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11650-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C0246"\t"b0209"\t"b0209"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11045"\t"b3831"\t4016431\t4017192\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=URPHOS-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C4773"\t"b3831"\t"b3831"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG10818"\t"b3752"\t3937294\t3938223\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=RIBOKIN-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C4680"\t"b3752"\t"b3752"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11257"\t"b0385"\t403703\t404818\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11257-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C0492"\t"b0385"\t"b0385"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG10566"\t"b1613"\t1688576\t1689751\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=MANNPISOM-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C2005"\t"b1613"\t"b1613"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G7468"\t"b2848"\t2989304\t2989786\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G7468-MONOMER"\t""\t"b2848"\t"b2848"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG10413"\t"b3779"\t3962745\t3964229\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=PPPGPPHYDRO-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C4699"\t"b3779"\t"b3779"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG10290"\t"b4287"\t4510690\t4511457\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=FECE-MONOMER"\t""\t"b4287"\t"b4287"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG12411"\t"b2040"\t2111077\t2111976\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=DTDPDEHYRHAMREDUCT-MONOMER"\t""\t"b2040"\t"b2040"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG10468"\t"b0972"\t1032139\t1033257\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=HYAA-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C1113"\t"b0972"\t"b0972"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G7015"\t"b1843"\t1925440\t1926096\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G7015-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C2253"\t"b1843"\t"b1843"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11971"\t"b2393"\t2513042\t2514244\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=NUPC-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C2932"\t"b2393"\t"b2393"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG10053"\t"b0063"\t68348\t70048\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=RIBULOKIN-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C0075"\t"b0063"\t"b0063"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G6273"\t"b0502"\t529645\t530016\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G6273-MONOMER"\t""\t"b0502"\t"b0502"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11789"\t"b2051"\t2125743\t2126222\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=GD'..b'3989828\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=UROGENIIISYN-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C4723"\t"b3804"\t"b3804"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG30079"\t"b3758"\t3943704\t3946607\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=RRLC-RRNA"\t""\t"b3758"\t"b3758"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G7111"\t"b2072"\t2151711\t2152472\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G7111-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C2598"\t"b2072"\t"b2072"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG10039"\t"b1982"\t2055061\t2056515\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=AMP-NUCLEOSID-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C2444"\t"b1982"\t"b1982"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG10389"\t"b0809"\t845741\t846463\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=GLNQ-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C0894"\t"b0809"\t"b0809"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11198"\t"b3730"\t3913830\t3915200\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=NAG1P-URIDYLTRANS-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C4655"\t"b3730"\t"b3730"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG10931"\t"b0723"\t755907\t757673\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=SDH-FLAVO"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C0801"\t"b0723"\t"b0723"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G6843"\t"b1585"\t1656747\t1657457\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G6843-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C1975"\t"b1585"\t"b1585"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG20257"\t"b2675"\t2801348\t2803492\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=NRDE-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C3228"\t"b2675"\t"b2675"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11848"\t"b3883"\t4073739\t4074635\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11848-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C4825"\t"b3883"\t"b3883"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG10427"\t"b1210"\t1263714\t1264970\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=GLUTRNAREDUCT-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C1668"\t"b1210"\t"b1210"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG10162"\t"b2048"\t2121609\t2122979\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=PHOSMANMUT-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C2557"\t"b2048"\t"b2048"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G6424"\t"b0821"\t857796\t859061\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G6424-MONOMER"\t""\t"b0821"\t"b0821"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11102"\t"b0477"\t500125\t501429\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=GSK-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C0597"\t"b0477"\t"b0477"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G6656"\t"b1318"\t1380821\t1381789\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=YCJV-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C1790"\t"b1318"\t"b1318"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G7093"\t"b2042"\t2113434\t2114327\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G7093-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C2567"\t"b2042"\t"b2042"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11857"\t"b3893"\t4081857\t4082759\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=FDOH-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C4843"\t"b3893"\t"b3893"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG12857"\t"b2586"\t2724128\t2724451\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG12857-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C3111"\t"b2586"\t"b2586"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG10421"\t"b2508"\t2632604\t2634070\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=IMP-DEHYDROG-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C3027"\t"b2508"\t"b2508"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=EG11066"\t"b4322"\t4551636\t4552820\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=MANNONDEHYDRAT-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C5402"\t"b4322"\t"b4322"\n+"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G6606"\t"b1166"\t1216369\t1216635\t"HTTPS://ecocyc.org/gene?orgid=ECOLI&id=G6606-MONOMER"\t"HTTPS://ecocyc.org/gene?orgid=ECOL199310&id=C1609"\t"b1166"\t"b1166"\n' |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/Test with Ecoli ntwk/E coli PPI network.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/Test with Ecoli ntwk/E coli PPI network.py Tue Jun 11 11:42:40 2019 -0400 |
[ |
@@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- +""" +Created on Tue May 28 11:38:34 2019 + +@author: Anaelle +""" + + +import networkx as nx +import numpy as np +import matplotlib.pyplot as plt +import requests + + +tab=np.loadtxt('HT.PMID-15690043.EcoliNet.303gene.3446link.txt',dtype='str',delimiter='\t') #Network file +smartab=np.loadtxt('Copy_of_All_genes_of_E._coli_K-12_substr._MG1655.txt', dtype='str',delimiter='\t',usecols=(0,1)) #Smart table to assign a link to each node + +reseau=nx.Graph() +dic_links={} +for i in range(len(tab)): + reseau.add_edge(tab[i][0],tab[i][1],weight=tab[i][2]) #network construction +for nodes in range(len(list(reseau.nodes))): + for j in range(len(smartab)): + if smartab[j][1][1:-1]==list(reseau.nodes)[nodes]: + url=smartab[j][0][1:-1] + left, right = url.split(':') + url_new = ':'.join( [left, requests.utils.quote(right)] ) #to avoid encoding problems + dic_links[list(reseau.nodes)[nodes]]= url_new#each link is assigned to each node + +nx.set_node_attributes(reseau,name='link',values=dic_links) +nx.write_gml(reseau,'reseau.gml') \ No newline at end of file |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/Test with Ecoli ntwk/HT.PMID-15690043.EcoliNet.303gene.3446link.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/Test with Ecoli ntwk/HT.PMID-15690043.EcoliNet.303gene.3446link.txt Tue Jun 11 11:42:40 2019 -0400 |
b |
b'@@ -0,0 +1,3446 @@\n+b3339\tb3980\t3.1647\n+b3231\tb3315\t3.1647\n+b3303\tb3341\t3.1647\n+b3231\tb3320\t3.16469999999999\n+b3303\tb3315\t3.16469999999999\n+b3320\tb3341\t3.16469999999999\n+b3303\tb3314\t3.16469999999996\n+b0169\tb3231\t3.16469999999996\n+b0169\tb3303\t3.16469999999993\n+b3315\tb3320\t3.16469999999992\n+b3303\tb3320\t3.16469999999992\n+b3319\tb3320\t3.16469999999991\n+b3315\tb3319\t3.16469999999944\n+b0169\tb3321\t3.16469999999928\n+b3231\tb3303\t3.16469999999919\n+b2606\tb3315\t3.16469999999884\n+b0169\tb3315\t3.16469999999872\n+b3314\tb3341\t3.1646999999987\n+b3186\tb3231\t3.16469999999805\n+b3319\tb3341\t3.1646999999976\n+b3314\tb3317\t3.16469999999751\n+b3231\tb3319\t3.16469999999592\n+b3296\tb3320\t3.1646999999938\n+b3317\tb3341\t3.16469999999279\n+b3314\tb3315\t3.16469999999273\n+b3315\tb3341\t3.16469999999202\n+b3296\tb3314\t3.16469999999175\n+b3317\tb3319\t3.16469999999143\n+b3231\tb3341\t3.16469999999119\n+b2606\tb3231\t3.16469999999052\n+b0169\tb3319\t3.16469999998822\n+b3303\tb3319\t3.16469999998807\n+b2606\tb3303\t3.16469999998564\n+b0115\tb0116\t3.16469999997865\n+b2606\tb3320\t3.16469999996752\n+b2606\tb3341\t3.16469999996027\n+b3186\tb3315\t3.16469999995693\n+b3186\tb3320\t3.16469999994988\n+b3314\tb3320\t3.16469999993021\n+b3186\tb3341\t3.16469999992507\n+b0169\tb3320\t3.16469999988637\n+b0169\tb3341\t3.16469999987472\n+b2606\tb3319\t3.16469999986741\n+b3303\tb3317\t3.16469999985351\n+b3186\tb3319\t3.16469999974908\n+b3296\tb3303\t3.16469999970367\n+b3309\tb3317\t3.16469999968259\n+b3315\tb4203\t3.1646999996631\n+b2606\tb4203\t3.16469999959968\n+b3987\tb3988\t3.16469999957317\n+b3296\tb3317\t3.16469999947362\n+b3303\tb3984\t3.16469999944659\n+b3314\tb4203\t3.16469999935562\n+b3314\tb3319\t3.16469999909081\n+b3231\tb4203\t3.16469999884564\n+b3303\tb3321\t3.16469999879511\n+b0023\tb3314\t3.16469999861919\n+b3296\tb3341\t3.16469999861624\n+b3341\tb4203\t3.16469999849088\n+b3231\tb3314\t3.16469999848833\n+b3309\tb3314\t3.16469999846604\n+b3296\tb3319\t3.16469999840274\n+b0023\tb3303\t3.16469999835301\n+b3315\tb3317\t3.16469999798292\n+b3341\tb4200\t3.16469999787123\n+b3309\tb3315\t3.16469999778476\n+b3317\tb3320\t3.1646999977067\n+b3315\tb3637\t3.16469999723005\n+b3298\tb3341\t3.16469999704577\n+b2606\tb3309\t3.16469999693346\n+b3298\tb3303\t3.16469999628907\n+b3231\tb3321\t3.1646999957635\n+b3303\tb3309\t3.16469999562041\n+b2606\tb3314\t3.16469999553578\n+b2606\tb3984\t3.16469999486285\n+b3315\tb3321\t3.16469999459508\n+b3320\tb3321\t3.16469999373456\n+b3309\tb4203\t3.16469999185147\n+b0911\tb3341\t3.16469999056528\n+b3341\tb3984\t3.16469998643138\n+b3319\tb3986\t3.16469998542084\n+b2606\tb3317\t3.16469998390683\n+b3303\tb4203\t3.16469998064047\n+b3320\tb3984\t3.16469998038824\n+b0023\tb3296\t3.16469997446399\n+b2606\tb3186\t3.16469997319301\n+b3303\tb3307\t3.16469997309467\n+b3231\tb3637\t3.1646999675319\n+b3309\tb3319\t3.16469996749004\n+b3320\tb4203\t3.16469996693238\n+b3296\tb3984\t3.16469996585103\n+b0169\tb3986\t3.16469996435495\n+b0911\tb3303\t3.16469996421159\n+b3307\tb3341\t3.164699954667\n+b2606\tb3296\t3.16469995096682\n+b3303\tb4000\t3.16469994501189\n+b3231\tb3309\t3.1646999343459\n+b3303\tb4200\t3.16469992354203\n+b3309\tb3341\t3.16469991718186\n+b3186\tb3314\t3.1646999094854\n+b3319\tb3984\t3.16469989951807\n+b3315\tb3984\t3.16469989336847\n+b1269\tb3317\t3.16469988143578\n+b3319\tb4203\t3.16469987224518\n+b3186\tb3303\t3.16469986365128\n+b2606\tb3637\t3.16469985310924\n+b3186\tb3296\t3.16469983784806\n+b0911\tb3320\t3.16469982975331\n+b3296\tb3309\t3.16469982875205\n+b0023\tb3341\t3.16469982614553\n+b3309\tb3320\t3.16469982066383\n+b0911\tb3314\t3.1646998164116\n+b3295\tb3987\t3.16469980323975\n+b2606\tb4000\t3.16469975203256\n+b0023\tb3298\t3.16469974240779\n+b1269\tb3309\t3.16469973722059\n+b3341\tb4000\t3.16469972332077\n+b3307\tb3315\t3.16469971766043\n+b0169\tb3314\t3.16469969141019\n+b3295\tb3988\t3.16469967893906\n+b3314\tb3984\t3.16469964758724\n+b0169\tb2606\t3.16469962372767\n+b3231\tb3984\t3.16469959153254\n+b3231\tb3317\t3.16469958644418\n+b0023\tb3231\t3.16469958276629\n+b3317\tb4203\t3.16469957159366\n+b3298\tb3315\t3.1646995686763\n+b3303\tb3637\t3.16469954341231\n+b3301\tb3317\t3.16469952316735\n+b3298\tb3317\t3.16469951997822\n+b3296\tb3315\t3.16469951396957\n+b0023\tb3317\t3.16469949351217\n+b3298\tb3314\t3.16469946468519\n+b3317\tb3984\t3.16469941958101\n+b0'..b'b0882\t1.51943026870899\n+b0436\tb3987\t1.51937735705727\n+b0169\tb0595\t1.518655905144\n+b0169\tb1623\t1.518655905144\n+b0169\tb2095\t1.518655905144\n+b3180\tb3986\t1.51863102325463\n+b3313\tb3649\t1.51815171762516\n+b0924\tb3304\t1.51815171762515\n+b2200\tb3313\t1.51815171762515\n+b0086\tb3349\t1.51788617947952\n+b0241\tb3054\t1.51788617947952\n+b2779\tb3247\t1.51788617947952\n+b3310\tb3342\t1.5177171792625\n+b3342\tb4202\t1.5177171792625\n+b4187\tb4202\t1.5177171792625\n+b3306\tb3619\t1.51745382348627\n+b3637\tb3983\t1.51744429062587\n+b1763\tb3317\t1.51528625015476\n+b0178\tb0948\t1.51484073845061\n+b0948\tb2185\t1.51484073845061\n+b0440\tb3983\t1.51431636822986\n+b0882\tb3304\t1.51352226291011\n+b2095\tb3985\t1.51189978281942\n+b3255\tb3985\t1.51189978281942\n+b0023\tb1682\t1.50916207898684\n+b2606\tb3822\t1.50841210288506\n+b0595\tb2606\t1.50841210288506\n+b0015\tb3619\t1.50627142648359\n+b3988\tb4187\t1.50574491834112\n+b3230\tb3636\t1.50419558402969\n+b0528\tb3307\t1.50244795734907\n+b3318\tb3783\t1.50241995449816\n+b3056\tb3986\t1.50182600116282\n+b0877\tb3619\t1.50068179965905\n+b0882\tb2581\t1.49971915394727\n+b0185\tb3168\t1.49901474173201\n+b0015\tb1413\t1.4969119248087\n+b0015\tb3054\t1.4969119248087\n+b1682\tb2609\t1.49449736096983\n+b0911\tb3983\t1.49338008258964\n+b1269\tb3310\t1.49220986784606\n+b0085\tb3986\t1.49031060391909\n+b0114\tb3301\t1.49027368534478\n+b4172\tb4203\t1.48953933864823\n+b2942\tb3298\t1.48901327069979\n+b1237\tb3863\t1.48891262139061\n+b2523\tb2526\t1.48891262139061\n+b0912\tb1237\t1.48891262139061\n+b0990\tb4172\t1.48891262139061\n+b2093\tb2592\t1.48891262139061\n+b0882\tb0924\t1.48863956227001\n+b0882\tb3699\t1.48863956227001\n+b0882\tb3732\t1.48863956227001\n+b2779\tb3186\t1.48725645064198\n+b0660\tb2585\t1.48623500942828\n+b0797\tb0948\t1.48277094836205\n+b0880\tb0948\t1.48277094836205\n+b0948\tb3809\t1.48277094836205\n+b3305\tb3809\t1.48277094836205\n+b0948\tb3306\t1.48186531807879\n+b0095\tb2096\t1.48163188797989\n+b3230\tb3342\t1.48108480519363\n+b3296\tb3780\t1.48100816416622\n+b0623\tb3296\t1.48100816416622\n+b0680\tb3296\t1.48100816416622\n+b1135\tb3296\t1.48100816416622\n+b0119\tb3988\t1.48019814712982\n+b3988\tb3991\t1.48019814712982\n+b2585\tb3295\t1.47702829725752\n+b3294\tb3295\t1.47702829725752\n+b0098\tb3180\t1.47428188194015\n+b1716\tb3321\t1.47359660443364\n+b3164\tb3251\t1.47343992178165\n+b3186\tb3987\t1.47322301495496\n+b3231\tb4172\t1.47144940170303\n+b2200\tb3303\t1.46819750842449\n+b0014\tb3349\t1.46782451801609\n+b0607\tb3987\t1.46664246373576\n+b1557\tb3701\t1.46563121013138\n+b3556\tb3701\t1.46563121013138\n+b0184\tb3984\t1.46540289412789\n+b3231\tb3590\t1.46402984739839\n+b3251\tb3986\t1.46346789200826\n+b3983\tb4202\t1.46328615210449\n+b0015\tb3305\t1.46230359590555\n+b0116\tb3310\t1.46099226045509\n+b3619\tb4255\t1.46059741878698\n+b3056\tb3310\t1.46011682224595\n+b3165\tb3310\t1.46011682224595\n+b3310\tb3650\t1.46011682224595\n+b3231\tb3417\t1.45973341753979\n+b2942\tb3312\t1.45879145562468\n+b0215\tb3822\t1.45763265572298\n+b0607\tb1623\t1.45763265572298\n+b0595\tb3517\t1.45763265572298\n+b2614\tb3256\t1.45763265572298\n+b2614\tb3517\t1.45763265572298\n+b3822\tb4372\t1.45763265572298\n+b0393\tb3417\t1.45692836333558\n+b0661\tb3725\t1.45692836333558\n+b2286\tb3725\t1.45692836333558\n+b1207\tb3296\t1.45448972383809\n+b2585\tb3987\t1.45406520901918\n+b3294\tb3987\t1.45406520901918\n+b2581\tb3349\t1.45401934741222\n+b2231\tb3321\t1.45393170069214\n+b0115\tb1274\t1.45345922215829\n+b0115\tb1763\t1.45345922215829\n+b0406\tb0911\t1.45263740971584\n+b1682\tb3298\t1.45263740971584\n+b1712\tb3298\t1.45263740971584\n+b1237\tb3341\t1.45138795928606\n+b3341\tb4172\t1.45138795928606\n+b0095\tb3339\t1.45115023758803\n+b1685\tb3339\t1.45115023758803\n+b3339\tb3687\t1.45115023758803\n+b0015\tb3185\t1.44963311895914\n+b0015\tb3590\t1.44963311895914\n+b0015\tb4035\t1.44963311895914\n+b2527\tb3312\t1.4492036240979\n+b3312\tb4290\t1.4492036240979\n+b1779\tb2926\t1.44788898381194\n+b1779\tb4168\t1.44788898381194\n+b0528\tb4187\t1.44788898381194\n+b2520\tb3342\t1.44788898381194\n+b2779\tb3320\t1.44786385776071\n+b2699\tb3984\t1.44767384678351\n+b3341\tb3590\t1.44752696906744\n+b3341\tb3602\t1.44752696906744\n+b2576\tb3636\t1.44691701651116\n+b2942\tb3636\t1.44691701651116\n+b2779\tb3316\t1.44657815007648\n+b0185\tb1413\t1.44657815007648\n+b0014\tb3983\t1.4460153498554\n' |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/__pycache__/__init__.cpython-37.pyc |
b |
Binary file rpviz/__pycache__/__init__.cpython-37.pyc has changed |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/__pycache__/main.cpython-37.pyc |
b |
Binary file rpviz/__pycache__/main.cpython-37.pyc has changed |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/__pycache__/network2json.cpython-37.pyc |
b |
Binary file rpviz/__pycache__/network2json.cpython-37.pyc has changed |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/__pycache__/py2html2.cpython-37.pyc |
b |
Binary file rpviz/__pycache__/py2html2.cpython-37.pyc has changed |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/__pycache__/sbml2lists.cpython-37.pyc |
b |
Binary file rpviz/__pycache__/sbml2lists.cpython-37.pyc has changed |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/__pycache__/smile2picture.cpython-37.pyc |
b |
Binary file rpviz/__pycache__/smile2picture.cpython-37.pyc has changed |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/csv_network.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/csv_network.py Tue Jun 11 11:42:40 2019 -0400 |
[ |
@@ -0,0 +1,60 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed May 29 17:23:04 2019 + +@author: anael +Read the output of retropath +To visualize a csv file +""" + +import csv +import argparse +import os + +def arguments(): + parser = argparse.ArgumentParser(description='Visualizing a network from csv') + parser.add_argument('infile', + help='Input csv file.') + #parser.add_argument('outfile', + # help='Input some file.') + return parser + +parser = arguments() +arg = parser.parse_args() + +assert os.path.exists('infile/'+arg.infile) +file='infile/'+arg.infile +data=csv.reader(open(file)) +tab=[] +for ligne in data : + tab.append(ligne) + +List=[] #List of different number of pathways in the file +for i in range(1,len(tab)): + List.append(int(tab[i][0])) + List=list(set(List)) + List.sort() +for i in range(len(List)) : + nb=int(List[i]) + name=file+str(nb) + LR=[] + Lreact=[] + Lprod=[] + for i in range(len(tab)): + if tab[i][0]==str(nb) :#we chose the pathway + LR.append(tab[i][2]) #reaction = Unique ID + Lreact.append(tab[i][3].split(":")) + Lprod.append([tab[i][4]]) + #print('LR = '+ str(LR)) + #print('Lreact = '+ str(Lreact)) + #print('Lprod = '+ str(Lprod)) + #from nxvisualizer import network + #network(LR,Lreact,Lprod,name) + from network2json import network2 #to convert the lists in a json network + network2(LR,Lreact,Lprod,name) + + + + + + \ No newline at end of file |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/images_report/node diagram.png |
b |
Binary file rpviz/images_report/node diagram.png has changed |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/images_report/script diagram.png |
b |
Binary file rpviz/images_report/script diagram.png has changed |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/images_report/workflow.PNG |
b |
Binary file rpviz/images_report/workflow.PNG has changed |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/main.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/main.py Tue Jun 11 11:42:40 2019 -0400 |
[ |
@@ -0,0 +1,56 @@ +# -*- coding: utf-8 -*- +""" +Created on Mon Jun 10 11:48:55 2019 + +@author: anael +""" + +import argparse +import os +from .sbml2lists import sbml2list +from .network2json import network2 +from .py2html2 import html2 + +def arguments(): + parser = argparse.ArgumentParser(description='Visualizing a network from sbml') + parser.add_argument('inputfolder', + help='Input folder with sbml files.') + parser.add_argument('outfile', + help='html file.') + return parser + +def run(infolder,outfile,test=True): + + if test: + folders=[infolder] + else: + folders=os.listdir(infolder) + json_elements={} + for f in folders: + if test: + file=f + else: + file=os.path.join(infolder,f) + output=sbml2list(file) + LR=output[0] + Lreact=output[1] + Lprod=output[2] + name=output[3] + species_smiles=output[4] + images=output[5] + species_names=output[6] + species_links=output[7] + + #from smile2picture import picture + #image=picture(species_smiles) + + + json_elements[name]=network2(LR,Lreact,Lprod,name,species_smiles,images,species_names,species_links) + + + html2(json_elements,outfile) + +if __name__ == '__main__': + parser = arguments() + arg = parser.parse_args() + run(arg.inputfolder,arg.outfile) |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/network2json.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/network2json.py Tue Jun 11 11:42:40 2019 -0400 |
[ |
@@ -0,0 +1,61 @@ +# -*- coding: utf-8 -*- +""" +Created on Thu May 30 16:23:33 2019 + +@author: anael +""" + +import networkx as nx +import json + + + +def network2(LR,Lreact,Lprod,name,smile,image,spname,splinks): + ###Create the network with networkx + G=nx.DiGraph() + G.add_nodes_from(LR) #add reactions nodes + + + for i in range(len(LR)): + for j in range(len(Lreact[i])): + G.add_edge(Lreact[i][j],LR[i]) #add reactants nodes + for k in range(len(Lprod[i])): + G.add_edge(LR[i],Lprod[i][k]) #add products nodes + + #Attribute category + + dic_types={} + for i in range(len(LR)): + dic_types[(list(G.nodes))[i]]='reactions' + for node in range(len(list(G.nodes))): + if list(G.nodes)[node] in Lprod[i]: + dic_types[list(G.nodes)[node]]='product' + if list(G.nodes)[node] not in dic_types: + dic_types[list(G.nodes)[node]]='reactant' + nx.set_node_attributes(G,name='category',values=dic_types) + nx.draw(G) + + #Attribute smile + nx.set_node_attributes(G, name='smiles', values=smile) + + #Attribute image + nx.set_node_attributes(G,name='image', values=image) + + #Attribute name + nx.set_node_attributes(G,name='name', values=spname) + + #Attribute link + nx.set_node_attributes(G,name="link",values=splinks) + + js = nx.readwrite.json_graph.cytoscape_data(G) + json_elements=json.dumps(js) + + return(json_elements) + #file = os.path.join('file_json',name+'.json') + #json.dump(js,open(file,'w')) #doesn't work on Windows + + #from py2html import html + #html(file, name) + + #from py2html2 import html2 + #html2(file,name) \ No newline at end of file |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/new_html/cytoscape.min.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/new_html/cytoscape.min.js Tue Jun 11 11:42:40 2019 -0400 |
[ |
b'@@ -0,0 +1,23 @@\n+/**\n+ * Copyright (c) 2016-2019, The Cytoscape Consortium.\n+ *\n+ * Permission is hereby granted, free of charge, to any person obtaining a copy of\n+ * this software and associated documentation files (the \xe2\x80\x9cSoftware\xe2\x80\x9d), to deal in\n+ * the Software without restriction, including without limitation the rights to\n+ * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies\n+ * of the Software, and to permit persons to whom the Software is furnished to do\n+ * so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice shall be included in all\n+ * copies or substantial portions of the Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \xe2\x80\x9cAS IS\xe2\x80\x9d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n+ * SOFTWARE.\n+ */\n+\n+!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).cytoscape=t()}(this,function(){"use strict";function e(t){return(e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(t)}function t(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function n(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}function r(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),e}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],r=!0,i=!1,a=void 0;try{for(var o,s=e[Symbol.iterator]();!(r=(o=s.next()).done)&&(n.push(o.value),!t||n.length!==t);r=!0);}catch(e){i=!0,a=e}finally{try{r||null==s.return||s.return()}finally{if(i)throw a}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}var a="undefined"==typeof window?null:window,o=a?a.navigator:null,s=(a&&a.document,e("")),l=e({}),u=e(function(){}),c="undefined"==typeof HTMLElement?"undefined":e(HTMLElement),h=function(e){return e&&e.instanceString&&p(e.instanceString)?e.instanceString():null},d=function(t){return null!=t&&e(t)==s},p=function(t){return null!=t&&e(t)===u},f=function(e){return Array.isArray?Array.isArray(e):null!=e&&e instanceof Array},g=function(t){return null!=t&&e(t)===l&&!f(t)&&t.constructor===Object},v=function(t){return null!=t&&e(t)===e(1)&&!isNaN(t)},y=function(e){return"undefined"===c?void 0:null!=e&&e instanceof HTMLElement},m=function(e){return b(e)||x(e)},b=function(e){return"collection"===h(e)&&e._private.single},x=function(e){return"collection"===h(e)&&!e._private.single},w=function(e){return"core"===h(e)},E=function(e){return"stylesheet"===h(e)},k=function(e){return null==e||!(""!==e&&!e.match(/^\\s+$/))},C=function(t){return function(t){return null!=t&&e(t)===l}(t)&&p(t.then)},S=function(){return o&&o.userAgent.match(/msie|trident|edge/i)},D=function(e,t){t||(t=function(){if(1===arguments.length)return arguments[0];if(0===arguments.length)return"undefined";for(var e=[],t=0;t<arguments.length;t++)e.push(arguments[t]);return e.join("$")});var n=function n(){var r,i=arguments,a=t.apply(this,i),o=n.cache;return(r=o[a])||(r=o[a]=e.apply(this,i)),r};return n.cache={},n},P=D(function(e){return e.replace(/([A-Z])/g,function(e){return"-"+e.toLowerCase()})}),T=D(function(e){return e.replace(/(-\\w)/g,function(e){return e[1].toUpperCase()})}),M=D(function(e,t){return e+t[0].toUpperCase()+t.substring(1)},function(e,t){return e+"$"+t}),_=function(e){return k(e)'..b')?r=new OffscreenCanvas(t,n):((r=document.createElement("canvas")).width=t,r.height=n),r},[ts,os,hs,ds,ps,fs,gs,vs,ks,Ds].forEach(function(e){I(Ts,e)});var Bs=[{type:"layout",extensions:mo},{type:"renderer",extensions:[{name:"null",impl:bo},{name:"base",impl:Yo},{name:"canvas",impl:Ps}]}],Ns={},Is={};function zs(e,t,n){var r=n,i=function(n){Ee("Can not register `"+t+"` for `"+e+"` since `"+n+"` already exists in the prototype and can not be overridden")};if("core"===e){if(Wa.prototype[t])return i(t);Wa.prototype[t]=n}else if("collection"===e){if(ua.prototype[t])return i(t);ua.prototype[t]=n}else if("layout"===e){for(var a=function(e){this.options=e,n.call(this,e),g(this._private)||(this._private={}),this._private.cy=e.cy,this._private.listeners=[],this.createEmitter()},o=a.prototype=Object.create(n.prototype),s=[],l=0;l<s.length;l++){var u=s[l];o[u]=o[u]||function(){return this}}o.start&&!o.run?o.run=function(){return this.start(),this}:!o.start&&o.run&&(o.start=function(){return this.run(),this});var c=n.prototype.stop;o.stop=function(){var e=this.options;if(e&&e.animate){var t=this.animations;if(t)for(var n=0;n<t.length;n++)t[n].stop()}return c?c.call(this):this.emit("layoutstop"),this},o.destroy||(o.destroy=function(){return this}),o.cy=function(){return this._private.cy};var h=function(e){return e._private.cy},d={addEventFields:function(e,t){t.layout=e,t.cy=h(e),t.target=e},bubble:function(){return!0},parent:function(e){return h(e)}};I(o,{createEmitter:function(){return this._private.emitter=new Pi(d,this),this},emitter:function(){return this._private.emitter},on:function(e,t){return this.emitter().on(e,t),this},one:function(e,t){return this.emitter().one(e,t),this},once:function(e,t){return this.emitter().one(e,t),this},removeListener:function(e,t){return this.emitter().removeListener(e,t),this},emit:function(e,t){return this.emitter().emit(e,t),this}}),Un.eventAliasesOn(o),r=a}else if("renderer"===e&&"null"!==t&&"base"!==t){var p=As("renderer","base"),f=p.prototype,v=n,y=n.prototype,m=function(){p.apply(this,arguments),v.apply(this,arguments)},b=m.prototype;for(var x in f){var w=f[x];if(null!=y[x])return i(x);b[x]=w}for(var E in y)b[E]=y[E];f.clientFunctions.forEach(function(e){b[e]=b[e]||function(){Ee("Renderer does not implement `renderer."+e+"()` on its prototype")}}),r=m}return L({map:Ns,keys:[e,t],value:r})}function As(e,t){return O({map:Ns,keys:[e,t]})}var Ls=function(){return 2===arguments.length?As.apply(null,arguments):3===arguments.length?zs.apply(null,arguments):4===arguments.length?function(e,t,n,r){return O({map:Is,keys:[e,t,n,r]})}.apply(null,arguments):5===arguments.length?function(e,t,n,r,i){return L({map:Is,keys:[e,t,n,r],value:i})}.apply(null,arguments):void Ee("Invalid extension access syntax")};Wa.prototype.extension=Ls,Bs.forEach(function(e){e.extensions.forEach(function(t){zs(e.type,t.name,t.impl)})});var Os=function e(){if(!(this instanceof e))return new e;this.length=0},Rs=Os.prototype;Rs.instanceString=function(){return"stylesheet"},Rs.selector=function(e){return this[this.length++]={selector:e,properties:[]},this},Rs.css=function(e,t){var n=this.length-1;if(d(e))this[n].properties.push({name:e,value:t});else if(g(e))for(var r=e,i=Object.keys(r),a=0;a<i.length;a++){var o=i[a],s=r[o];if(null!=s){var l=qa.properties[o]||qa.properties[T(o)];if(null!=l){var u=l.name,c=s;this[n].properties.push({name:u,value:c})}}}return this},Rs.style=Rs.css,Rs.generateStyle=function(e){var t=new qa(e);return this.appendToStyle(t)},Rs.appendToStyle=function(e){for(var t=0;t<this.length;t++){var n=this[t],r=n.selector,i=n.properties;e.selector(r);for(var a=0;a<i.length;a++){var o=i[a];e.css(o.name,o.value)}}return e};var Fs=function(e){return void 0===e&&(e={}),g(e)?new Wa(e):d(e)?Ls.apply(Ls,arguments):void 0};return Fs.use=function(e){var t=Array.prototype.slice.call(arguments,1);return t.unshift(Fs),e.apply(null,t),this},Fs.warnings=function(e){return ke(e)},Fs.version="3.5.0",Fs.stylesheet=Fs.Stylesheet=Os,Fs});\n' |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/new_html/output.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/new_html/output.html Tue Jun 11 11:42:40 2019 -0400 |
[ |
@@ -0,0 +1,112 @@ +<!DOCTYPE doctype html> +<html> + <head> + <meta charset="utf-8"/> + <title> + Viewer + </title> + <script id="elements"> + var rp_3={'nodes': [{'data': {'category': 'reactions', 'id': '<Reaction RP2>', 'value': '<Reaction RP2>', 'name': '<Reaction RP2>'}}, {'data': {'category': 'reactions', 'id': '<Reaction RP1>', 'value': '<Reaction RP1>', 'name': '<Reaction RP1>'}}, {'data': {'category': 'reactions', 'id': '<Reaction RP0>', 'value': '<Reaction RP0>', 'name': '<Reaction RP0>'}}, {'data': {'category': 'reactions', 'id': '<Reaction targetSink>', 'value': '<Reaction targetSink>', 'name': '<Reaction targetSink>'}}, {'data': {'category': 'reactant', 'name': '4-hydroxybenzoate', 'link': 'http://identifiers.org/metanetx.chemical/MNXM164', 'id': 'MNXM164__64__MNXC3', 'value': 'MNXM164__64__MNXC3'}}, {'data': {'category': 'reactant', 'name': 'H2O', 'link': 'http://identifiers.org/metanetx.chemical/MNXM2', 'id': 'MNXM2__64__MNXC3', 'value': 'MNXM2__64__MNXC3'}}, {'data': {'category': 'product', 'smiles': '[H]OC(=O)c1c([H])c([H])c([H])c([H])c1[H]', 'id': 'CMPD_0000000007__64__MNXC3', 'value': 'CMPD_0000000007__64__MNXC3', 'name': 'CMPD_0000000007__64__MNXC3'}}, {'data': {'category': 'reactant', 'name': 'NADH', 'link': 'http://identifiers.org/metanetx.chemical/MNXM10', 'id': 'MNXM10__64__MNXC3', 'value': 'MNXM10__64__MNXC3'}}, {'data': {'category': 'reactant', 'name': 'O2', 'link': 'http://identifiers.org/metanetx.chemical/MNXM4', 'id': 'MNXM4__64__MNXC3', 'value': 'MNXM4__64__MNXC3'}}, {'data': {'category': 'product', 'smiles': '[H]Oc1c([H])c([H])c([H])c([H])c1O[H]', 'id': 'CMPD_0000000003__64__MNXC3', 'value': 'CMPD_0000000003__64__MNXC3', 'name': 'CMPD_0000000003__64__MNXC3'}}, {'data': {'category': 'product', 'smiles': '[H]OC(=O)C([H])=C([H])C([H])=C([H])C(=O)O[H]', 'id': 'TARGET_0000000001__64__MNXC3', 'value': 'TARGET_0000000001__64__MNXC3', 'name': 'TARGET_0000000001__64__MNXC3'}}], 'edges': [{'data': {'source': '<Reaction RP2>', 'target': 'CMPD_0000000007__64__MNXC3'}}, {'data': {'source': '<Reaction RP1>', 'target': 'CMPD_0000000003__64__MNXC3'}}, {'data': {'source': '<Reaction RP0>', 'target': 'TARGET_0000000001__64__MNXC3'}}, {'data': {'source': 'MNXM164__64__MNXC3', 'target': '<Reaction RP2>'}}, {'data': {'source': 'MNXM2__64__MNXC3', 'target': '<Reaction RP2>'}}, {'data': {'source': 'CMPD_0000000007__64__MNXC3', 'target': '<Reaction RP1>'}}, {'data': {'source': 'MNXM10__64__MNXC3', 'target': '<Reaction RP1>'}}, {'data': {'source': 'MNXM4__64__MNXC3', 'target': '<Reaction RP1>'}}, {'data': {'source': 'MNXM4__64__MNXC3', 'target': '<Reaction RP0>'}}, {'data': {'source': 'CMPD_0000000003__64__MNXC3', 'target': '<Reaction RP0>'}}, {'data': {'source': 'TARGET_0000000001__64__MNXC3', 'target': '<Reaction targetSink>'}}]} + var rp_7={'nodes': [{'data': {'category': 'reactions', 'id': '<Reaction RP2>', 'value': '<Reaction RP2>', 'name': '<Reaction RP2>'}}, {'data': {'category': 'reactions', 'id': '<Reaction RP1>', 'value': '<Reaction RP1>', 'name': '<Reaction RP1>'}}, {'data': {'category': 'reactions', 'id': '<Reaction RP0>', 'value': '<Reaction RP0>', 'name': '<Reaction RP0>'}}, {'data': {'category': 'reactions', 'id': '<Reaction targetSink>', 'value': '<Reaction targetSink>', 'name': '<Reaction targetSink>'}}, {'data': {'category': 'reactant', 'name': 'L-tyrosine', 'link': 'http://identifiers.org/metanetx.chemical/MNXM76', 'id': 'MNXM76__64__MNXC3', 'value': 'MNXM76__64__MNXC3'}}, {'data': {'category': 'product', 'smiles': '[H]Oc1c([H])c([H])c([H])c([H])c1[H]', 'id': 'CMPD_0000000009__64__MNXC3', 'value': 'CMPD_0000000009__64__MNXC3', 'name': 'CMPD_0000000009__64__MNXC3'}}, {'data': {'category': 'reactant', 'name': 'O2', 'link': 'http://identifiers.org/metanetx.chemical/MNXM4', 'id': 'MNXM4__64__MNXC3', 'value': 'MNXM4__64__MNXC3'}}, {'data': {'category': 'product', 'smiles': '[H]Oc1c([H])c([H])c([H])c([H])c1O[H]', 'id': 'CMPD_0000000003__64__MNXC3', 'value': 'CMPD_0000000003__64__MNXC3', 'name': 'CMPD_0000000003__64__MNXC3'}}, {'data': {'category': 'product', 'smiles': '[H]OC(=O)C([H])=C([H])C([H])=C([H])C(=O)O[H]', 'id': 'TARGET_0000000001__64__MNXC3', 'value': 'TARGET_0000000001__64__MNXC3', 'name': 'TARGET_0000000001__64__MNXC3'}}], 'edges': [{'data': {'source': '<Reaction RP2>', 'target': 'CMPD_0000000009__64__MNXC3'}}, {'data': {'source': '<Reaction RP1>', 'target': 'CMPD_0000000003__64__MNXC3'}}, {'data': {'source': '<Reaction RP0>', 'target': 'TARGET_0000000001__64__MNXC3'}}, {'data': {'source': 'MNXM76__64__MNXC3', 'target': '<Reaction RP2>'}}, {'data': {'source': 'CMPD_0000000009__64__MNXC3', 'target': '<Reaction RP1>'}}, {'data': {'source': 'MNXM4__64__MNXC3', 'target': '<Reaction RP1>'}}, {'data': {'source': 'MNXM4__64__MNXC3', 'target': '<Reaction RP0>'}}, {'data': {'source': 'CMPD_0000000003__64__MNXC3', 'target': '<Reaction RP0>'}}, {'data': {'source': 'TARGET_0000000001__64__MNXC3', 'target': '<Reaction targetSink>'}}]} + </script> + <script id="svg"> + </script> + <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"> + </script> + <script src="cytoscape.min.js"> + </script> + <script> + function displaynet(network){ + var cy = cytoscape({ + container: $('#cy'), + + elements:network + , + + layout: { + name: 'breadthfirst', + //roots: "node[category = 'reactant']" + }, + + style: [ + { + selector: "node", + style: { + "background-color": '#80D0D0', + "label": "data(name)", + "font-size": "7px" + } + }, + {selector: "node[category='reactions']", + style: { + 'background-color': '#FA8072', + 'shape': 'roundrectangle' + }}, + {selector: "node[category='reactant']", + style: { + 'background-color': '#52be80', + }}, + { + selector: 'edge', + style: { + 'curve-style': 'bezier', + 'width': '3px', + 'target-arrow-shape': 'triangle', + } + }] + }); + + cy.on('mouseover','node',function(e){ + var node_select=e.target; + molecule=node_select.data("image"); + if(molecule){ + $("#molecule").attr('src',molecule); + $("#molecule").css( + {"width":"200px", + "height":"200px"});} + }); + cy.on('mouseout','node',function(e){ + $("#molecule").attr('src',""); + $("#molecule").css({ + "width":"", + "height":""}); + }); + + cy.on('tap','node',function(e){ + var node_select=e.target; + console.log(node_select.data("name")); + link=node_select.data("link"); + if(link){ + window.open(link) + }; + }); + }; + + $(function() { + }); + </script> + </head> + <style> + #cy { + width: 80%; + height: 100%; + position: absolute; + left : 20%; + } + + +#molecule{ + position : absolute; +} + </style> + <body> + <div id="cy"> + </div> + <img id="molecule" src=""/> + <form> + Choose a pathway : + <input onclick="displaynet(rp_3)" type="button" value="rp_3"/> + <input onclick="displaynet(rp_7)" type="button" value="rp_7"/> + </form> + </body> +</html> |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/new_html/template2.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/new_html/template2.html Tue Jun 11 11:42:40 2019 -0400 |
[ |
@@ -0,0 +1,106 @@ +<!doctype html> + +<html> + +<head> + <meta charset='utf-8'></meta> + <title>Viewer</title> + <script id="elements"></script> + <script id="svg"></script> + <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> + <script src="https://cdnjs.cloudflare.com/ajax/libs/cytoscape/3.7.0/cytoscape.min.js"></script> + <script> + function displaynet(network){ + var cy = cytoscape({ + container: $('#cy'), + + elements:network + , + + layout: { + name: 'breadthfirst', + //roots: "node[category = 'reactant']" + }, + + style: [ + { + selector: "node", + style: { + "background-color": '#80D0D0', + "label": "data(name)", + "font-size": "7px" + } + }, + {selector: "node[category='reactions']", + style: { + 'background-color': '#FA8072', + 'shape': 'roundrectangle' + }}, + {selector: "node[category='reactant']", + style: { + 'background-color': '#52be80', + }}, + { + selector: 'edge', + style: { + 'curve-style': 'bezier', + 'width': '3px', + 'target-arrow-shape': 'triangle', + } + }] + }); + + cy.on('mouseover','node',function(e){ + var node_select=e.target; + molecule=node_select.data("image"); + if(molecule){ + $("#molecule").attr('src',molecule); + $("#molecule").css( + {"width":"200px", + "height":"200px"});} + }); + cy.on('mouseout','node',function(e){ + $("#molecule").attr('src',""); + $("#molecule").css({ + "width":"", + "height":""}); + }); + + cy.on('tap','node',function(e){ + var node_select=e.target; + console.log(node_select.data("name")); + link=node_select.data("link"); + if(link){ + window.open(link) + }; + }); + }; + + $(function() { + }); + </script> +</head> + +<style> + #cy { + width: 80%; + height: 100%; + position: absolute; + left : 20%; + } + + +#molecule{ + position : absolute; +} + +</style> + +<body> + <div id="cy"></div> + <img id="molecule" src="" /> + <form> + Choose a pathway : + </form> +</body> +</html> |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/nxvisualizer.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/nxvisualizer.py Tue Jun 11 11:42:40 2019 -0400 |
[ |
@@ -0,0 +1,139 @@ +# -*- coding: utf-8 -*- +""" +Created on Thu May 30 10:21:48 2019 + +@author: anael +""" +#Usefull +import inspect +#inspect.getargspec(function) + +import networkx as nx +from IPython.display import Image +import requests +import json +import pandas as pd + +# Library for util +from py2cytoscape.data.cynetwork import CyNetwork +from py2cytoscape.data.cyrest_client import CyRestClient +from py2cytoscape.data.style import StyleUtil + + +def network(LR,Lreact,Lprod,name,smile,image): + ###Create the network with networkx + G=nx.DiGraph() + G.add_nodes_from(LR) #add reactions nodes + + + for i in range(len(LR)): + for j in range(len(Lreact[i])): + G.add_edge(Lreact[i][j],LR[i]) #add reactants nodes + for k in range(len(Lprod[i])): + G.add_edge(LR[i],Lprod[i][k]) #add products nodes + + #Attribute category + + dic_types={} + for i in range(len(LR)): + dic_types[(list(G.nodes))[i]]='reactions' + for node in range(len(list(G.nodes))): + if list(G.nodes)[node] in Lprod[i]: + dic_types[list(G.nodes)[node]]='product' + if list(G.nodes)[node] not in dic_types: + dic_types[list(G.nodes)[node]]='reactant' + print(dic_types) + nx.set_node_attributes(G,name='category',values=dic_types) + + #Attribute smile + nx.set_node_attributes(G, name='smiles', values=smile) + + #Attribute image + nx.set_node_attributes(G,name='image', values=image) + + nx.write_gml(G,name+'.gml') + + #Connect with cytoscape + cy = CyRestClient() + + # Reset + #cy.session.delete() + + #To create the network in cytoscape + network = cy.network.create_from_networkx(G, name=name, collection='My network collection') + print('New network created with py2cytoscape. Its SUID is ' + str(network.get_id())) + + #To get the SUID of all the components of the network + all_suid = cy.network.get_all() + net1 = cy.network.create(all_suid[0]) + print(net1.get_first_view()) + + #Styles + cy.layout.apply(name='hierarchical', network=network) + + # Get all existing Visual Styles + styles = cy.style.get_all() + print(json.dumps(styles, indent=4)) + + + # Get a reference to the existing style + default_style = cy.style.create('default') + print(default_style.get_name()) + + # Get all available Visual Properties + print(len(cy.style.vps.get_all())) + node_vps=cy.style.vps.get_node_visual_props() + edge_vps = cy.style.vps.get_edge_visual_props() + network_vps=cy.style.vps.get_network_visual_props() + print(pd.Series(edge_vps).head()) + print(pd.Series(node_vps).head()) + + + # Create a new style + style1 = cy.style.create("My_style") + print(style1.get_name()) + + + new_defaults = { + # Node defaults + 'NODE_FILL_COLOR': '#00ddee', + 'NODE_SIZE': 20, + 'NODE_BORDER_WIDTH': 0, + 'NODE_LABEL_COLOR': 'black', + + # Edge defaults + 'EDGE_WIDTH': 3, + 'EDGE_STROKE_UNSELECTED_PAINT': '#aaaaaa', + 'EDGE_LINE_TYPE': 'LONG_DASH', + 'EDGE_TARGET_ARROW_SHAPE' : 'DELTA', + + # Network defaults + 'NETWORK_BACKGROUND_PAINT': 'white', + } + + style1.update_defaults(new_defaults) + #Apply style + cy.style.apply(style1, network) + + # Passthrough mapping to get node labels + style1.create_passthrough_mapping(column='name', col_type='String', vp='NODE_LABEL') + + # Discrete mapping for node colours: + cat = { + 'reactant': '#4D833C', + 'product': '#C04E5D' + } + style1.create_discrete_mapping(column='category', + col_type='String', + vp='NODE_FILL_COLOR', + mappings=cat) + + # Discrete mapping for node shape: + reac = { + 'reactions': 'RECTANGLE' + } + style1.create_discrete_mapping(column='category', + col_type='String', + vp='NODE_SHAPE', + mappings=reac) + |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/py2html2.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/py2html2.py Tue Jun 11 11:42:40 2019 -0400 |
[ |
@@ -0,0 +1,45 @@ +# -*- coding: utf-8 -*- +""" +Created on Wed Jun 5 16:07:03 2019 + +@author: anael +""" + +import json +import os +from bs4 import BeautifulSoup + + +def html2(jsondata,outfile): + + htmlfile= open(os.path.join("new_html","template2.html")) + soup = BeautifulSoup(htmlfile, 'html.parser') + + for key in jsondata.keys(): + name=key + obj=json.loads(jsondata[key]) + elements=obj['elements'] + + element_script=soup.find(id="elements") #select the script section containing elements + element_script.append('\n var '+name+'='+str(elements)) #to modify + + form=soup.find('form') + new_tag = soup.new_tag("input") + new_tag["type"] = "button" + new_tag["value"]=name + new_tag["onclick"]="displaynet("+name+')' + form.append(new_tag) + try: + select=soup.find(id="selectbox") + new_tag=soup.new_tag("option") + new_tag["value"]=str(name) + new_tag.append(name) + select.append(new_tag) + except: + continue + + htmlfile.close() + + html = soup.prettify("utf-8") + with open(os.path.join(outfile), "wb") as file: + file.write(html) |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/sbml2lists.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/sbml2lists.py Tue Jun 11 11:42:40 2019 -0400 |
[ |
@@ -0,0 +1,132 @@ +#!/usr/bin/env python +# coding: utf-8 +'''To visualize a SBML file''' +# In[3]: + + +import libsbml +import os +from .smile2picture import picture +#import networkx as nx +#import matplotlib.pyplot as plt + + + +# In[4]: +def sbml2list(file): + + #open the SBML using libsbml + + doc = libsbml.readSBML(file) + name=os.path.basename(file) + + + # In[8]: + + + #return the model from the SBML document using libsbml + model = doc.model + + + # In[9]: + + + #we will use the groups package to return the retropath pathway + #that is all the reactions that are associated with the heterologous + #pathway + groups = model.getPlugin('groups') + + + # In[10]: + + + #in the rpFBA script, rp_pathway is the default name + rp_pathway = groups.getGroup('rp_pathway') + + + # In[63]: + + rlist=[] + LR=[] + + heterologous_pathway_dG_prime_o = {} + + + #loop through all the members of the rp_pathway + for member in rp_pathway.getListOfMembers(): + #fetch the reaction according to the member id + reaction = model.getReaction(member.getIdRef()) + rlist.append(reaction) + LR.append(str(reaction)) + #get the annotation of the reaction + #includes the MIRIAM annotation and the IBISBA ones + annotation = reaction.getAnnotation() + ibisba_annotation = annotation.getChild('RDF').getChild('Ibisba').getChild('ibisba') + #extract one of the ibisba annotation values + heterologous_pathway_dG_prime_o[member.getIdRef()] = ibisba_annotation.getChild('dG_prime_o').getAttrValue('value') + + + + # In[64]: + + heterologous_pathway_dG_prime_o + + Lreact=[] + Lprod=[] + + for reaction in range(len(rlist)): + Lreact.append([p.species for p in rlist[reaction].reactants]) #get list of reactants id + Lprod.append([p.species for p in rlist[reaction].products]) #get list of products id + + mem = [] + for member in rp_pathway.getListOfMembers(): + reac = model.getReaction(member.getIdRef()) + for pro in reac.getListOfProducts(): + mem.append(pro.getSpecies()) + Lprod.append(pro.getSpecies()) + for rea in reac.getListOfReactants(): + mem.append(rea.getSpecies()) + Lreact.append(rea.getSpecies()) + + #mem = list(set([i for i in mem if i[0:3]!='MNX'])) + species_smiles = {} + species_links={} + species_names={} + #loop through all the members of the rp_pathway + for member in list(set([i for i in mem])): + #fetch the species according to the member id + reaction = model.getSpecies(member) + spname=reaction.getName() + if spname: + species_names[member]=spname + #get the annotation of the species + #includes the MIRIAM annotation and the IBISBA ones + annotation = reaction.getAnnotation() + ibisba_annotation = annotation.getChild('RDF').getChild('Ibisba').getChild('ibisba') + #extract one of the ibisba annotation values + smiles = ibisba_annotation.getChild('smiles').getChild(0).toXMLString() + if smiles: + species_smiles[member] = smiles + link_annotation=annotation.getChild('RDF').getChild('Description').getChild('is').getChild('Bag') + for i in range(link_annotation.getNumChildren()): + str_annot = link_annotation.getChild(i).getAttrValue(0) #Here we get the attribute at location "0". It works since there is only one + if str_annot.split('/')[-2]=='metanetx.chemical': + species_links[member]=str_annot #here is the MNX code returned + + + # In[64]: + + image=picture(species_smiles) + + return(LR, Lreact, Lprod, name, species_smiles,image, species_names, species_links) + + + + + #Cytoscape Network + #from nxvisualizer import network + #network(LR,Lreact,Lprod,name,species_smiles,image) + + #Convert network to json file + #from network2json import network2 #to convert the lists in a json network + #network2(LR,Lreact,Lprod,name,species_smiles,image,species_names,species_links) \ No newline at end of file |
b |
diff -r 785b6253af1f -r fe78fd6b315a rpviz/smile2picture.py --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/rpviz/smile2picture.py Tue Jun 11 11:42:40 2019 -0400 |
[ |
@@ -0,0 +1,26 @@ +# -*- coding: utf-8 -*- +""" +Created on Fri May 31 13:29:59 2019 + +@author: anael +""" + +from __future__ import print_function +from rdkit import Chem +from rdkit.Chem import rdDepictor +from rdkit.Chem.Draw import rdMolDraw2D + + +def picture(smile): + image={} + for i in smile : + mol = Chem.MolFromSmiles(smile[i]) + rdDepictor.Compute2DCoords(mol) + drawer = rdMolDraw2D.MolDraw2DSVG(200,200) + drawer.DrawMolecule(mol) + drawer.FinishDrawing() + svg = drawer.GetDrawingText() + image[i]=svg.split("?>\n")[1] + return(image) + + |