comparison rpviz/main.py @ 16:fe78fd6b315a draft

planemo upload commit 87db86a34f2d92eb2c9756bf9ee53ae2970554d5
author pablocarb
date Tue, 11 Jun 2019 11:42:40 -0400
parents
children
comparison
equal deleted inserted replaced
15:785b6253af1f 16:fe78fd6b315a
1 # -*- coding: utf-8 -*-
2 """
3 Created on Mon Jun 10 11:48:55 2019
4
5 @author: anael
6 """
7
8 import argparse
9 import os
10 from .sbml2lists import sbml2list
11 from .network2json import network2
12 from .py2html2 import html2
13
14 def arguments():
15 parser = argparse.ArgumentParser(description='Visualizing a network from sbml')
16 parser.add_argument('inputfolder',
17 help='Input folder with sbml files.')
18 parser.add_argument('outfile',
19 help='html file.')
20 return parser
21
22 def run(infolder,outfile,test=True):
23
24 if test:
25 folders=[infolder]
26 else:
27 folders=os.listdir(infolder)
28 json_elements={}
29 for f in folders:
30 if test:
31 file=f
32 else:
33 file=os.path.join(infolder,f)
34 output=sbml2list(file)
35 LR=output[0]
36 Lreact=output[1]
37 Lprod=output[2]
38 name=output[3]
39 species_smiles=output[4]
40 images=output[5]
41 species_names=output[6]
42 species_links=output[7]
43
44 #from smile2picture import picture
45 #image=picture(species_smiles)
46
47
48 json_elements[name]=network2(LR,Lreact,Lprod,name,species_smiles,images,species_names,species_links)
49
50
51 html2(json_elements,outfile)
52
53 if __name__ == '__main__':
54 parser = arguments()
55 arg = parser.parse_args()
56 run(arg.inputfolder,arg.outfile)