diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 85273e0..c92a4c4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.11"] + python-version: ["3.13"] steps: - uses: actions/checkout@v3 diff --git a/conf/base.config b/conf/base.config index 67d18a2..84d084c 100644 --- a/conf/base.config +++ b/conf/base.config @@ -10,10 +10,11 @@ process { - // TODO nf-core: Check the defaults for all processes - cpus = { check_max( 1 * task.attempt, 'cpus' ) } - memory = { check_max( 6.GB * task.attempt, 'memory' ) } - time = { check_max( 4.h * task.attempt, 'time' ) } + resourceLimits = [ + cpus: params.max_cpus, + memory: params.max_memory, + time: params.max_time + ] errorStrategy = { task.exitStatus in ((130..145) + 104) ? 'retry' : 'finish' } maxRetries = 1 @@ -27,30 +28,30 @@ process { // TODO nf-core: Customise requirements for specific processes. // See https://www.nextflow.io/docs/latest/config.html#config-process-selectors withLabel:process_single { - cpus = { check_max( 1 , 'cpus' ) } - memory = { check_max( 6.GB * task.attempt, 'memory' ) } - time = { check_max( 4.h * task.attempt, 'time' ) } + cpus = { 1 } + memory = { 6.GB * task.attempt } + time = { 4.h * task.attempt } } withLabel:process_low { - cpus = { check_max( 2 * task.attempt, 'cpus' ) } - memory = { check_max( 12.GB * task.attempt, 'memory' ) } - time = { check_max( 4.h * task.attempt, 'time' ) } + cpus = { 2 * task.attempt } + memory = { 12.GB * task.attempt } + time = { 4.h * task.attempt } } withLabel:process_medium { - cpus = { check_max( 6 * task.attempt, 'cpus' ) } - memory = { check_max( 36.GB * task.attempt, 'memory' ) } - time = { check_max( 8.h * task.attempt, 'time' ) } + cpus = { 6 * task.attempt } + memory = { 36.GB * task.attempt } + time = { 8.h * task.attempt } } withLabel:process_high { - cpus = { check_max( 12 * task.attempt, 'cpus' ) } - memory = { check_max( 72.GB * task.attempt, 'memory' ) } - time = { check_max( 16.h * task.attempt, 'time' ) } + cpus = { 12 * task.attempt } + memory = { 72.GB * task.attempt } + time = { 16.h * task.attempt } } withLabel:process_long { - time = { check_max( 20.h * task.attempt, 'time' ) } + time = { 20.h * task.attempt } } withLabel:process_high_memory { - memory = { check_max( 200.GB * task.attempt, 'memory' ) } + memory = { 200.GB * task.attempt } } withLabel:error_ignore { errorStrategy = 'ignore' @@ -66,8 +67,8 @@ process { // Custom CCBR resource requirements withLabel:process_higher { - cpus = { check_max( 32 * task.attempt, 'cpus' ) } - memory = { check_max( 72.GB * task.attempt, 'memory' ) } - time = { check_max( 16.h * task.attempt, 'time' ) } + cpus = { 32 * task.attempt } + memory = { 72.GB * task.attempt } + time = { 16.h * task.attempt } } } diff --git a/main.nf b/main.nf index 3e53ff1..a26c73e 100644 --- a/main.nf +++ b/main.nf @@ -7,33 +7,25 @@ include { BAGEL } from './subworkflows/local/bagel.nf' // MODULES include { DRUGZ } from './modules/local/drugz.nf' -workflow.onComplete { - if (!workflow.stubRun && !workflow.commandLine.contains('-preview')) { - def message = Utils.spooker(workflow) - if (message) { - println message - } - } -} - // Plugins include { validateParameters; paramsSummaryLog } from 'plugin/nf-schema' workflow LOG { - log.info """\ - CRISPIN 🍪 $workflow.manifest.version - =================================== - cmd line : $workflow.commandLine - start time : $workflow.start - launchDir : $workflow.launchDir - input : ${params.input} - """ - .stripIndent() + log.info """\ + CRISPIN 🍪 $workflow.manifest.version + =================================== + cmd line : $workflow.commandLine + start time : $workflow.start + launchDir : $workflow.launchDir + input : ${params.input} + """ + .stripIndent() - log.info paramsSummaryLog(workflow) + log.info paramsSummaryLog(workflow) } workflow { + main: LOG() validateParameters() INPUT_CHECK(file(params.input)) @@ -67,4 +59,12 @@ workflow { if (params.bagel_run) { BAGEL(ch_count, control) } + + onComplete: + if (!workflow.stubRun && !workflow.commandLine.contains('-preview')) { + def message = Utils.spooker(workflow) + if (message) { + println message + } + } } diff --git a/nextflow.config b/nextflow.config index e78b2fd..78bb684 100644 --- a/nextflow.config +++ b/nextflow.config @@ -4,6 +4,7 @@ params { input = null library = null outdir = 'results' + tracedir = "${params.outdir}/pipeline_info" exp_name = 'crispin' count_table = null @@ -54,7 +55,7 @@ profiles { singularity { singularity.enabled = true singularity.autoMounts = true - singularity.cacheDir = "/data/$USER/.singularity" // TODO this may be a different default on other (non biowulf) platforms + singularity.cacheDir = '/data/$USER/.singularity' // TODO this may be a different default on other (non biowulf) platforms envWhitelist='https_proxy,http_proxy,ftp_proxy,DISPLAY,SLURM_JOBID,SINGULARITY_BINDPATH' } biowulf { @@ -94,28 +95,27 @@ env { // Capture exit codes from upstream processes when piping process.shell = ['/bin/bash', '-euo', 'pipefail'] -def trace_timestamp = new java.util.Date().format('yyyy-MM-dd_HH-mm-ss') timeline { enabled = true - file = "${params.outdir}/pipeline_info/execution_timeline_${trace_timestamp}.html" + file = { "${params.tracedir}/execution_timeline_${new java.util.Date().format('yyyy-MM-dd_HH-mm-ss')}.html" }() } report { enabled = true - file = "${params.outdir}/pipeline_info/execution_report_${trace_timestamp}.html" + file = { "${params.tracedir}/execution_report_${new java.util.Date().format('yyyy-MM-dd_HH-mm-ss')}.html" }() } trace { enabled = true - file = "${params.outdir}/pipeline_info/execution_trace_${trace_timestamp}.txt" + file = { "${params.tracedir}/execution_trace_${new java.util.Date().format('yyyy-MM-dd_HH-mm-ss')}.txt" }() } dag { enabled = true - file = "${params.outdir}/pipeline_info/pipeline_dag_${trace_timestamp}.png" + file = { "${params.tracedir}/pipeline_dag_${new java.util.Date().format('yyyy-MM-dd_HH-mm-ss')}.png" }() } includeConfig 'conf/modules.config' plugins { - id 'nf-schema@2.2.1' + id 'nf-schema@2.7.2' } validation { help { @@ -123,8 +123,6 @@ validation { } } -String pipeline_version = new File("${projectDir}/VERSION").text - manifest { name = "CCBR/CRISPIN" author = "CCR Collaborative Bioinformatics Resource" @@ -132,38 +130,5 @@ manifest { description = "CRISPR screen pipeline" mainScript = "main.nf" defaultBranch = "main" - version = "${pipeline_version}" -} - -// Function to ensure that resource requirements don't go beyond -// a maximum limit -def check_max(obj, type) { - if (type == 'memory') { - try { - if (obj.compareTo(params.max_memory as nextflow.util.MemoryUnit) == 1) - return params.max_memory as nextflow.util.MemoryUnit - else - return obj - } catch (all) { - println " ### ERROR ### Max memory '${params.max_memory}' is not valid! Using default value: $obj" - return obj - } - } else if (type == 'time') { - try { - if (obj.compareTo(params.max_time as nextflow.util.Duration) == 1) - return params.max_time as nextflow.util.Duration - else - return obj - } catch (all) { - println " ### ERROR ### Max time '${params.max_time}' is not valid! Using default value: $obj" - return obj - } - } else if (type == 'cpus') { - try { - return Math.min( obj, params.max_cpus as int ) - } catch (all) { - println " ### ERROR ### Max cpus '${params.max_cpus}' is not valid! Using default value: $obj" - return obj - } - } + version = { -> new File("${projectDir}/VERSION").text.trim() }() }