annotate 0.3.0/workflows/nanofactory.nf @ 92:295c2597a475

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