details: http://www.bx.psu.edu/hg/galaxy/rev/bfcf6a3249c7 changeset: 3472:bfcf6a3249c7 user: Dan Blankenberg <dan@bx.psu.edu> date: Wed Mar 03 14:30:32 2010 -0500 description: Enhance change_format tag of tool outputs to allow the use of Grouping Constructs. Objects can be accessed using the previously accepted bare name or using the same style as used within templates (e.g. the tool command tag). e.g. <outputs> <data name="output_file" format="fastqsanger"> <change_format> <when input="input_type" value="cssanger" format="fastqcssanger" /> <when input="options_type.output_type" value="solexa" format="fastqsolexa" /> <when input="options_type.output_type" value="illumina" format="fastqillumina" /> <when input="options_type.output_type" value="sanger" format="fastqsanger" /> <when input="options_type.output_type" value="cssanger" format="fastqcssanger" /> </change_format> </data> </outputs> or <outputs> <data name="output_file" format="fastqsanger"> <change_format> <when input="$input_type" value="cssanger" format="fastqcssanger" /> <when input="${options_type.output_type}" value="solexa" format="fastqsolexa" /> <when input="${options_type.output_type}" value="illumina" format="fastqillumina" /> <when input="${options_type.output_type}" value="sanger" format="fastqsanger" /> <when input="${options_type.output_type}" value="cssanger" format="fastqcssanger" /> </change_format> </data> </outputs> where 'options_type' is the name of the grouping parameter and 'output_type' is the name of a parameter found in this group and 'input_type' is the name of a parameter not found within a group. diffstat: lib/galaxy/tools/actions/__init__.py | 14 +++++++++++--- 1 files changed, 11 insertions(+), 3 deletions(-) diffs (27 lines): diff -r d51de35b53d8 -r bfcf6a3249c7 lib/galaxy/tools/actions/__init__.py --- a/lib/galaxy/tools/actions/__init__.py Wed Mar 03 13:51:29 2010 -0500 +++ b/lib/galaxy/tools/actions/__init__.py Wed Mar 03 14:30:32 2010 -0500 @@ -213,12 +213,20 @@ ext = input_ext #process change_format tags if output.change_format: + params = make_dict_copy( incoming ) #FIXME: The wrapping of inputs should only be done once per call to execute; currently happens here and possibly when generating output dataset name + wrap_values( tool.inputs, params ) for change_elem in output.change_format: for when_elem in change_elem.findall( 'when' ): - check = incoming.get( when_elem.get( 'input' ), None ) + check = when_elem.get( 'input', None ) if check is not None: - if check == when_elem.get( 'value', None ): - ext = when_elem.get( 'format', ext ) + try: + if '$' not in check: + #allow a simple name or more complex specifications + check = '${%s}' % check + if str( fill_template( check, context = params ) ) == when_elem.get( 'value', None ): + ext = when_elem.get( 'format', ext ) + except: #bad tag input value; possibly referencing a param within a different conditional when block or other nonexistent grouping construct + continue else: check = when_elem.get( 'input_dataset', None ) if check is not None: