-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathARG-Sniper-pipeline.nf
95 lines (71 loc) · 2.38 KB
/
ARG-Sniper-pipeline.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
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env nextflow
// Using DSL-2
nextflow.enable.dsl=2
// All of the default parameters are being set in `nextflow.config`
// Import modules
include { groot_align } from './modules/groot'
include { ariba_run } from './modules/ariba'
include { ariba_summary } from './modules/ariba'
// Function which prints help message text
def helpMessage() {
log.info"""
Usage:
nextflow run ARG-Sniper-pipeline.nf --offline -with-report <ARGUMENTS>
Required Arguments:
Input Data:
--fastq_folder Folder containing reads with file name *_R{1,2}.fastq.gz,
Reference Data:
--indexed_groot_database Reference database to use
Output Location:
--results_dir Folder for output files"""
}
params.all = true
params.groot = false
params.ariba = false
params.help = false
// Main workflow
workflow {
// Show help message if the user specifies the --help flag at runtime
// or if any required params are not provided
if ( params.help || params.results_dir == false || params.fastq_folder == false ){
// Invoke the function above which prints the help message
helpMessage()
// Exit out and do not run anything else
exit 1
}
if ( params.fastq_folder ){
// Make a channel with the input FASTQ read pairs from the --fastq_folder
// After calling `fromFilePairs`, the structure must be changed from
// [specimen, [R1, R2]]
// to
// [specimen, R1, R2]
// with the map{} expression
// Define the pattern which will be used to find the FASTQ files
fastq_pattern = "${params.fastq_folder}/*_R{1,2}.fastq.gz"
// Set up a channel from the pairs of files found with that pattern
fastq_ch = Channel
.fromFilePairs(fastq_pattern)
.ifEmpty { error "No files found matching the pattern ${fastq_pattern}" }
.map{
[it[0], it[1][0], it[1][1]]
}
}
if(params.all || params.groot){
groot_align(
fastq_ch
)
// output:
// path(groot_report_<sample_name>.tsv)
// path(groot_<sample_name>.tsv)
}
if(params.all || params.ariba){
ariba_report = ariba_run(
fastq_ch
)
ariba_grouped_reports = ariba_report
.collect()
ariba_summary(ariba_grouped_reports)
// output:
// path(ariba_report)
}
}