From 8a5b1de1074b44fb1fea816761320c72418e8cb6 Mon Sep 17 00:00:00 2001 From: Robrecht Cannoodt Date: Wed, 17 Jul 2024 12:57:09 +0200 Subject: [PATCH] update wf --- resources_test/params.yaml | 5 +++++ src/template/workflow/main.nf | 24 +++++++++++++++++++----- 2 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 resources_test/params.yaml diff --git a/resources_test/params.yaml b/resources_test/params.yaml new file mode 100644 index 0000000..13c3627 --- /dev/null +++ b/resources_test/params.yaml @@ -0,0 +1,5 @@ +param_list: + - id: file1 + input: resources_test/file1.tsv + - id: file2 + input: resources_test/file2.tsv \ No newline at end of file diff --git a/src/template/workflow/main.nf b/src/template/workflow/main.nf index 4c8069a..4ee4f93 100644 --- a/src/template/workflow/main.nf +++ b/src/template/workflow/main.nf @@ -5,12 +5,16 @@ workflow run_wf { main: output_ch = input_ch + | view{"input: $it"} + // Remove comments from each TSV input file | remove_comments.run( fromState: [ input: "input" ], toState: [ output: "output" ] ) + | view{"after remove_comments: $it"} + // Extract a single column from each TSV // The column to extract is specified in the sample sheet | take_column.run( @@ -21,26 +25,36 @@ workflow run_wf { toState: [ output: "output" ] ) + | view{"after take_column: $it"} + // Combine the given tuples into one | toSortedList - | map { list -> + | map { state_list -> def new_id = "combined" def new_state = [ - input = list.collect{ id, state -> state.output }, - _meta: [ join_id: list[0][1] ] + input: state_list.collect{ id, state -> state.output }, + _meta: [ join_id: state_list[0][0] ] ] [ new_id, new_state ] } + | view{"before combine_columns: $it"} + // Concatenate TSVs into one // and prep the output state. | combine_columns.run( auto: [ publish: true ], - fromState: [ input: "output" ], - toState: { id, result, state -> result } + fromState: [ input: "input" ], + toState: ["output": "output"] ) + | view{"after combine_columns: $it"} + + // make sure the output state only contains + // a value called 'output' and '_meta' + | setState(["output", "_meta"]) + emit: output_ch } \ No newline at end of file