Attempting to run a workflow with the tool XY_Plot_1 results in an error when 
trying to display the workflow steps.  The local dep_value variable is 
undefined.

The XY_Plot_1 tool has contains a repeat with a DataToolParameter "input"  and 2 
ColumnListParameter "xcol", "ycol"  dependent on the input.

In the current lib/galaxy/tools/parameters/basic.py code, the context values 
are expected to be of type dict, but in the XY_Plot_1 example the value we need 
to traverse is a list from the repeat.

Although the preferred solution would be to scope parameters within conditional 
and repeat tags,
the following will traverse the context in search of any match to the param 
name +  dependency name combination.

$ hg diff lib/galaxy/tools/parameters/basic.py
diff -r 3789ce7ddf1a lib/galaxy/tools/parameters/basic.py
--- a/lib/galaxy/tools/parameters/basic.py      Thu Feb 20 10:52:31 2014 -0500
+++ b/lib/galaxy/tools/parameters/basic.py      Thu Feb 20 10:05:32 2014 -0600
@@ -886,15 +886,30 @@
         # If we got this far, we can actually look at the dependencies
         # to see if their values will not be available until runtime.
         for dep_name in self.get_dependencies():
-            if dep_name in context:
-                dep_value = context[ dep_name ]
-            else:
-                # Quick hack to check deeper in the context.
-                # TODO: Context should really be scoped and the correct subset 
passed along.
-                # This happens specifically in all the GATK tools, the way the 
reference genome is handled.
-                for layer in context.itervalues():
-                    if isinstance( layer, dict ) and self.name in layer and 
dep_name in layer:
-                        dep_value = layer[dep_name]
+            # Quick hack to check deeper in the context.
+            # TODO: Context should really be scoped and the correct subset 
passed along.
+            # This happens specifically in all the GATK tools, the way the 
reference genome is handled.
+            # Also needed ito run workflows using the XY_Plot_1 tool
+            def get_dep_value(param_name, dep_name, layer):
+                dep_val = None
+                if isinstance( layer, dict ) and param_name in layer and 
dep_name in layer:
+                    dep_val = layer[dep_name]
+                elif isinstance( layer, list):
+                    for l in layer:
+                        dep_val = get_dep_value(param_name, dep_name, l)
+                        if dep_val:
+                            break
+                elif isinstance( layer, dict):
+                    for l in layer.itervalues():
+                        dep_val = get_dep_value(param_name, dep_name, l)
+                        if dep_val:
+                            break
+                return dep_val
+            dep_value = get_dep_value(self.name, dep_name, context)
+            # If dep_name not found, assume
+            if not dep_value:
+                log.warn("Unable to find %s dependency value for param: %s", 
dep_name, self.name)
+                return True
             # Dependency on a dataset that does not yet exist
             if isinstance( dep_value, DummyDataset ):
                 return True




--
James E. Johnson, Minnesota Supercomputing Institute, University of Minnesota
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client.  To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
 http://lists.bx.psu.edu/

To search Galaxy mailing lists use the unified search at:
 http://galaxyproject.org/search/mailinglists/

Reply via email to