-
Notifications
You must be signed in to change notification settings - Fork 2
/
main.nf
executable file
·125 lines (91 loc) · 4.22 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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
nextflow.enable.dsl = 2
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
VALIDATE & PRINT PARAMETER SUMMARY
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
// Check inputdir exists
// This actually cannot happen as there is a default inputdir in nextflow.config
if( !params.inputdir ){
exit 1, "No inputdir specified! Specify path with --inputdir."
}
inputdir = file(params.inputdir)
if( !inputdir.exists() ) exit 1, "Inputdir folder not found: ${params.inputdir}. Specify path with --inputdir."
fastqs_ch = Channel.fromPath( params.inputdir, checkIfExists: true)
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
MODULES
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
include { MERGEFASTQ } from './modules/local/mergefastq'
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HELP
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
def helpMessage() {
log.info """
Usage:
The typical command for running the pipeline is as follows:
merge_fastq --inputdir ./fastq_files [--outdir ./merged_fastq_files]
Arguments:
--inputdir Folder that contains the FastQ files [./fastq_files]
--outdir Output director [./merged_fastq_files]
--help This usage statement
Other useful nextflow arguments:
-resume Execute the script using the cached results, useful to continue executions that was stopped by an error [False]
-with-tower Monitor workflow execution with Seqera Tower service [False]
-ansi-log Enable/disable ANSI console logging [True]
-N, -with-notification Send a notification email on workflow completion to the specified recipients [False]
** Important **
** FastQ files are expected to have the typical Illumina naming convention (Ex: SampleName_S1_L001_R1_001.fastq.gz) to make sure that lanes are merged correctly **
** Specifically, filenames have to match the following regular expression: ^(.+)_S[0-9]+(_.+)*_R([1-2])_ **
Example:
fastq_files/E3387-3t_S10_L001_R1_001.fastq.gz
fastq_files/E3387-3t_S10_L003_R1_001.fastq.gz
fastq_files/E3387-3t_S11_L001_R1_001.fastq.gz
fastq_files/E3387-3t_S11_L002_R1_001.fastq.gz
are merged as ./E3387-3t_R1.fastq.gz
}
"""
}
if (params.help){
helpMessage()
exit 0
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
HEADER
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
// Header
println "=============================================================="
println " N E X T F L O W M E R G E F A S T Q P I P E L I N E "
println "=============================================================="
println "['Pipeline Name'] = nf/merge_fastq"
println "['Pipeline Version'] = $workflow.manifest.version"
println "['Inputdir'] = $params.inputdir"
println "['Outdir'] = $params.outdir"
println "['Working dir'] = $workflow.workDir"
println "['Current user'] = $USER"
println "========================================================"
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
RUN ALL WORKFLOWS
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
workflow{
MERGEFASTQ(fastqs_ch)
}
/*
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
THE END
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
*/
workflow.onComplete {
println "Pipeline completed at: $workflow.complete"
println "Execution status: ${ workflow.success ? 'OK' : 'failed' }"
}
workflow.onError = {
println "Oops... Pipeline execution stopped with the following message: ${workflow.errorMessage}"
}