-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.nf
More file actions
55 lines (47 loc) · 1.28 KB
/
main.nf
File metadata and controls
55 lines (47 loc) · 1.28 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
include { findArgumentSchema } from "${meta.resources_dir}/helper.nf"
workflow auto {
findStates(params, meta.config)
| meta.workflow.run(
auto: [publish: "state"]
)
}
workflow run_wf {
take:
input_ch
main:
output_ch = input_ch
| check_dataset_with_schema.run(
fromState: { id, state ->
def schema = findArgumentSchema(meta.config, "input")
def schemaYaml = tempFile("schema.yaml")
writeYaml(schema, schemaYaml)
[
"input": state.input,
"schema": schemaYaml
]
},
toState: { id, output, state ->
// read the output to see if dataset passed the qc
def checks = readYaml(output.output)
state + [
"dataset": checks["exit_code"] == 0 ? state.input : null,
]
}
)
// remove datasets which didn't pass the schema check
| filter { id, state ->
state.dataset != null
}
| process_dataset.run(
fromState: [ input: "dataset" ],
toState: [
output_train: "output_train",
output_test: "output_test",
output_solution: "output_solution"
]
)
// only output the files for which an output file was specified
| setState(["output_train", "output_test", "output_solution"])
emit:
output_ch
}