-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathmain.nf
executable file
·77 lines (65 loc) · 2.48 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
#!/usr/bin/env nextflow
nextflow.enable.dsl = 2
def json_schema = "$projectDir/nextflow_schema.json"
if (params.help){
def command = "nextflow run CFIA-NCFAD/nf-flu --input samplesheet.csv --platfrom <illumina/nanopore> samplesheet.csv -profile <singularity/docker/conda>"
log.info NfcoreSchema.params_help(workflow, params, json_schema, command)
exit 0
}
if (params.validate_params) {
NfcoreSchema.validateParameters(params, json_schema, log)
}
if (workflow.profile == 'slurm' && params.slurm_queue == "") {
exit 1, "You must specify a valid SLURM queue (e.g. '--slurm_queue <queue name>' (see `\$ sinfo` output for available queues)) to run this workflow with the 'slurm' profile!"
}
// Has the run name been specified by the user?
// this has the bonus effect of catching both -name and --name
//custom_runName = params.name
if( !(workflow.runName ==~ /[a-z]+_[a-z]+/) ){
custom_runName = workflow.runName
}
//=============================================================================
// LOG PARAMS SUMMARY
//=============================================================================
def summary_params = NfcoreSchema.params_summary_map(workflow, params, json_schema)
log.info NfcoreSchema.params_summary_log(workflow, params, json_schema)
if (params.platform == 'illumina'){
include { ILLUMINA } from './workflows/illumina'
} else if (params.platform == 'nanopore'){
include { NANOPORE } from './workflows/nanopore'
}
workflow NF_FLU {
if (params.platform == 'illumina'){
ILLUMINA ()
} else if (params.platform == 'nanopore') {
NANOPORE ()
}
}
workflow {
NF_FLU ()
}
/* Introspection
*
* https://www.nextflow.io/docs/latest/metadata.html
*/
workflow.onComplete {
// Log colors ANSI codes
c_reset = params.monochrome_logs ? '' : "\033[0m";
c_bold = params.monochrome_logs ? '' : "\033[1m";
c_red = params.monochrome_logs ? '' : "\033[0;31m";
c_green = params.monochrome_logs ? '' : "\033[0;32m";
println """
Pipeline execution summary
---------------------------
Completed at : ${workflow.complete}
Duration : ${workflow.duration}
Success : ${c_bold}${workflow.success ? c_green : c_red}${workflow.success}${c_reset}
Results Dir : ${file(params.outdir)}
Work Dir : ${workflow.workDir}
Exit status : ${workflow.exitStatus}
Error report : ${workflow.errorReport ?: '-'}
""".stripIndent()
}
workflow.onError {
println "Oops... Pipeline execution stopped with the following message: ${workflow.errorMessage}"
}