Repository navigation
Implement serialization to Galaxy Format 2 - #3
Conversation
| force-single-line = true | ||
|
|
||
| [project.entry-points."ewoks.engines"] | ||
| "gxwf" = "ewoksgalaxy.engine:GalaxyWorkflowEngine" |
There was a problem hiding this comment.
I choose gxwf to reuse the acronym from the gxformat2 package: https://github.com/galaxyproject/gxformat2?tab=readme-ov-file#gxformat2
I dismissed the other alternative .ga since it refers to the "classic" Galaxy format for which there is no spec.
| [tool.ruff.lint.per-file-ignores] | ||
| # Ignore `S101` (assert used violations) in all test files | ||
| "*/test_*.py" = ["S101"] | ||
| "*/test_*.py" = ["S101", "S603"] |
There was a problem hiding this comment.
To allow subprocess.run in the tests
| ] | ||
| requires-python = ">=3.10" | ||
| dependencies = ["ewokscore"] | ||
| dependencies = ["ewokscore", "ruamel.yaml", "gxformat2"] |
There was a problem hiding this comment.
gxformat2 is only used in the tests for now to lint the converted workflows but I plan to use it in the functional code later.
There was a problem hiding this comment.
Also, I didn't realize that pyyaml was part of the deps of ewokscore. I'll replace ruamel.yaml for pyyaml after the review.
| "inputs": [], # TODO | ||
| "outputs": [], # TODO |
There was a problem hiding this comment.
According to the specs, these are required but I am still unsure about what to put inside.
| if label is not None: | ||
| step["label"] = label | ||
|
|
||
| default_inputs = node.get("default_inputs") |
There was a problem hiding this comment.
The "state" of a tool can be stored in tool_state (raw JSON string) or in state (structured YAML mapping).
I choose to store in state to ease readability.
eab80ac to
8c85bbc
Compare
| galaxy_step_indices: dict[str, int] = {} | ||
| for i, node in enumerate(graph_dict["nodes"]): | ||
| steps.append(_ewoks_node_to_galaxy_step(node)) | ||
| galaxy_step_indices[node["id"]] = i |
There was a problem hiding this comment.
As Orange, Galaxy can only have integers as id. Steps can be stored either as a map with int as keys or an array. I chose the latter.
Note that I keep a mapping between ewoks ids (str) and galaxy ids (int) so I can correctly distribute the data mapping when converting links to galaxy inputs.
| if "in" not in steps[target_id]: | ||
| steps[target_id]["in"] = {} | ||
| steps[target_id]["in"].update( | ||
| _ewoks_link_to_galaxy_input(link, galaxy_step_indices) |
There was a problem hiding this comment.
Data mapping in Galaxy is included in the target node under in key.
The in value is a dictionary with target_input as key and {source: id/source_output} as value:
- in:
a: {source: 0/result}
b: {source: 1/result}
delay: {source: 1/result}
2412ab1 to
f07e3b3
Compare
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
f07e3b3 to
bdfcc8f
Compare
bdfcc8f to
cd832bc
Compare
For #1
Based on https://galaxyproject.github.io/gxformat2/v19_09.html
The workflow from
test_engineimports fine in Galaxy so I guess that's a win?Here is the converted workflow for reference: