From f1b404ddc03854f88f151823a4abd06e856dcf64 Mon Sep 17 00:00:00 2001 From: mjosse Date: Mon, 23 Dec 2024 09:51:32 +0100 Subject: [PATCH] imrpove ro-crate with eli's review --- lib/galaxy/model/store/ro_crate_utils.py | 6 +++--- test/unit/data/model/test_model_store.py | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/galaxy/model/store/ro_crate_utils.py b/lib/galaxy/model/store/ro_crate_utils.py index 90fb617d3ec1..c53601fd8357 100644 --- a/lib/galaxy/model/store/ro_crate_utils.py +++ b/lib/galaxy/model/store/ro_crate_utils.py @@ -309,6 +309,7 @@ def _add_steps_recursive(self, steps, crate: ROCrate, step_entities, position): "position": position[0], "name": step.tool_id, "description": step_description, + "workExample": f"#{step.tool_id}" }, ) ) @@ -357,13 +358,12 @@ def _add_tools_recursive(self, steps, crate: ROCrate, tool_entities): tool_entity = crate.add( ContextEntity( crate, - tool_id, + f"#{tool_id}", # Prepend # to tool_id properties={ "@type": "SoftwareApplication", "name": tool_name, "version": tool_version, "description": tool_description, - "url": "https://toolshed.g2.bx.psu.edu", # URL if relevant }, ) ) @@ -373,7 +373,7 @@ def _add_tools_recursive(self, steps, crate: ROCrate, tool_entities): # Append the tool entity to the workflow (instrument) and store it in the list tool_entities.append(tool_entity) - crate.mainEntity.append_to("instrument", tool_entity) + crate.mainEntity.append_to("hasPart", tool_entity) # Handle subworkflows recursively elif step.type == "subworkflow": diff --git a/test/unit/data/model/test_model_store.py b/test/unit/data/model/test_model_store.py index fd874732da24..52a0ffa4e049 100644 --- a/test/unit/data/model/test_model_store.py +++ b/test/unit/data/model/test_model_store.py @@ -518,7 +518,7 @@ def validate_tools(ro_crate: ROCrate): """ Validate that tools (SoftwareApplication) are correctly added. """ - tools = ro_crate.mainEntity.get("instrument") + tools = ro_crate.mainEntity.get("hasPart") assert tools, "No tools found in the RO-Crate" tool_ids = set() @@ -526,7 +526,6 @@ def validate_tools(ro_crate: ROCrate): assert tool["@type"] == "SoftwareApplication" assert "name" in tool assert "version" in tool - assert "url" in tool assert "description" in tool or tool["description"] is None assert tool.id not in tool_ids, "Duplicate tool found" tool_ids.add(tool.id)