-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.nf
82 lines (65 loc) · 1.63 KB
/
main.nf
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/usr/bin/env nextflow
// Default params
params.merge_mafs = false
params.input_dir = ""
params.output_dir = "outputs"
// Parameter checking
if (!params.input_dir) {
error("No input directory provided --input_dir")
exit 1
}
// Process sudmodule
process annotateMaf {
input:
path maf_file
output:
publishDir "${params.output_dir}/annotated_mafs"
path "${maf_file.baseName}.annotated.maf"
stub:
"""
touch "${maf_file.baseName}.annotated.maf"
"""
script:
"""
gnap --filename ${maf_file} --output-filename "${maf_file.baseName}.annotated.maf"
"""
}
// Process submodule
process annotateMergedMafs {
input:
path input // A directory containing all MAFs to merge OR a comma-delimited list of MAFs to merge
output:
path test // Output filename for merged MAF [REQUIRED]
script:
"""
gnap merge --input-mafs-directory ${input_maf} --output-maf ${output_filename}
gnap merge --input-mafs-list ${input_maf} --output-maf ${output_filename}
"""
stub:
"""
"""
}
// Named subworkflow
workflow annotate_mafs {
take:
mafs
main:
annotateMaf(mafs)
}
// Main implicit workflow
workflow {
println "$params"
mafs = Channel.fromPath("${params.input_dir}/*.txt", checkIfExists: true)
annotate_mafs(mafs)
}
workflow.onComplete {
println "Pipeline completed at: $workflow.complete"
println "Execution status: ${ workflow.success ? 'OK' : 'failed' }"
}
workflow.onError {
println "Error: Pipeline execution stopped with the following message: ${workflow.errorMessage}"
}
// REQUIRES EDGE RELEASE: nextflow.preview.output
// output {
// directory 'outputs'
// }