Skip to content

Commit

Permalink
update wf
Browse files Browse the repository at this point in the history
  • Loading branch information
rcannood committed Jul 17, 2024
1 parent 93b1348 commit 8a5b1de
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
5 changes: 5 additions & 0 deletions resources_test/params.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
param_list:
- id: file1
input: resources_test/file1.tsv
- id: file2
input: resources_test/file2.tsv
24 changes: 19 additions & 5 deletions src/template/workflow/main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
}

0 comments on commit 8a5b1de

Please sign in to comment.