forked from fmalmeida/MpGAP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.nf
82 lines (66 loc) · 2.68 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
nextflow.enable.dsl=2
import org.yaml.snakeyaml.Yaml
/*
* Generic multiplatform genome assembly pipeline (MpGAP)
*/
/*
========================================================================================
VALIDATE & PRINT PARAMETER SUMMARY
========================================================================================
*/
WorkflowMpGAP.initialise(params, log)
WorkflowMain.initialise(workflow, params, log)
/*
========================================================================================
LOAD WORKFLOWS
========================================================================================
*/
include { PARSE_SAMPLESHEET } from './workflows/parse_samples.nf'
include { ASSEMBLY_QC } from './workflows/assembly_qc.nf'
include { SHORTREADS_ONLY } from './workflows/short-reads-only.nf'
include { LONGREADS_ONLY } from './workflows/long-reads-only.nf'
include { HYBRID } from './workflows/hybrid.nf'
/*
========================================================================================
DEFINE MAIN WORKFLOW
========================================================================================
*/
workflow {
// Message to user
println("""
Launching defined workflows!
By default, all workflows will appear in the console "log" message.
However, the processes of each workflow will be launched based on the inputs received.
You can see that processes that were not launched have an empty [- ].
""")
// Load YAML
samplesheet_yaml = file(params.input)
parameter_yaml = samplesheet_yaml.readLines().join("\n")
new Yaml().load(parameter_yaml).each { k, v -> params[k] = v }
// Copy YAML samplesheet to output directory so user has a copy of it
file(params.output).mkdir()
samplesheet_yaml.copyTo(params.output + "/" + "${samplesheet_yaml.getName()}")
// Parse YAML file
PARSE_SAMPLESHEET( params.samplesheet )
// short reads only samples
SHORTREADS_ONLY( PARSE_SAMPLESHEET.out.shortreads )
// long reads only samples
LONGREADS_ONLY( PARSE_SAMPLESHEET.out.longreads )
// hybrid samples
HYBRID( PARSE_SAMPLESHEET.out.hybrid )
// QC
ASSEMBLY_QC( SHORTREADS_ONLY.out.mix( LONGREADS_ONLY.out, HYBRID.out ) )
}
/*
* Completition message
*/
workflow.onComplete {
println "Pipeline completed at: $workflow.complete"
println "Execution status: ${ workflow.success ? 'OK' : 'failed' }"
println "Execution duration: $workflow.duration"
println ""
println "${ workflow.success ? 'I wish you nice results!' : 'Do not give up, we can fix it!' }"
println "${ workflow.success ? 'Thank you for using fmalmeida/mpgap pipeline!' : '' }"
println ""
}