diff --git a/workflows/auxiliary/connect-optional-dataset/.dockstore.yml b/workflows/auxiliary/connect-optional-dataset/.dockstore.yml new file mode 100644 index 0000000000..33bf070bce --- /dev/null +++ b/workflows/auxiliary/connect-optional-dataset/.dockstore.yml @@ -0,0 +1,12 @@ +version: 1.2 +workflows: +- name: main + subclass: Galaxy + publish: true + primaryDescriptorPath: /Treat-optional-workflow-input.ga + testParameterFiles: + - /Treat-optional-workflow-input-tests.yml + authors: + - name: Matthias Bernt + orcid: 0000-0003-3763-0797 + - name: UFZ Leipzig diff --git a/workflows/auxiliary/connect-optional-dataset/Treat-optional-workflow-input-tests.yml b/workflows/auxiliary/connect-optional-dataset/Treat-optional-workflow-input-tests.yml new file mode 100644 index 0000000000..fedf172fa8 --- /dev/null +++ b/workflows/auxiliary/connect-optional-dataset/Treat-optional-workflow-input-tests.yml @@ -0,0 +1,27 @@ +- doc: Test with no dataset given + job: + Optional input: null + outputs: + data_param: + asserts: + has_n_line: + value: 1 + output_param_boolean: + asserts: + has_line: + line: "false" +- doc: test with dataset given + job: + Optional input: + class: File + path: test-data/test.txt + filetype: txt + outputs: + data_param: + asserts: + has_n_lines: + value: 0 + output_param_boolean: + asserts: + has_line: + line: "true" diff --git a/workflows/auxiliary/connect-optional-dataset/Treat-optional-workflow-input.ga b/workflows/auxiliary/connect-optional-dataset/Treat-optional-workflow-input.ga new file mode 100644 index 0000000000..94cf9b1023 --- /dev/null +++ b/workflows/auxiliary/connect-optional-dataset/Treat-optional-workflow-input.ga @@ -0,0 +1,198 @@ +{ + "a_galaxy_workflow": "true", + "annotation": "A helper workflow that creates\n\n- a boolean output that is True if the input is given and False otherwise\n- a non-optional output which is the optional input in case it is given and an empty mock dataset otherwise.\n\nThis allows to connect a non-optional input dataset to a non-optional tool input for a tool that is conditionally executed based on the presence of an optional dataset. The conditional execution of this tool can be done with the boolean output and the (non-optional) data output can be used for the tool's file input", + "creator": [ + { + "class": "Person", + "identifier": "0000-0003-3763-0797", + "name": "Matthias Bernt" + }, + { + "class": "Organization", + "name": "UFZ Leipzig" + } + ], + "format-version": "0.1", + "license": "MIT", + "name": "Treat optional workflow input", + "steps": { + "0": { + "annotation": "An optional input dataset", + "content_id": null, + "errors": null, + "id": 0, + "input_connections": {}, + "inputs": [ + { + "description": "An optional input dataset", + "name": "Optional input" + } + ], + "label": "Optional input", + "name": "Input dataset", + "outputs": [], + "position": { + "left": 0, + "top": 179 + }, + "tool_id": null, + "tool_state": "{\"optional\": true, \"tag\": null}", + "tool_version": null, + "type": "data_input", + "uuid": "146af087-32ae-487c-92bb-56c5fb678936", + "when": null, + "workflow_outputs": [] + }, + "1": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/bgruening/text_processing/tp_text_file_with_recurring_lines/1.1.0", + "errors": null, + "id": 1, + "input_connections": {}, + "inputs": [], + "label": null, + "name": "Create text file", + "outputs": [ + { + "name": "outfile", + "type": "txt" + } + ], + "position": { + "left": 224, + "top": 331 + }, + "post_job_actions": { + "DeleteIntermediatesActionoutfile": { + "action_arguments": {}, + "action_type": "DeleteIntermediatesAction", + "output_name": "outfile" + } + }, + "tool_id": "toolshed.g2.bx.psu.edu/repos/bgruening/text_processing/tp_text_file_with_recurring_lines/1.1.0", + "tool_shed_repository": { + "changeset_revision": "fb4ff3c42cd3", + "name": "text_processing", + "owner": "bgruening", + "tool_shed": "toolshed.g2.bx.psu.edu" + }, + "tool_state": "{\"token_set\": [{\"__index__\": 0, \"line\": null, \"repeat_select\": {\"repeat_select_opts\": \"user\", \"__current_case__\": 0, \"times\": \"1\"}}], \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "1.1.0", + "type": "tool", + "uuid": "5626df9a-0ef9-423e-9482-97327756c587", + "when": null, + "workflow_outputs": [] + }, + "2": { + "annotation": "", + "content_id": "toolshed.g2.bx.psu.edu/repos/iuc/map_param_value/map_param_value/0.2.0", + "errors": null, + "id": 2, + "input_connections": { + "input_param_type|input_param": { + "id": 0, + "output_name": "output" + } + }, + "inputs": [], + "label": "Check if optional input is given", + "name": "Map parameter value", + "outputs": [ + { + "name": "output_param_boolean", + "type": "expression.json" + } + ], + "position": { + "left": 473, + "top": 0 + }, + "post_job_actions": { + "DeleteIntermediatesActionoutput_param_boolean": { + "action_arguments": {}, + "action_type": "DeleteIntermediatesAction", + "output_name": "output_param_boolean" + } + }, + "tool_id": "toolshed.g2.bx.psu.edu/repos/iuc/map_param_value/map_param_value/0.2.0", + "tool_shed_repository": { + "changeset_revision": "5ac8a4bf7a8d", + "name": "map_param_value", + "owner": "iuc", + "tool_shed": "toolshed.g2.bx.psu.edu" + }, + "tool_state": "{\"input_param_type\": {\"type\": \"data\", \"__current_case__\": 4, \"input_param\": {\"__class__\": \"ConnectedValue\"}, \"mappings\": [{\"__index__\": 0, \"from\": {\"__class__\": \"RuntimeValue\"}, \"to\": \"False\"}]}, \"output_param_type\": \"boolean\", \"unmapped\": {\"on_unmapped\": \"default\", \"__current_case__\": 2, \"default_value\": \"True\"}, \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "0.2.0", + "type": "tool", + "uuid": "d38e28df-04de-4e11-98d7-0eacfaaec15a", + "when": null, + "workflow_outputs": [ + { + "label": "output_param_boolean", + "output_name": "output_param_boolean", + "uuid": "0c0e0832-073b-4244-acb0-db30533827c2" + } + ] + }, + "3": { + "annotation": "by providing an empty mock dataset.", + "content_id": "toolshed.g2.bx.psu.edu/repos/iuc/pick_value/pick_value/0.1.0", + "errors": null, + "id": 3, + "input_connections": { + "style_cond|type_cond|pick_from_0|value": { + "id": 0, + "output_name": "output" + }, + "style_cond|type_cond|pick_from_1|value": { + "id": 1, + "output_name": "outfile" + } + }, + "inputs": [], + "label": "Make optional input non-optional", + "name": "Pick parameter value", + "outputs": [ + { + "name": "data_param", + "type": "data" + } + ], + "position": { + "left": 478, + "top": 237 + }, + "post_job_actions": { + "ChangeDatatypeActiondata_param": { + "action_arguments": { + "newtype": "fasta.gz" + }, + "action_type": "ChangeDatatypeAction", + "output_name": "data_param" + } + }, + "tool_id": "toolshed.g2.bx.psu.edu/repos/iuc/pick_value/pick_value/0.1.0", + "tool_shed_repository": { + "changeset_revision": "bf793b71559a", + "name": "pick_value", + "owner": "iuc", + "tool_shed": "toolshed.g2.bx.psu.edu" + }, + "tool_state": "{\"style_cond\": {\"pick_style\": \"first\", \"__current_case__\": 0, \"type_cond\": {\"param_type\": \"data\", \"__current_case__\": 4, \"pick_from\": [{\"__index__\": 0, \"value\": {\"__class__\": \"ConnectedValue\"}}, {\"__index__\": 1, \"value\": {\"__class__\": \"ConnectedValue\"}}]}}, \"__page__\": null, \"__rerun_remap_job_id__\": null}", + "tool_version": "0.1.0", + "type": "tool", + "uuid": "e7fb4cc5-7134-460f-a5e8-0357142e98af", + "when": null, + "workflow_outputs": [ + { + "label": "data_param", + "output_name": "data_param", + "uuid": "cb1c0508-bfc0-42c1-8acf-3191e3445b4b" + } + ] + } + }, + "tags": [], + "uuid": "c09e8835-2ca2-4a57-a203-319697be2596", + "version": 6 +} \ No newline at end of file diff --git a/workflows/auxiliary/connect-optional-dataset/test-data/test.txt b/workflows/auxiliary/connect-optional-dataset/test-data/test.txt new file mode 100644 index 0000000000..9daeafb986 --- /dev/null +++ b/workflows/auxiliary/connect-optional-dataset/test-data/test.txt @@ -0,0 +1 @@ +test