Unverified Commit c6267d69 authored by mjosse's avatar mjosse Committed by davelopez
Browse files

imrpove ro-crate with eli's review

parent 95104409
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -311,6 +311,7 @@ class WorkflowRunCrateProfileBuilder:
                            "position": position[0],
                            "name": step.tool_id,
                            "description": step_description,
                            "workExample": f"#{step.tool_id}"
                        },
                    )
                )
@@ -359,13 +360,12 @@ class WorkflowRunCrateProfileBuilder:
                    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
                            },
                        )
                    )
@@ -375,7 +375,7 @@ class WorkflowRunCrateProfileBuilder:

                # 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":
+1 −2
Original line number Diff line number Diff line
@@ -516,7 +516,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()
@@ -524,7 +524,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)