-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.nf
77 lines (67 loc) · 2.37 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
include { INPUT_CHECK } from './subworkflows/local/input_check'
include { SKA_PHYLOGENY } from './workflows/ska_phylogeny'
// Function to print help message
def helpMessage() {
log.info"""
Usage:
nextflow run main.nf [options]
Options:
--input Input CSV file with sample information
--outdir Output directory (default: './results')
--run_snpsites Run SNP-sites (default: false)
--run_tree_building Run tree building (default: false)
--tree_method Tree building method (default: 'iqtree')
Options: 'iqtree', 'rapidnj', 'raxml', 'fastme', 'fasttree'
Flags:
--help Display this help message
--version Display version information
"""
}
// Function to print version information
def versionMessage() {
log.info"SKA Phylogeny Pipeline v1.0.0"
log.info"Nextflow version: $workflow.nextflow.version"
}
// Main workflow
workflow {
// Check for help or version flags
if (params.help) {
helpMessage()
exit 0
}
if (params.version) {
versionMessage()
exit 0
}
// Input validation
INPUT_CHECK ( file(params.input) )
// INPUT_CHECK.out.input_data.view { "INPUT_CHECK data: $it" }
// Run the main workflow
SKA_PHYLOGENY ( INPUT_CHECK.out.input_data, params.tree_method )
// SKA_PHYLOGENY.out.versions.view { "SKA_PHYLOGENY versions: $it" }
// Collect and save versions information
ch_versions = INPUT_CHECK.out.versions.mix(SKA_PHYLOGENY.out.versions.ifEmpty(Channel.empty()))
}
// Function to print workflow summary
def workflowSummary() {
// Print parameter summary
log.info """
====================================
SKA Phylogeny Pipeline
====================================
Input CSV : ${params.input}
Output directory : ${params.outdir}
Run SNP-sites : ${params.run_snpsites}
Run tree building: ${params.run_tree_building}
Tree method : ${params.run_tree_building ? params.tree_method : 'N/A'}
====================================
"""
}
// Print workflow summary on start
workflow.onComplete {
workflowSummary()
log.info "Pipeline completed at: $workflow.complete"
log.info "Execution status: ${ workflow.success ? 'OK' : 'failed' }"
}