annotate 0.4.2/workflows/nanofactory.nf @ 105:52045ea4679d

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