annotate 0.4.0/workflows/nanofactory.nf @ 101:ce6d9548fe89

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