Skip to content

Commit

Permalink
Merge branch 'release_15.07' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
dannon committed Aug 1, 2015
2 parents f379de1 + 4d4c68c commit 7c299fa
Show file tree
Hide file tree
Showing 8 changed files with 118 additions and 13 deletions.
21 changes: 19 additions & 2 deletions lib/galaxy/tools/parameters/dynamic_options.py
Expand Up @@ -127,9 +127,26 @@ def compare_meta_value( file_value, dataset_value ):
return file_value == dataset_value
assert self.ref_name in other_values or ( trans is not None and trans.workflow_building_mode), "Required dependency '%s' not found in incoming values" % self.ref_name
ref = other_values.get( self.ref_name, None )
if not isinstance( ref, self.dynamic_option.tool_param.tool.app.model.HistoryDatasetAssociation ) and not isinstance( ref, galaxy.tools.wrappers.DatasetFilenameWrapper ):
is_data = isinstance( ref, galaxy.tools.wrappers.DatasetFilenameWrapper )
is_data_list = isinstance( ref, galaxy.tools.wrappers.DatasetListWrapper ) or isinstance( ref, list )
is_data_or_data_list = is_data or is_data_list
if not isinstance( ref, self.dynamic_option.tool_param.tool.app.model.HistoryDatasetAssociation ) and not is_data_or_data_list:
return [] # not a valid dataset
meta_value = ref.metadata.get( self.key, None )

if is_data_list:
meta_value = None
for single_ref in ref:
this_meta_value = single_ref.metadata.get( self.key, None )
if this_meta_value == meta_value:
continue
elif meta_value is None:
meta_value = this_meta_value
else:
# Different values with mismatching metadata, return []
return []
else:
meta_value = ref.metadata.get( self.key, None )

if meta_value is None: # assert meta_value is not None, "Required metadata value '%s' not found in referenced dataset" % self.key
return [ ( disp_name, basic.UnvalidatedValue( optval ), selected ) for disp_name, optval, selected in options ]

Expand Down
2 changes: 2 additions & 0 deletions lib/tool_shed/galaxy_install/install_manager.py
Expand Up @@ -391,6 +391,8 @@ def install_package( self, elem, tool_shed_repository, tool_dependencies=None, f
# tag set that defines the recipe to install and compile from source.
log.debug( 'Proceeding with install and compile recipe for tool dependency %s.' %
str( tool_dependency.name ) )
# Reset above error to installing
tool_dependency.status = self.install_model.ToolDependency.installation_status.INSTALLING
tool_dependency = self.install_via_fabric( tool_shed_repository,
tool_dependency,
install_dir,
Expand Down
27 changes: 16 additions & 11 deletions test/functional/test_toolbox.py
Expand Up @@ -45,6 +45,7 @@ def do_it( self, testdef ):
job_stdio = None
job_output_exceptions = None
tool_execution_exception = None
expected_failure_occurred = False
try:
try:
tool_response = galaxy_interactor.run_tool( testdef, test_history )
Expand All @@ -53,22 +54,26 @@ def do_it( self, testdef ):
except RunToolException as e:
tool_inputs = e.inputs
tool_execution_exception = e
raise e
if not testdef.expect_failure:
raise e
else:
expected_failure_occurred = True
except Exception as e:
tool_execution_exception = e
raise e

self.assertTrue( data_list or data_collection_list )
if not expected_failure_occurred:
self.assertTrue( data_list or data_collection_list )

try:
job_stdio = self._verify_outputs( testdef, test_history, jobs, shed_tool_id, data_list, data_collection_list, galaxy_interactor )
except JobOutputsError as e:
job_stdio = e.job_stdio
job_output_exceptions = e.output_exceptions
raise e
except Exception as e:
job_output_exceptions = [e]
raise e
try:
job_stdio = self._verify_outputs( testdef, test_history, jobs, shed_tool_id, data_list, data_collection_list, galaxy_interactor )
except JobOutputsError as e:
job_stdio = e.job_stdio
job_output_exceptions = e.output_exceptions
raise e
except Exception as e:
job_output_exceptions = [e]
raise e
finally:
job_data = {}
if tool_inputs is not None:
Expand Down
2 changes: 2 additions & 0 deletions test/functional/tool-data/fasta_indexes.loc
@@ -0,0 +1,2 @@
hg19 hg19 hg19 hg19
hg18 hg18 hg18 hg18
4 changes: 4 additions & 0 deletions test/functional/tool-data/sample_tool_data_tables.xml
Expand Up @@ -7,4 +7,8 @@
<columns>value, path</columns>
<file path="${__HERE__}/testbeta.loc" />
</table>
<table name="test_fasta_indexes" comment_char="#">
<columns>value, dbkey, name, path</columns>
<file path="${__HERE__}/fasta_indexes.loc" />
</table>
</tables>
39 changes: 39 additions & 0 deletions test/functional/tools/dbkey_filter_input.xml
@@ -0,0 +1,39 @@
<tool id="dbkey_filter_input" name="dbkey_filter_input" version="0.1.0">
<description>Filter (single) input on a dbkey</description>
<command>
cat $inputs > $output
</command>
<inputs>
<param format="txt" name="inputs" type="data" label="Inputs" help="" />
<param name="index" type="select" label="Using reference genome">
<options from_data_table="test_fasta_indexes">
<filter type="data_meta" ref="inputs" 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="output" />
</outputs>

<tests>
<!-- can choose a dbkey if it matches input -->
<test>
<param name="inputs" value="simple_line.txt" dbkey="hg19" />
<param name="index" value="hg19" />
<output name="output" file="simple_line.txt"/>
</test>
<!-- cannot pick index otherwise -->
<!-- Does this make sense - if no dbkey is defined there is no option
available? -->
<test expect_failure="true">
<param name="inputs" value="simple_line.txt" />
<param name="index" value="hg18" />
<output name="output" file="simple_line.txt"/>
</test>
</tests>

<help>
</help>
</tool>
34 changes: 34 additions & 0 deletions test/functional/tools/dbkey_filter_multi_input.xml
@@ -0,0 +1,34 @@
<tool id="dbkey_filter_multi_input" name="dbkey_filter_multi_input" version="0.1.0">
<description>Filter select on dbkey of multiple inputs</description>
<command><![CDATA[
#for $input in $inputs#
cat $input >> $output;
#end for#
]]>
</command>
<inputs>
<param format="txt" name="inputs" type="data" label="Inputs" multiple="true" help="" />
<param name="index" type="select" label="Using reference genome">
<options from_data_table="test_fasta_indexes">
<filter type="data_meta" ref="inputs" 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="output" />
</outputs>

<tests>
<!-- can choose a dbkey if it matches input -->
<test>
<param name="inputs" value="simple_line.txt,simple_line.txt" dbkey="hg19" />
<param name="index" value="hg19" />
<output name="output" file="simple_line_x2.txt"/>
</test>
</tests>

<help>
</help>
</tool>
2 changes: 2 additions & 0 deletions test/functional/tools/samples_tool_conf.xml
Expand Up @@ -16,6 +16,8 @@
<tool file="multi_output.xml" />
<tool file="multi_output_configured.xml" />
<tool file="multi_output_assign_primary.xml" />
<tool file="dbkey_filter_input.xml" />
<tool file="dbkey_filter_multi_input.xml" />
<tool file="composite_output.xml" />
<tool file="metadata.xml" />
<tool file="metadata_bam.xml" />
Expand Down

0 comments on commit 7c299fa

Please sign in to comment.