kkonganti@0
|
1 //
|
kkonganti@0
|
2 // Start nanofactory workflow. Since this is a special
|
kkonganti@0
|
3 // case workflow wherein most of the bioinformatics
|
kkonganti@0
|
4 // tools are not used, there won't be any modules or
|
kkonganti@0
|
5 // subworkflows and therefore all the processes
|
kkonganti@0
|
6 // reside here.
|
kkonganti@0
|
7 //
|
kkonganti@0
|
8
|
kkonganti@0
|
9 // Include any necessary methods.
|
kkonganti@0
|
10 include { addPadding; summaryOfParams; stopNow} \
|
kkonganti@0
|
11 from "${params.routines}"
|
kkonganti@0
|
12
|
kkonganti@0
|
13 /*
|
kkonganti@0
|
14 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
kkonganti@0
|
15 PROCESS DEFINITIONS FOR NANOFACTORY
|
kkonganti@0
|
16 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
kkonganti@0
|
17 */
|
kkonganti@0
|
18
|
kkonganti@0
|
19 process SETPUBLISHDIR {
|
kkonganti@0
|
20 label 'process_femto'
|
kkonganti@0
|
21 module (params.enable_module ? params.enable_module : null)
|
kkonganti@0
|
22 conda (params.enable_conda ? params.enable_conda : null)
|
kkonganti@0
|
23
|
kkonganti@0
|
24 input:
|
kkonganti@0
|
25 val options
|
kkonganti@0
|
26
|
kkonganti@0
|
27 output:
|
kkonganti@0
|
28 stdout
|
kkonganti@0
|
29
|
kkonganti@0
|
30 shell:
|
kkonganti@0
|
31 '''
|
kkonganti@0
|
32 project_setup.py -s !{options.sample_sheet} \
|
kkonganti@0
|
33 !{options.alt_settings} !{options.verbose} -b
|
kkonganti@0
|
34 '''
|
kkonganti@0
|
35 }
|
kkonganti@0
|
36
|
kkonganti@0
|
37 process PROJECTSETUP {
|
kkonganti@0
|
38 label 'process_femto'
|
kkonganti@0
|
39 publishDir "${publish_dir.trim()}", mode: 'copy', overwrite: false
|
kkonganti@0
|
40 module (params.enable_module ? params.enable_module : null)
|
kkonganti@0
|
41 conda (params.enable_conda ? params.enable_conda : null)
|
kkonganti@0
|
42
|
kkonganti@0
|
43 input:
|
kkonganti@0
|
44 val options
|
kkonganti@0
|
45 val publish_dir
|
kkonganti@0
|
46
|
kkonganti@0
|
47 output:
|
kkonganti@0
|
48 stdout
|
kkonganti@0
|
49
|
kkonganti@0
|
50 script:
|
kkonganti@0
|
51 params.publish_dir = "${publish_dir.trim()}"
|
kkonganti@0
|
52
|
kkonganti@0
|
53 shell:
|
kkonganti@0
|
54 '''
|
kkonganti@0
|
55 project_setup.py -y -s !{options.sample_sheet} !{options.alt_settings} \
|
kkonganti@0
|
56 !{options.purge} !{options.runtype} !{options.logfile} \
|
kkonganti@0
|
57 !{options.loglevel} !{options.verbose} !{options.nocopy} \
|
kkonganti@0
|
58 !{options.fix_existing}
|
kkonganti@0
|
59
|
kkonganti@0
|
60 cat < original_source.txt
|
kkonganti@0
|
61 '''
|
kkonganti@0
|
62 }
|
kkonganti@0
|
63
|
kkonganti@0
|
64 process TRIMDEMUX {
|
kkonganti@0
|
65 label 'process_pico'
|
kkonganti@0
|
66 module (params.enable_module ? params.enable_module : null)
|
kkonganti@0
|
67 conda (params.enable_conda ? params.enable_conda : null)
|
kkonganti@0
|
68 cpus "${params.guppy_threads}"
|
kkonganti@0
|
69
|
kkonganti@0
|
70 input:
|
kkonganti@0
|
71 val options
|
kkonganti@0
|
72 val original_source
|
kkonganti@0
|
73
|
kkonganti@0
|
74 output:
|
kkonganti@0
|
75 path 'source.txt'
|
kkonganti@0
|
76
|
kkonganti@0
|
77 shell:
|
kkonganti@0
|
78 '''
|
kkonganti@0
|
79 trim_demux.py -s !{options.sample_sheet} !{options.verbose} \
|
kkonganti@0
|
80 !{options.alt_settings} !{options.guppy_config} -t !{options.guppy_threads}
|
kkonganti@0
|
81 '''
|
kkonganti@0
|
82 }
|
kkonganti@0
|
83
|
kkonganti@0
|
84 /*
|
kkonganti@0
|
85 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
kkonganti@0
|
86 WORKFLOW ENTRY POINT
|
kkonganti@0
|
87 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
kkonganti@0
|
88 */
|
kkonganti@0
|
89
|
kkonganti@0
|
90 workflow NANOFACTORY {
|
kkonganti@0
|
91
|
kkonganti@0
|
92 if ( params.help ) {
|
kkonganti@0
|
93 log.info help()
|
kkonganti@0
|
94 } else if ( params.sample_sheet == null ||
|
kkonganti@0
|
95 params.sample_sheet.length() == 0 ) {
|
kkonganti@0
|
96
|
kkonganti@0
|
97 log.info help()
|
kkonganti@0
|
98 stopNow("Please provide absolute path to a JSON formatted sample sheet using the\n" +
|
kkonganti@0
|
99 "--sample_sheet option.")
|
kkonganti@0
|
100 } else {
|
kkonganti@0
|
101 log.info summaryOfParams()
|
kkonganti@0
|
102
|
kkonganti@0
|
103 options = Channel.empty()
|
kkonganti@0
|
104 Channel
|
kkonganti@0
|
105 .from(setOptions())
|
kkonganti@0
|
106 .set { options }
|
kkonganti@0
|
107
|
kkonganti@0
|
108 take:
|
kkonganti@0
|
109 options
|
kkonganti@0
|
110
|
kkonganti@0
|
111 main:
|
kkonganti@0
|
112 SETPUBLISHDIR(options)
|
kkonganti@0
|
113 PROJECTSETUP(options, SETPUBLISHDIR.out)
|
kkonganti@0
|
114 TRIMDEMUX(options, PROJECTSETUP.out)
|
kkonganti@0
|
115 }
|
kkonganti@0
|
116 }
|
kkonganti@0
|
117
|
kkonganti@0
|
118
|
kkonganti@0
|
119 /*
|
kkonganti@0
|
120 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
kkonganti@0
|
121 THE END
|
kkonganti@0
|
122 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
kkonganti@0
|
123 */
|
kkonganti@0
|
124
|
kkonganti@0
|
125
|
kkonganti@0
|
126 /*
|
kkonganti@0
|
127 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
kkonganti@0
|
128 HELPER METHODS FOR NANOFACTORY WORKFLOW
|
kkonganti@0
|
129 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
kkonganti@0
|
130 */
|
kkonganti@0
|
131
|
kkonganti@0
|
132 def setOptions() {
|
kkonganti@0
|
133
|
kkonganti@0
|
134 Map options = [:]
|
kkonganti@0
|
135
|
kkonganti@0
|
136 options['sample_sheet'] ?= "${params.sample_sheet}"
|
kkonganti@0
|
137 options['verbose'] = params.verbose ? "-v" : ""
|
kkonganti@0
|
138 options['alt_settings'] = params.global_settings ? "-c ${params.global_settings}" : ""
|
kkonganti@0
|
139 options['purge'] = params.setup_purge_existing ? "-p" : ""
|
kkonganti@0
|
140 options['logfile'] = params.log_file ? "-l ${params.log_file}" : ""
|
kkonganti@0
|
141 options['loglevel'] = params.log_level ? "--loglevel ${params.log_level}" : ""
|
kkonganti@0
|
142 options['nocopy'] = params.setup_nocopy ? "--nocopy" : ""
|
kkonganti@0
|
143 options['runtype'] = params.setup_runtype ? "-r ${params.setup_runtype}" : ""
|
kkonganti@0
|
144 options['fix_existing'] = params.setup_fix_existing ? "-f" : ""
|
kkonganti@0
|
145 options['guppy_config'] = params.guppy_config ? " -g ${params.guppy_config}" : ""
|
kkonganti@0
|
146 options['mode'] = params.mode ? "-m ${params.mode}" : "-m prod"
|
kkonganti@0
|
147 options['mail_group'] = params.mail_group ? "-g ${params.mail_group}" : "-g stakeholders"
|
kkonganti@0
|
148 options['guppy_threads'] = params.guppy_threads ? "${params.guppy_threads}" : 1
|
kkonganti@0
|
149 options['pad'] = pad.toInteger()
|
kkonganti@0
|
150 options['nocapitalize'] = true
|
kkonganti@0
|
151
|
kkonganti@0
|
152 return options
|
kkonganti@0
|
153 }
|
kkonganti@0
|
154
|
kkonganti@0
|
155 def help() {
|
kkonganti@0
|
156
|
kkonganti@0
|
157 Map helptext = [:]
|
kkonganti@0
|
158
|
kkonganti@0
|
159 helptext['help'] = true
|
kkonganti@0
|
160 helptext['nocapitalize'] = true
|
kkonganti@0
|
161 helptext['Workflow'] = "${params.pipeline}"
|
kkonganti@0
|
162 helptext['Author'] = "${params.workflow_author}"
|
kkonganti@0
|
163 helptext['Version'] = "${params.workflow_version}\n"
|
kkonganti@0
|
164 helptext['Usage'] = "cpipes --pipeline nanofactory [options]\n"
|
kkonganti@0
|
165 helptext['Required'] = ""
|
kkonganti@0
|
166 helptext['--sample_sheet'] = "The JSON-formatted sample sheet for this run. Normally provided by Pore Refiner.\n"
|
kkonganti@0
|
167 helptext['Other options'] = ""
|
kkonganti@0
|
168 helptext['--global_settings'] = "An alternate global settings file. If not present the installed default will be used."
|
kkonganti@0
|
169 helptext['--log_file'] = "Path and file name to a log file relative to the project directory (Default: 'logs/workflow.log')"
|
kkonganti@0
|
170 helptext['--log_level'] = "One of 'debug', 'info', 'warning', 'error', 'fatal' (Default: 'info')"
|
kkonganti@0
|
171 helptext['--mode'] = "Set the run mode. One of 'dev', 'test', 'stage', or 'prod' (Default: 'prod')"
|
kkonganti@0
|
172 helptext['--verbose'] = "Use to enable more verbose console output from each tool\n"
|
kkonganti@0
|
173 helptext['Project setup options'] = ""
|
kkonganti@0
|
174 helptext['--disable_project_setup'] = "Do not do project setup (Default: setup is enabled)"
|
kkonganti@0
|
175 helptext['--setup_purge_existing'] = "Before setting up the project area delete any existing files (Default: don't purge)"
|
kkonganti@0
|
176 helptext['--setup_nocopy'] = "During setup, do NOT copy the original data files to the scrach location (Default: copy)"
|
kkonganti@0
|
177 helptext['--setup_runtype'] = "Set things up for the indicated run type (Currently not used)"
|
kkonganti@0
|
178 helptext['--setup_runtype'] = "Set things up for the indicated run type (Currently not used)"
|
kkonganti@0
|
179 helptext['--enable_module'] = "Software environment module. Ex: --enable_module 'nanofactory/current'"
|
kkonganti@0
|
180 helptext['--enable_conda'] = "CONDA environment module. Ex: --enable_conda nanofactory\n"
|
kkonganti@0
|
181 helptext['Help options'] = ""
|
kkonganti@0
|
182 helptext['--help'] = "Display this message.\n"
|
kkonganti@0
|
183
|
kkonganti@0
|
184 return addPadding(helptext)
|
kkonganti@0
|
185 }
|