-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.nf
executable file
·71 lines (42 loc) · 1.98 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
#!/usr/bin/env nextflow
nextflow.enable.dsl=2
// include non-process modules
include { help_message; version_message; complete_message; error_message; pipeline_start_message } from './modules/messages.nf'
include { default_params; check_params } from './modules/params_parser.nf'
include { help_or_version } from './modules/params_utilities.nf'
version = '1.0dev'
// setup default params
default_params = default_params()
// merge defaults with user params
merged_params = default_params + params
// help and version messages
help_or_version(merged_params, version)
final_params = check_params(merged_params)
// starting pipeline
pipeline_start_message(version, final_params)
// include processes
include { MINIMAP2_SAM; SAM_SORT_AND_INDEX; STRAINBERRY; COMBINE_LOG_SUMMARY } from './modules/processes.nf' addParams(final_params)
workflow {
read_ch = channel
.fromPath( final_params.reads )
.map { file -> tuple(file.simpleName, file) }
.ifEmpty { error "Cannot find any reads matching: ${final_params.reads}" }
assemblies_ch = channel
.fromPath( final_params.assemblies, checkIfExists: true )
.map { file -> tuple(file.simpleName, file) }
.ifEmpty { error "Cannot find any assemblies matching: ${final_params.assemblies}" }
joined_ch = read_ch.join(assemblies_ch)
MINIMAP2_SAM ( joined_ch )
joined_sam_ch = MINIMAP2_SAM.out.sam_ch.join(assemblies_ch)
SAM_SORT_AND_INDEX(joined_sam_ch)
joined_sam_assembly_ch = SAM_SORT_AND_INDEX.out.bam_ch.join(assemblies_ch)
STRAINBERRY(joined_sam_assembly_ch)
collected_log_summary_ch = STRAINBERRY.out.log_summary_ch.collect( sort: {a, b -> a[0].getBaseName() <=> b[0].getBaseName()} )
COMBINE_LOG_SUMMARY(collected_log_summary_ch)
}
workflow.onComplete {
complete_message(final_params, workflow, version)
}
workflow.onError {
error_message(workflow)
}