diff fill_ctd.py @ 1:f7bc536b3bf3 draft

"planemo upload for repository https://github.com/galaxyproteomics/tools-galaxyp/tree/master/tools/openms commit 6e9568c650259d95b230d1a243e90f73a19564c2"
author galaxyp
date Thu, 24 Sep 2020 08:59:36 +0000
parents 3e7d3f64392b
children c951784e4967
line wrap: on
line diff
--- a/fill_ctd.py	Thu Sep 03 16:14:58 2020 +0000
+++ b/fill_ctd.py	Thu Sep 24 08:59:36 2020 +0000
@@ -150,6 +150,8 @@
 
 # transform values from json that correspond to
 # - old style booleans (string + restrictions) -> transformed to a str
+# - new style booleans that get a string (happens for hidden parameters [-test])
+#   are transformed to a bool
 # - unrestricted ITEMLIST which are represented as strings
 #   ("=quoted and space separated) in Galaxy -> transform to lists
 # - optional data input parameters that have defaults and for which no
@@ -164,7 +166,7 @@
     except KeyError:
         # few tools use dashes in parameters which are automatically replaced
         # by underscores by Galaxy. in these cases the dictionary needs to be
-        # updated
+        # updated (better: then dash and the underscore variant are in the dict)
         # TODO might be removed later https://github.com/OpenMS/OpenMS/pull/4529
         try:
             lineage = [_.replace("-", "_") for _ in p.get_lineage(name_only=True)]
@@ -172,12 +174,16 @@
         except KeyError:
             continue
         else:
-            setInDict(args, lineage, val)
+            setInDict(args, p.get_lineage(name_only=True), val)
 
     if p.type is str and type(p.restrictions) is _Choices and set(p.restrictions.choices) == set(["true", "false"]):
         v = getFromDict(args, p.get_lineage(name_only=True))
         setInDict(args, p.get_lineage(name_only=True), str(v).lower())
-
+    elif p.type is bool:
+        v = getFromDict(args, p.get_lineage(name_only=True))
+        if isinstance(v, str):
+            v = (v.lower() == "true")
+            setInDict(args, p.get_lineage(name_only=True), v)
     elif p.is_list and (p.restrictions is None or type(p.restrictions) is _NumericRange):
         v = getFromDict(args, p.get_lineage(name_only=True))
         if type(v) is str: