Merge pull request #2800 from jmchilton/dbkey_output_without_cond

[16.04] Fix dbkey problem discovered by @hrhotz
This commit is contained in:
Marius van den Beek
2016-08-17 09:12:17 +02:00
committed by GitHub
4 changed files with 47 additions and 1 deletions
+1 -1
View File
@@ -628,7 +628,7 @@ class DefaultToolAction( object ):
"""
if output.actions:
for action in output.actions.actions:
if action.tag == "metadata":
if action.tag == "metadata" and action.default:
metadata_new_value = fill_template( action.default, context=params ).split(",")
dataset.metadata.__setattr__(str(action.name), metadata_new_value)
+9
View File
@@ -1,7 +1,16 @@
"""Entry point for the usage of Cheetah templating within Galaxy."""
from Cheetah.Template import Template
def fill_template( template_text, context=None, **kwargs ):
"""Fill a cheetah template out for specified context.
If template_text is None, an exception will be thrown, if context
is None (the default) - keyword arguments to this function will be used
as the context.
"""
if template_text is None:
raise TypeError("Template text specified as None to fill_template.")
if not context:
context = kwargs
return str( Template( source=template_text, searchList=[context] ) )
@@ -0,0 +1,36 @@
<tool id="dbkey_output_action" name="dbkey_output_action" version="0.1.0">
<command>echo foo > $mapped_reads</command>
<inputs>
<param name="input" type="data" />
<param name="index" type="select" label="Using reference genome">
<options from_data_table="test_fasta_indexes">
<filter type="data_meta" ref="input" key="dbkey" column="1" />
<validator type="no_options" message="No reference genome is available for the build associated with the selected input dataset" />
</options>
</param>
</inputs>
<outputs>
<data format="txt" name="mapped_reads">
<actions>
<action type="metadata" name="dbkey">
<option type="from_data_table" name="test_fasta_indexes" column="1" offset="0">
<filter type="param_value" column="0" value="#" compare="startswith" keep="False"/>
<filter type="param_value" ref="index" column="0"/>
</option>
</action>
</actions>
</data>
</outputs>
<tests>
<test>
<param name="input" value="simple_line.txt" dbkey="hg18" />
<param name="index" value="hg18"/>
<output name="mapped_reads">
<metadata name="dbkey" value="hg18" />
<assert_contents>
<has_text text="foo" />
</assert_contents>
</output>
</test>
</tests>
</tool>
@@ -18,6 +18,7 @@
<tool file="inputs_as_json.xml" />
<tool file="dbkey_filter_input.xml" />
<tool file="dbkey_filter_multi_input.xml" />
<tool file="dbkey_output_action.xml" />
<tool file="composite_output.xml" />
<tool file="unicode_stream.xml" />
<tool file="metadata.xml" />