From dac0f0105dc85feea2d7e4647e10b2890e6b30f4 Mon Sep 17 00:00:00 2001 From: Daniel Blankenberg Date: Thu, 5 Jun 2008 16:35:51 +0000 Subject: [PATCH] More workflow and dynamic options compatibility fixes. --- lib/galaxy/tools/actions/__init__.py | 2 +- lib/galaxy/tools/parameters/basic.py | 12 +++++++----- lib/galaxy/tools/parameters/dynamic_options.py | 3 ++- templates/workflow/run.mako | 8 ++++---- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/lib/galaxy/tools/actions/__init__.py b/lib/galaxy/tools/actions/__init__.py index e23b04baa82..ac4acf40807 100644 --- a/lib/galaxy/tools/actions/__init__.py +++ b/lib/galaxy/tools/actions/__init__.py @@ -33,7 +33,7 @@ class DefaultToolAction( object ): if target_ext in data.get_converter_types(): assoc = data.get_associated_files_by_type( "CONVERTED_%s" % target_ext ) if assoc: data = assoc[0].dataset - elif input.converter_safe( param_values ): + elif input.converter_safe( param_values, trans ): #run converter here assoc = trans.app.model.DatasetAssociatedFile( parent_id = data.id, file_type = "CONVERTED_%s" % target_ext, metadata_safe = False ) new_data = data.datatype.convert_dataset( trans, data, target_ext, return_output = True, visible = False ).values()[0] diff --git a/lib/galaxy/tools/parameters/basic.py b/lib/galaxy/tools/parameters/basic.py index 34c744ff2aa..deec334b281 100644 --- a/lib/galaxy/tools/parameters/basic.py +++ b/lib/galaxy/tools/parameters/basic.py @@ -471,7 +471,7 @@ class SelectToolParameter( ToolParameter ): # Dynamic options are not yet supported in workflow, allow # specifying the value as text for now. if self.is_dynamic and trans.workflow_building_mode \ - and ( self.options is None or self.options.data_ref is not None ): + and ( self.options is None or self.options.dataset_ref_name is not None ): assert isinstance( value, UnvalidatedValue ) value = value.value if self.multiple: @@ -495,7 +495,7 @@ class SelectToolParameter( ToolParameter ): # HACK: trans may be None here if doing late validation, this is # treated the same as not being in workflow mode if self.is_dynamic and ( trans and trans.workflow_building_mode ) \ - and ( self.options is None or self.options.data_ref is not None ): + and ( self.options is None or self.options.dataset_ref_name is not None ): if self.multiple: value = value.split( "\n" ) return UnvalidatedValue( value ) @@ -536,7 +536,7 @@ class SelectToolParameter( ToolParameter ): def get_initial_value( self, trans, context ): # More working around dynamic options for workflow if self.is_dynamic and trans.workflow_building_mode \ - and ( self.options is None or self.options.data_ref is not None ): + and ( self.options is None or self.options.dataset_ref_name is not None ): # Really the best we can do? return UnvalidatedValue( None ) options = list( self.get_options( trans, context ) ) @@ -1056,7 +1056,7 @@ class DataToolParameter( ToolParameter ): assoc = data.get_associated_files_by_type( "CONVERTED_%s" % target_ext ) if assoc: data = assoc[0].dataset - elif not self.converter_safe( other_values ): + elif not self.converter_safe( other_values, trans ): continue selected = ( value and ( data in value ) ) field.add_option( "%s: (as %s) %s" % ( hid, target_ext, data.name[:30] ), data.id, selected ) @@ -1172,7 +1172,9 @@ class DataToolParameter( ToolParameter ): else: return [] - def converter_safe( self, other_values ): + def converter_safe( self, other_values, trans ): + if trans.workflow_building_mode: + return False if self.tool.config_files: return False #dataset conversion and configuration files currently only work with datasets that have already been converted converter_safe = [True] diff --git a/lib/galaxy/tools/parameters/dynamic_options.py b/lib/galaxy/tools/parameters/dynamic_options.py index 9f30e1107c8..4f030c4ac0b 100644 --- a/lib/galaxy/tools/parameters/dynamic_options.py +++ b/lib/galaxy/tools/parameters/dynamic_options.py @@ -103,7 +103,7 @@ class DataMetaFilter( Filter ): return dataset_value in file_value.split( self.separator ) return file_value == dataset_value ref = other_values.get( self.ref_name, None ) - assert ref is not None, "Required dependency '%s' not found in incoming values" % ref + assert ref is not None or trans.workflow_building_mode, "Required dependency '%s' not found in incoming values" % ref if not isinstance( ref, self.dynamic_option.tool_param.tool.app.model.Dataset ): return [] #not a valid dataset meta_value = ref.metadata.get( self.key, None ) @@ -146,6 +146,7 @@ class ParamValueFilter( Filter ): def get_dependency_name( self ): return self.ref_name def filter_options( self, options, trans, other_values ): + if trans.workflow_building_mode: return [] ref = str( other_values.get( self.ref_name, None ) ) assert ref is not None, "Required dependency '%s' not found in incoming values" % ref rval = [] diff --git a/templates/workflow/run.mako b/templates/workflow/run.mako index d8afb240ad7..662f67f8055 100644 --- a/templates/workflow/run.mako +++ b/templates/workflow/run.mako @@ -41,15 +41,15 @@ from galaxy.tools.parameters import DataToolParameter <% current_case = group_values['__current_case__'] %> <% prefix = prefix + input.name + "|" %> <% group_errors = errors.get( input.name, {} ) %> - ${row_for_param( input.test_param, group_values[ input.test_param.name ], group_errors, prefix, step )} + ${row_for_param( input.test_param, group_values[ input.test_param.name ], group_values, group_errors, prefix, step )} ${do_inputs( input.cases[ current_case ].inputs, group_values, group_errors, prefix + input.name + "|", step )} %else: - ${row_for_param( input, values[ input.name ], errors, prefix, step )} + ${row_for_param( input, values[ input.name ], values, errors, prefix, step )} %endif %endfor -<%def name="row_for_param( param, value, error_dict, prefix, step )"> +<%def name="row_for_param( param, value, values, error_dict, prefix, step )"> ## -- ${param.name} -- ${step.state.inputs} -- %if error_dict.has_key( param.name ): <% cls = "form-row form-row-error" %> @@ -66,7 +66,7 @@ from galaxy.tools.parameters import DataToolParameter %> Output dataset '${conn.output_name}' from step ${int(conn.output_step.order_index)+1} %else: - ${param.get_html_field( t, dict(), dict() ).get_html( str(step.id) + "|" + prefix )} + ${param.get_html_field( t, dict(), values ).get_html( str(step.id) + "|" + prefix )} %endif %else: ${param.value_to_display_text( value, app )}