From 2ea7e5b95c0634417194465048f3b26588dc6674 Mon Sep 17 00:00:00 2001 From: John Chilton Date: Mon, 30 Dec 2024 19:16:48 -0500 Subject: [PATCH] Rebase into paired/unpaired... --- .../types/collection_semantics.yml | 37 ++++++++++++------- lib/galaxy_test/api/test_tool_execute.py | 13 ++++++- lib/galaxy_test/base/populators.py | 10 +++++ 3 files changed, 46 insertions(+), 14 deletions(-) diff --git a/lib/galaxy/model/dataset_collections/types/collection_semantics.yml b/lib/galaxy/model/dataset_collections/types/collection_semantics.yml index 96108d831b9b..8ed3ffb639ba 100644 --- a/lib/galaxy/model/dataset_collections/types/collection_semantics.yml +++ b/lib/galaxy/model/dataset_collections/types/collection_semantics.yml @@ -24,6 +24,30 @@ tests: - tool_runtime: "test_tool_execute.py::test_map_over_collection" +- example: + label: BASIC_MAPPING_PAIRED_OR_UNPAIRED_PAIRED + assumptions: + - "f, r are datasets" + - "tool = (i: dataset) => {o: dataset}" + - "C = CollectionInstance" + then: + - "tool(i=map_over(C)) ~> {o: collection data connection" + +- example: + label: BASIC_MAPPING_PAIRED_OR_UNPAIRED_UNPAIRED + assumptions: + - "u is a dataset" + - "tool = (i: dataset) => {o: dataset}" + - "C = CollectionInstance" + then: + - "tool(i=map_over(C)) ~> {o: collection data connection" + - example: label: BASIC_MAPPING_LIST assumptions: @@ -144,19 +168,6 @@ tests: - wf_editor: "rejects paired input on multi-data input" -PAIRED_OR_UNPAIRED_1: - -If tool(i: data) => {o: data} - -tool(i: collection) => {o: collection} - -Mapping a collection of type `paired_or_unpaired` over tool -input i, yields an implicit collection of type `paired_or_unpaired` -composed of the outputs o. - -- toolruntime: test_map_over_data_with_paired_or_unpaired -- wfeditor: it("accepts paired_or_unpaired data -> data connection") - PAIRED_OR_UNPAIRED_2: tool(i: collection) => {o: collection} diff --git a/lib/galaxy_test/api/test_tool_execute.py b/lib/galaxy_test/api/test_tool_execute.py index cedeb4605dc8..5f8339f2ccd8 100644 --- a/lib/galaxy_test/api/test_tool_execute.py +++ b/lib/galaxy_test/api/test_tool_execute.py @@ -381,7 +381,7 @@ def test_map_over_collection( @requires_tool_id("cat|cat1") -def test_map_over_data_with_paired_or_unpaired(target_history: TargetHistory, required_tool: RequiredTool): +def test_map_over_data_with_paired_or_unpaired_unpaired(target_history: TargetHistory, required_tool: RequiredTool): hdca = target_history.with_unpaired() execute = required_tool.execute.with_inputs({"input1": {"batch": True, "values": [hdca.src_dict]}}) execute.assert_has_n_jobs(1).assert_creates_n_implicit_collections(1) @@ -390,6 +390,17 @@ def test_map_over_data_with_paired_or_unpaired(target_history: TargetHistory, re output_collection.assert_has_dataset_element("unpaired").with_contents_stripped("123") +@requires_tool_id("cat|cat1") +def test_map_over_data_with_paired_or_unpaired_paired(target_history: TargetHistory, required_tool: RequiredTool): + hdca = target_history.with_paired_or_unpaired_pair() + execute = required_tool.execute.with_inputs({"input1": {"batch": True, "values": [hdca.src_dict]}}) + execute.assert_creates_n_implicit_collections(1) + output_collection = execute.assert_creates_implicit_collection(0) + output_collection.assert_collection_type_is("paired_or_unpaired") + output_collection.assert_has_dataset_element("forward").with_contents_stripped("123") + output_collection.assert_has_dataset_element("reverse").with_contents_stripped("123") + + @requires_tool_id("cat|cat1") def test_map_over_data_with_list_paired_or_unpaired(target_history: TargetHistory, required_tool: RequiredTool): hdca = target_history.with_list_of_paired_and_unpaired() diff --git a/lib/galaxy_test/base/populators.py b/lib/galaxy_test/base/populators.py index 8380f74d6cac..25a7edc4e0a3 100644 --- a/lib/galaxy_test/base/populators.py +++ b/lib/galaxy_test/base/populators.py @@ -3097,6 +3097,11 @@ def create_unpaired_in_history(self, history_id: str, wait: bool = False, **kwds payload = self.__create_payload(history_id, contents=contents, collection_type="paired_or_unpaired", **kwds) return self.__create(payload, wait=wait) + def create_paired_or_unpaired_pair_in_history(self, history_id: str, wait: bool = False, **kwds): + contents = [("forward", "123"), ("reverse", "456")] + payload = self.__create_payload(history_id, contents=contents, collection_type="paired_or_unpaired", **kwds) + return self.__create(payload, wait=wait) + def create_list_of_paired_and_unpaired_in_history(self, history_id: str, wait: bool = False, **kwds): contents = [ { @@ -3983,6 +3988,11 @@ def with_unpaired(self) -> "HasSrcDict": self._dataset_collection_populator.create_unpaired_in_history(self._history_id, wait=True) ) + def with_paired_or_unpaired_pair(self) -> "HasSrcDict": + return self._fetch_response( + self._dataset_collection_populator.create_paired_or_unpaired_pair_in_history(self._history_id, wait=True) + ) + def with_list_of_paired_and_unpaired(self) -> "HasSrcDict": return self._fetch_response( self._dataset_collection_populator.create_list_of_paired_and_unpaired_in_history(