changeset 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 dd81687ca1a3
files ebcsgen_sbml_export.py ebcsgen_sbml_export.xml macros.xml test-data/simple.bcsl.model
diffstat 4 files changed, 95 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ebcsgen_sbml_export.py	Sat Oct 08 12:55:26 2022 +0000
@@ -0,0 +1,30 @@
+import argparse
+
+from eBCSgen.Errors.ModelParsingError import ModelParsingError
+from eBCSgen.Errors.UnspecifiedParsingError import UnspecifiedParsingError
+from eBCSgen.Parsing.ParseBCSL import Parser
+
+import libsbml
+
+
+args_parser = argparse.ArgumentParser(description='Export SBML model with usage of SBML-multi package')
+
+args_parser._action_groups.pop()
+required = args_parser.add_argument_group('required arguments')
+
+required.add_argument('--model', type=str, required=True)
+required.add_argument('--output', type=str, required=True)
+
+args = args_parser.parse_args()
+
+model_parser = Parser("model")
+model_str = open(args.model, "r").read()
+
+model = model_parser.parse(model_str)
+if model.success:
+    document = model.data.export_sbml()
+    libsbml.writeSBMLToFile(document, args.output)
+else:
+    if "error" in model.data:
+        raise UnspecifiedParsingError(model.data["error"])
+    raise ModelParsingError(model.data, model_str)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ebcsgen_sbml_export.xml	Sat Oct 08 12:55:26 2022 +0000
@@ -0,0 +1,41 @@
+<tool id="eBCSgen_SBML_export" name="eBCSgen SBML export" version="@TOOL_VERSION@_galaxy0">
+    <description>- export given BCSL model to SBML employing multi package</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="creator"/>
+    <requirements>
+        <container type="docker">sybila/ebcsgen:v@TOOL_VERSION@</container>
+    </requirements>
+
+    <options sanitize="False"/>
+    <command>python3 ${__tool_directory__}/ebcsgen_sbml_export.py
+        --model '$model'
+        --output '$output'
+    </command>
+
+    <inputs>
+        <param format="bcsl.model" name="model" type="data" label="Model file" help="Provide a BCSL model file"/>
+    </inputs>
+
+    <outputs>
+        <data format="xml" name="output"/>
+    </outputs>
+
+    <tests>
+        <test>
+            <param name="model" value="simple.bcsl.model" ftype="bcsl.model"/>
+            <output name="output" ftype="xml">
+                <assert_contents>
+                    <has_text text='compartment id="cell"'/>
+                    <has_text text='name="P(S{i},T{i})::cell"'/>
+                    <has_text text='multi:speciesType multi:id="st_T"'/>
+                    <has_text text='speciesFeatureType multi:id="S_feature_type"'/>
+                    <has_text text='multi:id="P_0_S"'/>
+                    <has_n_lines n="157" delta="1"/>
+                </assert_contents>
+            </output>
+        </test>
+    </tests>
+
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml	Sat Oct 08 12:55:26 2022 +0000
@@ -0,0 +1,17 @@
+<macros>
+    <token name="@TOOL_VERSION@">2.0.3</token>
+
+    <xml name="creator">
+        <creator>
+            <person
+                givenName="Matej"
+                familyName="Troják"
+                url="https://github.com/xtrojak"
+                identifier="0000-0003-0841-2707" />
+            <organization
+                url="https://sybila.fi.muni.cz/"
+                email="sybila@fi.muni.cz"
+                name="SYBILA MUNI" />
+        </creator>
+    </xml>
+</macros>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/simple.bcsl.model	Sat Oct 08 12:55:26 2022 +0000
@@ -0,0 +1,7 @@
+#! rules
+r1_S ~ P(S{i})::cell => P(S{a})::cell
+r1_T ~ P(T{i})::cell => P(T{a})::cell
+r2 ~ P()::cell => P()::out
+
+#! inits
+1 P(S{i},T{i})::cell
\ No newline at end of file