Skip to content

Commit 7cbe36c

Browse files
authored
Merge pull request galaxyproject#22287 from mvdbeek/fix-nested-dce-dynamic-option-filter
[26.0] Fix nested DatasetCollectionElement in dynamic options
2 parents 20fcebf + 07440fa commit 7cbe36c

2 files changed

Lines changed: 24 additions & 4 deletions

File tree

lib/galaxy/tools/parameters/dynamic_options.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1079,10 +1079,10 @@ def _get_ref_data(other_values, ref_name):
10791079
if is_runtime_value(ref):
10801080
return []
10811081
raise ValueError
1082-
if isinstance(ref, DatasetCollectionElement) and ref.hda:
1083-
ref = ref.hda
1082+
if isinstance(ref, DatasetCollectionElement):
1083+
return ref.dataset_instances
10841084
if isinstance(ref, (DatasetFilenameWrapper, HistoryDatasetAssociation, LibraryDatasetDatasetAssociation)):
1085-
ref = [ref]
1085+
return [ref]
10861086
elif isinstance(ref, HistoryDatasetCollectionAssociation):
1087-
ref = ref.to_hda_representative(multiple=True)
1087+
return ref.to_hda_representative(multiple=True)
10881088
return ref

lib/galaxy_test/api/test_tools.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,26 @@ def test_build_request_dbkey_filter_unset(self):
286286
assert "hg18_value" in option_values
287287
assert "mm10_value" in option_values
288288

289+
@skip_without_tool("dbkey_filter_collection_input")
290+
def test_run_dbkey_filter_nested_collection_dce(self):
291+
with self.dataset_populator.test_history() as history_id:
292+
list_list = self.dataset_collection_populator.create_list_of_list_in_history(history_id, wait=True).json()
293+
# Set dbkey on the datasets in the inner list
294+
for outer_element in list_list["elements"]:
295+
for inner_element in outer_element["object"]["elements"]:
296+
hda_id = inner_element["object"]["id"]
297+
self.dataset_populator._put(
298+
f"histories/{history_id}/contents/{hda_id}", {"genome_build": "hg19"}, json=True
299+
)
300+
# Get DCE ID of the inner list element - this is a DatasetCollectionElement
301+
# wrapping a child collection (not an HDA)
302+
dce_id = list_list["elements"][0]["id"]
303+
inputs = {
304+
"inputs": {"src": "dce", "id": dce_id},
305+
"index": "hg19_value",
306+
}
307+
self._run("dbkey_filter_collection_input", history_id, inputs, assert_ok=True)
308+
289309
@skip_without_tool("cheetah_problem_unbound_var_input")
290310
def test_legacy_biotools_xref_injection(self):
291311
url = self._api_url("tools/cheetah_problem_unbound_var_input")

0 commit comments

Comments
 (0)