Mercurial > repos > sybila > ebcsgen_sbml_export
comparison ebcsgen_sbml_export.py @ 0:2f3f67415022 draft
planemo upload for repository https://github.com/sybila/galaxytools/tree/master/tools/ebcsgen commit 74a375c33936106a892dafb042be953a943af026
author | sybila |
---|---|
date | Sat, 08 Oct 2022 12:55:26 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:2f3f67415022 |
---|---|
1 import argparse | |
2 | |
3 from eBCSgen.Errors.ModelParsingError import ModelParsingError | |
4 from eBCSgen.Errors.UnspecifiedParsingError import UnspecifiedParsingError | |
5 from eBCSgen.Parsing.ParseBCSL import Parser | |
6 | |
7 import libsbml | |
8 | |
9 | |
10 args_parser = argparse.ArgumentParser(description='Export SBML model with usage of SBML-multi package') | |
11 | |
12 args_parser._action_groups.pop() | |
13 required = args_parser.add_argument_group('required arguments') | |
14 | |
15 required.add_argument('--model', type=str, required=True) | |
16 required.add_argument('--output', type=str, required=True) | |
17 | |
18 args = args_parser.parse_args() | |
19 | |
20 model_parser = Parser("model") | |
21 model_str = open(args.model, "r").read() | |
22 | |
23 model = model_parser.parse(model_str) | |
24 if model.success: | |
25 document = model.data.export_sbml() | |
26 libsbml.writeSBMLToFile(document, args.output) | |
27 else: | |
28 if "error" in model.data: | |
29 raise UnspecifiedParsingError(model.data["error"]) | |
30 raise ModelParsingError(model.data, model_str) |