# HG changeset patch
# User sybila
# Date 1665238045 0
# Node ID 35cc9bb0b4e9a637ca42a1c66174bcf7c95d683b
planemo upload for repository https://github.com/sybila/galaxytools/tree/master/tools/ebcsgen commit f39ef50b0964744be7816de065024eeb1fb69364
diff -r 000000000000 -r 35cc9bb0b4e9 ebcsgen_static_analysis.py
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ebcsgen_static_analysis.py Sat Oct 08 14:07:25 2022 +0000
@@ -0,0 +1,54 @@
+import argparse
+
+from eBCSgen.Errors.ComplexParsingError import ComplexParsingError
+from eBCSgen.Errors.ModelParsingError import ModelParsingError
+from eBCSgen.Errors.UnspecifiedParsingError import UnspecifiedParsingError
+from eBCSgen.Parsing.ParseBCSL import Parser
+
+
+def save_model(model, filename):
+ f = open(filename, "w")
+ f.write(repr(model))
+ f.close()
+
+
+args_parser = argparse.ArgumentParser(description='Static analysis')
+
+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('--method', type=str, required=True)
+optional.add_argument('--complex')
+
+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 args.method == "reduce":
+ model.data.reduce_context()
+ save_model(model.data, args.output)
+ elif args.method == "eliminate":
+ model.data.eliminate_redundant()
+ save_model(model.data, args.output)
+ else:
+ complex_parser = Parser("rate_complex")
+ complex = complex_parser.parse(args.complex)
+ if complex.success:
+ result = model.data.static_non_reachability(complex.data.children[0])
+ f = open(args.output, "w")
+ s = "can possibly" if result else "cannot"
+ message = "The given agent\n\t{}\n{} be reached in the model.".format(complex.data.children[0], s)
+ f.write(message)
+ f.close()
+ else:
+ raise ComplexParsingError(complex.data, args.complex)
+else:
+ if "error" in model.data:
+ raise UnspecifiedParsingError(model.data["error"])
+ raise ModelParsingError(model.data, model_str)
diff -r 000000000000 -r 35cc9bb0b4e9 ebcsgen_static_analysis.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/ebcsgen_static_analysis.xml Sat Oct 08 14:07:25 2022 +0000
@@ -0,0 +1,73 @@
+
+ - run static analysis techniques on given BCSL model
+
+ macros.xml
+
+
+
+ sybila/ebcsgen:v@TOOL_VERSION@
+
+
+
+ python3 ${__tool_directory__}/ebcsgen_static_analysis.py
+ --model '$model'
+ --output '$output'
+ --method '$Method.method'
+ #if $Method.method == "reach":
+ --complex '$Method.complex'
+ #end if
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff -r 000000000000 -r 35cc9bb0b4e9 macros.xml
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/macros.xml Sat Oct 08 14:07:25 2022 +0000
@@ -0,0 +1,17 @@
+
+ 2.0.3
+
+
+
+
+
+
+
+
diff -r 000000000000 -r 35cc9bb0b4e9 test-data/reduced.bcsl.model
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/reduced.bcsl.model Sat Oct 08 14:07:25 2022 +0000
@@ -0,0 +1,7 @@
+#! rules
+P()::cell => P()::out @ 1.0
+
+#! inits
+1 P()::cell
+
+#! definitions
diff -r 000000000000 -r 35cc9bb0b4e9 test-data/redundant.bcsl.model
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test-data/redundant.bcsl.model Sat Oct 08 14:07:25 2022 +0000
@@ -0,0 +1,8 @@
+#! 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
+r1_X ~ P(T{i})::cell => P(T{a})::cell
+
+#! inits
+1 P(S{i},T{i})::cell
\ No newline at end of file