changeset 0:ea5108514910 draft

planemo upload for repository https://github.com/sybila/galaxytools/tree/master/tools/ebcsgen commit d80d8e9710cba50aab3e6a1e10a527d26fc7e72b
author sybila
date Fri, 09 Sep 2022 17:04:25 +0000
parents
children 602c6cab487e
files ebcsgen_pctl_model_checking.py ebcsgen_pctl_model_checking.xml macros.xml test-data/pctl_model_checking.bcsl.ts
diffstat 4 files changed, 167 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ebcsgen_pctl_model_checking.py	Fri Sep 09 17:04:25 2022 +0000
@@ -0,0 +1,34 @@
+import argparse
+
+from eBCSgen.Analysis.PCTL import PCTL
+from eBCSgen.Errors.FormulaParsingError import FormulaParsingError
+from eBCSgen.Errors.InvalidInputError import InvalidInputError
+from eBCSgen.Parsing.ParseBCSL import load_TS_from_json
+from eBCSgen.Parsing.ParsePCTLformula import PCTLparser
+
+
+args_parser = argparse.ArgumentParser(description='Model checking')
+
+args_parser._action_groups.pop()
+required = args_parser.add_argument_group('required arguments')
+optional = args_parser.add_argument_group('optional arguments')
+
+required.add_argument('--transition_file', required=True)
+required.add_argument('--output', type=str, required=True)
+required.add_argument('--formula', type=str, required=True)
+
+args = args_parser.parse_args()
+
+ts = load_TS_from_json(args.transition_file)
+
+if len(ts.params) != 0:
+    raise InvalidInputError("Provided transition system is parametrised - model checking cannot be executed.")
+
+formula = PCTLparser().parse(args.formula)
+if formula.success:
+    result = PCTL.model_checking(ts, formula, storm_local=True)
+    f = open(args.output, "w")
+    f.write(result.decode("utf-8"))
+    f.close()
+else:
+    raise FormulaParsingError(formula.data, args.formula)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ebcsgen_pctl_model_checking.xml	Fri Sep 09 17:04:25 2022 +0000
@@ -0,0 +1,41 @@
+<tool id="eBCSgen_PCTL_model_checking" name="eBCSgen - PCTL model checking" version="@TOOL_VERSION@_galaxy0">
+    <description>- explicit PCTL model checking of transition system</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_pctl_model_checking.py
+        --transition_file '$transition_file'
+        --output '$output'
+        --formula '$formula'
+    </command>
+
+    <inputs>
+        <param format="bcsl.ts" name="transition_file" type="data" label="Computed Transition system"/>
+        <param name="formula" type="text" label="PCTL formula">
+            <validator type="empty_field"/>
+        </param>
+    </inputs>
+
+    <outputs>
+        <data label="PCTL model checking of ${on_string}" format="storm.check" name="output"/>
+    </outputs>
+
+    <tests>
+        <test>
+            <param name="transition_file" value="pctl_model_checking.bcsl.ts" ftype="bcsl.ts"/>
+            <param name="formula" value="P &lt;= 0.5[F X()::rep=1]"/>
+            <output name="output" ftype="storm.check">
+                <assert_contents>
+                    <has_text text="Result (for initial states): false"/>
+                </assert_contents>
+             </output>
+        </test>
+    </tests>
+
+</tool>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml	Fri Sep 09 17:04:25 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/pctl_model_checking.bcsl.ts	Fri Sep 09 17:04:25 2022 +0000
@@ -0,0 +1,75 @@
+{
+    "nodes": {
+        "1": "(inf, inf, inf)",
+        "2": "(1, 2, 0)",
+        "3": "(0, 1, 0)",
+        "4": "(0, 2, 0)",
+        "5": "(2, 1, 0)",
+        "6": "(2, 2, 0)",
+        "7": "(1, 1, 0)"
+    },
+    "edges": [
+        {
+            "s": 7,
+            "t": 3,
+            "p": 0.8
+        },
+        {
+            "s": 3,
+            "t": 4,
+            "p": 1.0
+        },
+        {
+            "s": 5,
+            "t": 7,
+            "p": 0.9855072463768116
+        },
+        {
+            "s": 1,
+            "t": 1,
+            "p": 1
+        },
+        {
+            "s": 2,
+            "t": 1,
+            "p": 0.2
+        },
+        {
+            "s": 5,
+            "t": 6,
+            "p": 0.014492753623188406
+        },
+        {
+            "s": 6,
+            "t": 1,
+            "p": 0.014492753623188406
+        },
+        {
+            "s": 6,
+            "t": 2,
+            "p": 0.9855072463768116
+        },
+        {
+            "s": 4,
+            "t": 1,
+            "p": 1.0
+        },
+        {
+            "s": 2,
+            "t": 4,
+            "p": 0.8
+        },
+        {
+            "s": 7,
+            "t": 2,
+            "p": 0.2
+        }
+    ],
+    "ordering": [
+        "X()::rep",
+        "Y()::rep",
+        "Z()::rep"
+    ],
+    "initial": 5,
+    "bound": 2
+}
\ No newline at end of file