Skip to content

Commit

Permalink
Allow DCE as outer input to to_cwl
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdbeek committed Jun 7, 2024
1 parent bd4a529 commit dff6307
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/galaxy/workflow/modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ def to_cwl(value, hda_references, step):
element_identifier = None
if isinstance(value, model.HistoryDatasetCollectionAssociation):
value = value.collection
if isinstance(value, model.DatasetCollectionElement) and value.hda:
if isinstance(value, model.DatasetCollectionElement):
element_identifier = value.element_identifier
value = value.hda
value = value.element_object
if isinstance(value, model.HistoryDatasetAssociation):
# I think the following two checks are needed but they may
# not be needed.
Expand Down
12 changes: 12 additions & 0 deletions test/unit/workflows/test_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,18 @@ def test_to_cwl_nested_collection():
assert result["outer"][0]["basename"] == "inner"


def test_to_cwl_dataset_collection_element():
hda = model.HistoryDatasetAssociation(create_dataset=True, flush=False)
hda.dataset.state = model.Dataset.states.OK
dc_inner = model.DatasetCollection(collection_type="list")
model.DatasetCollectionElement(collection=dc_inner, element_identifier="inner", element=hda)
dc_outer = model.DatasetCollection(collection_type="list:list")
dce_outer = model.DatasetCollectionElement(collection=dc_outer, element_identifier="outer", element=dc_inner)
result = modules.to_cwl(dce_outer, [], model.WorkflowStep())
assert result[0]["class"] == "File"
assert result[0]["basename"] == "inner"


class MapOverTestCase(NamedTuple):
data_input: str
step_input_def: Union[str, List[str]]
Expand Down

0 comments on commit dff6307

Please sign in to comment.