Skip to content

Commit

Permalink
Create harmonized collections from correct tool outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
wm75 committed Nov 29, 2024
1 parent a648915 commit 9db19d9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/galaxy/tools/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3875,14 +3875,13 @@ def produce_outputs(self, trans, out_data, output_collections, incoming, history
final_sorted_identifiers = [
element.element_identifier for element in elements1 if element.element_identifier in old_elements2_dict
]
# Raise Exception if it is empty
if len(final_sorted_identifiers) == 0:
# Create empty collections:
output_collections.create_collection(
next(iter(self.outputs.values())), "output1", elements={}, propagate_hda_tags=False
self.outputs["output1"], "output1", elements={}, propagate_hda_tags=False
)
output_collections.create_collection(
next(iter(self.outputs.values())), "output2", elements={}, propagate_hda_tags=False
self.outputs["output2"], "output2", elements={}, propagate_hda_tags=False
)
return

Expand All @@ -3900,7 +3899,7 @@ def output_with_selected_identifiers(old_elements_dict, output_label):
self._add_datasets_to_history(history, new_elements.values())
# Create collections:
output_collections.create_collection(
next(iter(self.outputs.values())), output_label, elements=new_elements, propagate_hda_tags=False
self.outputs[output_label], output_label, elements=new_elements, propagate_hda_tags=False
)

# Create outputs:
Expand Down
31 changes: 31 additions & 0 deletions lib/galaxy/tools/harmonize_two_collections_list.xml
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,37 @@
<output_collection name="output1" type="list" count="0"/>
<output_collection name="output2" type="list" count="0"/>
</test>
<!-- test that collection types get propagated to outputs correctly -->
<test>
<param name="input1">
<collection type="list">
<element name="element_1" value="simple_line.txt" />
</collection>
</param>
<param name="input2">
<collection type="list:paired">
<element name="element_1">
<collection type="paired">
<element name="forward" value="1.fastq" ftype="fastqsanger" />
<element name="reverse" value="1.fastqsanger" ftype="fastqsanger" />
</collection>
</element>
</collection>
</param>
<output_collection name="output1" type="list" count="1">
<element name="element_1">
<assert_contents>
<has_text_matching expression="^This is a line of text.\n$" />
</assert_contents>
</element>
</output_collection>
<output_collection name="output2" type="list:paired" count="1">
<element name="element_1">
<element name="forward" file="1.fastq" ftype="fastqsanger" />
<element name="reverse" file="1.fastqsanger" ftype="fastqsanger" />
</element>
</output_collection>
</test>
</tests>
<help><![CDATA[
Expand Down

0 comments on commit 9db19d9

Please sign in to comment.