Skip to content

Commit

Permalink
Implement group tag testing in tools.
Browse files Browse the repository at this point in the history
  • Loading branch information
jmchilton committed Aug 6, 2024
1 parent e0b6532 commit 7185a12
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/galaxy/tool_util/verify/interactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -505,10 +505,14 @@ def stage_data_async(
tool_version: Optional[str] = None,
) -> Callable[[], None]:
fname = test_data["fname"]
tags = test_data.get("tags")
tool_input = {
"file_type": test_data["ftype"],
"dbkey": test_data["dbkey"],
}
if tags:
tool_input["tags"] = tags

metadata = test_data.get("metadata", {})
if not hasattr(metadata, "items"):
raise Exception(f"Invalid metadata description found for input [{fname}] - [{metadata}]")
Expand Down Expand Up @@ -1865,6 +1869,7 @@ def test_data_iter(required_files):
ftype=extra.get("ftype", DEFAULT_FTYPE),
dbkey=extra.get("dbkey", DEFAULT_DBKEY),
location=extra.get("location", None),
tags=extra.get("tags", []),
)
edit_attributes = extra.get("edit_attributes", [])

Expand Down
8 changes: 7 additions & 1 deletion lib/galaxy/tools/actions/upload_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,13 @@ def new_upload(
)
else:
upload_target_dataset_instance = __new_history_upload(trans, uploaded_dataset, history=history, state=state)

if uploaded_dataset.tags:
new_tags = tag_handler.parse_tags_list(uploaded_dataset.tags.split(","))
for tag in new_tags:
log.info(f"applying item tag.... {tag}")
tag_handler.apply_item_tag(
user=trans.user, item=upload_target_dataset_instance, name=tag[0], value=tag[1], flush=True
)
if tag_list:
tag_handler.add_tags_from_list(trans.user, upload_target_dataset_instance, tag_list, flush=False)

Expand Down
27 changes: 27 additions & 0 deletions test/functional/tools/parameters/gx_group_tag.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<tool id="gx_group_tag" name="gx_group_tag" version="1.0.0">
<macros>
<import>macros.xml</import>
</macros>
<command><![CDATA[
echo "parameter: $parameter" > '$output'
]]></command>
<inputs>
<param name="ref_parameter" type="data_collection" format="tabular" />
<param name="parameter" type="group_tag" data_ref="ref_parameter" />
</inputs>
<expand macro="simple_text_output" />
<tests>
<test>
<param name="ref_parameter">
<collection type="paired">
<element name="forward" value="simple_line.txt" tags="group:type:single" />
<element name="reverse" value="simple_line_alternative.txt" tags="group:type:split" />
</collection>
</param>
<param name="parameter" value="type:single" />
<expand macro="assert_output">
<has_line line="parameter: type:single"/>
</expand>
</test>
</tests>
</tool>
1 change: 1 addition & 0 deletions tools/data_source/upload.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
</upload_dataset>
<param name="force_composite" type="hidden" value="false" />
<param name="dbkey" type="genomebuild" label="Genome" />
<param name="tags" type="hidden" value="" />
<conditional name="files_metadata" value_from="self:app.datatypes_registry.get_upload_metadata_params" value_ref="file_type" value_ref_in_group="False" />
<!-- <param name="other_dbkey" type="text" label="Or user-defined Genome" /> -->
</inputs>
Expand Down

0 comments on commit 7185a12

Please sign in to comment.