changeset 0:3bdec3b22152 draft default tip

planemo upload for repository https://github.com/sybila/galaxytools/tree/master/tools/ebcsgen commit 7befebc7a9bc40d8b97f4dac752ad9646aac40de
author sybila
date Fri, 09 Sep 2022 13:06:32 +0000
parents
children
files ebcsgen_generate_ts.py ebcsgen_generate_ts.xml macros.xml test-data/simple.bcsl.model
diffstat 4 files changed, 125 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ebcsgen_generate_ts.py	Fri Sep 09 13:06:32 2022 +0000
@@ -0,0 +1,43 @@
+import argparse
+
+from eBCSgen.Errors.ModelParsingError import ModelParsingError
+from eBCSgen.Errors.UnspecifiedParsingError import UnspecifiedParsingError
+from eBCSgen.Parsing.ParseBCSL import Parser
+
+import numpy as np
+
+
+args_parser = argparse.ArgumentParser(description='Transition system generating')
+
+args_parser._action_groups.pop()
+required = args_parser.add_argument_group('required arguments')
+optional = args_parser.add_argument_group('optional arguments')
+
+required.add_argument('--model', type=str, required=True)
+required.add_argument('--output', type=str, required=True)
+required.add_argument('--direct', required=True)
+
+optional.add_argument('--max_time', type=float, default=np.inf)
+optional.add_argument('--max_size', type=float, default=np.inf)
+optional.add_argument('--bound', type=int, default=None)
+
+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:
+    if eval(args.direct):
+        ts = model.data.generate_direct_transition_system(args.max_time,
+                                                          args.max_size,
+                                                          args.bound)
+        ts.change_to_vector_backend()
+    else:
+        vm = model.data.to_vector_model(args.bound)
+        ts = vm.generate_transition_system(None, args.max_time, args.max_size)
+    ts.save_to_json(args.output, model.data.params)
+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_generate_ts.xml	Fri Sep 09 13:06:32 2022 +0000
@@ -0,0 +1,58 @@
+<tool id="eBCSgen_generate_transition_system" name="eBCSgen - transition system generator" version="@TOOL_VERSION@_galaxy0">
+    <description>- generate transition system of the given model</description>
+    <macros>
+        <import>macros.xml</import>
+    </macros>
+    <expand macro="creator"/>
+    <requirements>
+        <container type="docker">sybila/ebcsgen:v@TOOL_VERSION@</container>
+    </requirements>
+
+    <command>python3 ${__tool_directory__}/ebcsgen_generate_ts.py
+        --model '$model'
+        --output '$output'
+        --direct '$network_free_choice'
+        #if $adv.bound != "":
+        --bound '$adv.bound'
+        #end if
+        #if $adv.max_time != "":
+        --max_time '$adv.max_time'
+        #end if
+        #if $adv.max_size != "":
+        --max_size '$adv.max_size'
+        #end if
+    </command>
+
+    <inputs>
+        <param format="bcsl.model" name="model" type="data" label="Model file" help="Provide a BCSL model file"/>
+        <param name="network_free_choice" type="select" label="Choose network-free approach:">
+            <option value="False" selected="true">Indirect</option>
+            <option value="True">Direct</option>
+        </param>
+        <section name="adv" title="Advanced Options" expanded="false">
+            <param name="bound" min="0" type="integer" value="" label="Bound [optional]" optional="true"/>
+            <param name="max_time" min="0" type="float" value=""
+                   label="Maximal computation time (in seconds) [optional]" optional="true"/>
+            <param name="max_size" min="1" type="integer" value="" label="Maximal TS size [optional]" optional="true"/>
+        </section>
+    </inputs>
+
+    <outputs>
+        <data label="Transition system of ${on_string}" format="bcsl.ts" name="output"/>
+    </outputs>
+
+    <tests>
+        <test>
+            <param name="model" value="simple.bcsl.model" ftype="bcsl.model"/>
+            <output name="output" ftype="bcsl.ts">
+                <assert_contents>
+                    <has_text text="nodes"/>
+                    <has_text text="edges"/>
+                    <has_text text="ordering"/>
+                    <has_text text="initial"/>
+                    <has_n_lines n="98" />
+                </assert_contents>
+            </output>
+        </test>
+    </tests>
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml	Fri Sep 09 13:06:32 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	Fri Sep 09 13:06:32 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