Skip to content

Commit

Permalink
Merge pull request #100 from mvdbeek/arrays_of_workflow_input_parameters
Browse files Browse the repository at this point in the history
Arrays of workflow input parameters
  • Loading branch information
jmchilton authored Aug 21, 2024
2 parents 58e830b + d3854af commit ee25b57
Show file tree
Hide file tree
Showing 112 changed files with 8,833 additions and 1,260 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
max-parallel: 4
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
Expand Down
16 changes: 8 additions & 8 deletions docs/design.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

## Goals

1) gxformat2 should be human readable and writable
1) gxformat2 should be able to be consumed by Galaxy without access to a Galaxy toolbox
1) gxformat2 should be convertible to Galaxy's original workflow format without a Galaxy runtime
1) gxformat2 should align with workflows standards (and specifically the Common Workflow Langauge) when it is pratical
1) We will work on solidifying a version of gxformat2 called 19.09 that is compatible with the workflow models in
Galaxy versions 19.09-24.1 and which can be fixed for older versions with just a gxformat2 dependency upgrade.
At some point in the future there will be a new a version for implementation ideas
the require changes to the Galaxy model.
- gxformat2 should be human readable and writable
- gxformat2 should be able to be consumed by Galaxy without access to a Galaxy toolbox
- gxformat2 should be convertible to Galaxy's original workflow format without a Galaxy runtime
- gxformat2 should align with workflows standards (and specifically the Common Workflow Langauge) when it is pratical
- We will work on solidifying a version of gxformat2 called 19.09 that is compatible with the workflow models in
Galaxy versions 19.09-24.1 and which can be fixed for older versions with just a gxformat2 dependency upgrade.
At some point in the future there will be a new a version for implementation ideas
the require changes to the Galaxy model.

## Specific

Expand Down
5 changes: 2 additions & 3 deletions gxformat2/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,8 @@ def transform_input(context, step, default_name):
"name": name,
"description": "",
})
tool_state = {
"name": name
}
tool_state = step.get("tool_state", {})
tool_state["name"] = name
for attrib in ["collection_type", "parameter_type", "optional", "default", "format", "restrictions", "restrictOnConnections", "suggestions"]:
if attrib in step:
tool_state[attrib] = step[attrib]
Expand Down
11 changes: 10 additions & 1 deletion gxformat2/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ def prune_position(step):
return {k: v for k, v in step.get('position', {}).items() if k in ('left', 'top')}


def native_input_to_format2_type(step: dict, tool_state: dict) -> str:
def native_input_to_format2_type(step: dict, tool_state: dict) -> Union[str, List[str]]:
"""Return a Format2 input type ('type') from a native input step dictionary."""
module_type = step.get("type")
if module_type == 'data_collection_input':
Expand All @@ -254,6 +254,8 @@ def native_input_to_format2_type(step: dict, tool_state: dict) -> str:
format2_type = "int"
elif native_type == "text":
format2_type = "string"
if tool_state.get("multiple", False):
return [format2_type]
return format2_type


Expand Down Expand Up @@ -330,6 +332,13 @@ def inputs_as_native_steps(workflow_dict: dict):
raise Exception("Input label must not be empty.")

input_type = input_def.pop("type", "data")
if isinstance(input_type, list):
if len(input_type) != 1:
raise Exception("Only simple arrays of workflow inputs are currently supported")
input_type = input_type[0]
if input_type in ["File", "data", "data_input"]:
raise Exception(f"Array of {input_type} is not supported")
input_def["tool_state"] = {"multiple": True}
if input_type in ["File", "data", "data_input"]:
step_type = "data_input"
elif input_type in ["collection", "data_collection", "data_collection_input"]:
Expand Down
Loading

0 comments on commit ee25b57

Please sign in to comment.