From fd778c4258811c25c6fdf952fc8abf33de40a6e7 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Mon, 16 Dec 2024 15:31:38 +0100 Subject: [PATCH 1/6] fix docs for format_source Reference to parameters in sections and conditionals needs to be qualified with `|`. Collection elements can be referred to using element access syntax. --- lib/galaxy/tool_util/xsd/galaxy.xsd | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/tool_util/xsd/galaxy.xsd b/lib/galaxy/tool_util/xsd/galaxy.xsd index cd3fa9df84cb..b3d65a126f02 100644 --- a/lib/galaxy/tool_util/xsd/galaxy.xsd +++ b/lib/galaxy/tool_util/xsd/galaxy.xsd @@ -3801,7 +3801,7 @@ In output filters sections are represented as dictionary with the same name as t In order to reference parameters in sections from tags in the `` section, e.g. in the `format_source` attribute of `` tags, the syntax is currently: ``` - + ``` Note that references to other parameters in the `` section are only possible if the reference is in the same section or its parents (and is defined earlier), therefore only `parameter_name` is used. @@ -5949,7 +5949,7 @@ discovered data sets on Galaxy versions prior to 24.0 and should be specified us - This sets the data type of the output dataset(s) to be the same format as that of the specified tool input. + This sets the data type of the output dataset(s) to be the same format as that of the specified tool input. References to parameters in sections or conditionals must be qualified using ``|`` syntax. Elements of collection parameters can be referred to by pythons element access syntax. @@ -6063,8 +6063,10 @@ same as that of the input dataset selected (and named ``input1``) for the tool. The following will create datasets in the history panel, setting the output data type to be the same as that of an input dataset named by the ``format_source`` -attribute. Note that a conditional name is not included, so 2 separate -conditional blocks should not contain parameters with the same name. +attribute. If the parameter is contained in sections or conditionals they need +to be listed separated by ``|``. If the referred parameter is a collection, collection +elements can be referred python's element access syntax, e.g. ``input_collection["forward"]`` +would refer to the forward dataset of a paired collection. ```xml @@ -6085,7 +6087,7 @@ conditional blocks should not contain parameters with the same name. - qual['add'] == 'yes' From 5a06678bc4806af7f26af30a312611eedce9f008 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Wed, 18 Dec 2024 10:24:50 +0100 Subject: [PATCH 2/6] fix test and improve for legacy mapping the test for the nesting case accidentally works since the [legacy_mapping](https://github.com/galaxyproject/galaxy/blob/16ec912385b59429b1e87cebb817ec012b02ec4e/lib/galaxy/tools/parameters/wrapped.py#L43) contains a wrong mapping. with the output2 we can now test this. with output3 we now also test that the legacy behavior works. --- .../tools/format_source_in_conditional.xml | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/test/functional/tools/format_source_in_conditional.xml b/test/functional/tools/format_source_in_conditional.xml index 4332c06971fc..c3ffe0c70728 100644 --- a/test/functional/tools/format_source_in_conditional.xml +++ b/test/functional/tools/format_source_in_conditional.xml @@ -1,5 +1,9 @@ - cp '$input1' '$output1' + @@ -15,14 +19,16 @@ - + - + + + @@ -31,15 +37,19 @@ + + - + - + + + From 1a98d35d25983c6d88b18f3a270c461107e06d90 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Wed, 18 Dec 2024 10:30:34 +0100 Subject: [PATCH 3/6] temporary debug code --- lib/galaxy/tools/actions/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/galaxy/tools/actions/__init__.py b/lib/galaxy/tools/actions/__init__.py index 841eea988d49..5727fc538b7b 100644 --- a/lib/galaxy/tools/actions/__init__.py +++ b/lib/galaxy/tools/actions/__init__.py @@ -1180,6 +1180,7 @@ def determine_output_format( pass ext = random_input_ext format_source = output.format_source + log.error(f"{format_source=} {input_datasets=} {format_source in input_datasets=}") if format_source is not None and format_source in input_datasets: try: input_dataset = input_datasets[output.format_source] From b7a6995c47ef010a614c3d84d44eadc6675e0b93 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Wed, 18 Dec 2024 10:30:53 +0100 Subject: [PATCH 4/6] more temporary debug code --- lib/galaxy/tools/parameters/wrapped.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/galaxy/tools/parameters/wrapped.py b/lib/galaxy/tools/parameters/wrapped.py index d23e9be5edf9..38c574997ddd 100644 --- a/lib/galaxy/tools/parameters/wrapped.py +++ b/lib/galaxy/tools/parameters/wrapped.py @@ -1,4 +1,5 @@ from collections import UserDict +import logging from typing import ( Any, Dict, @@ -30,6 +31,7 @@ split_flattened_repeat_key, ) +log = logging.getLogger(__name__) PARAMS_UNWRAPPED = object() @@ -47,11 +49,13 @@ def set_legacy_alias(self, new_key: str, old_key: str): self._legacy_mapping[old_key] = new_key def __getitem__(self, key): + # log.error(f"__getitem__ {key=} {self.data=} {self._legacy_mapping=}") if key not in self.data and key in self._legacy_mapping: return super().__getitem__(self._legacy_mapping[key]) return super().__getitem__(key) def __contains__(self, key: object) -> bool: + log.error(f"__contains__ {key=} {self.data=} {self._legacy_mapping=}") if super().__contains__(key): return True return key in self._legacy_mapping From 25ae0ce02552db16cde1e8f7be97e823d2af4669 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Wed, 18 Dec 2024 10:36:17 +0100 Subject: [PATCH 5/6] fix debug code --- lib/galaxy/tools/parameters/wrapped.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/galaxy/tools/parameters/wrapped.py b/lib/galaxy/tools/parameters/wrapped.py index 38c574997ddd..16ce1f32b284 100644 --- a/lib/galaxy/tools/parameters/wrapped.py +++ b/lib/galaxy/tools/parameters/wrapped.py @@ -1,5 +1,5 @@ -from collections import UserDict import logging +from collections import UserDict from typing import ( Any, Dict, From 3dfb9f136f4d0be6e3a308ae2233ea1bb3f99f71 Mon Sep 17 00:00:00 2001 From: Matthias Bernt Date: Wed, 18 Dec 2024 11:16:37 +0100 Subject: [PATCH 6/6] fix test --- test/functional/tools/format_source_in_conditional.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/functional/tools/format_source_in_conditional.xml b/test/functional/tools/format_source_in_conditional.xml index c3ffe0c70728..7bf0de04e5bd 100644 --- a/test/functional/tools/format_source_in_conditional.xml +++ b/test/functional/tools/format_source_in_conditional.xml @@ -26,7 +26,7 @@ - + @@ -47,9 +47,9 @@ - + - +