From 3a5043b54d62eb3bce98e6949b3bbb210f88f875 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 12 May 2026 13:41:21 -0400 Subject: [PATCH 1/5] chore: bump nf-schema version see #72 --- nextflow.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nextflow.config b/nextflow.config index e78b2fd..03cd2a3 100644 --- a/nextflow.config +++ b/nextflow.config @@ -115,7 +115,7 @@ dag { includeConfig 'conf/modules.config' plugins { - id 'nf-schema@2.2.1' + id 'nf-schema@2.7.2' } validation { help { From 5f57bdda299413f0e86d2964a8f67c783a34b21a Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 12 May 2026 13:48:38 -0400 Subject: [PATCH 2/5] fix: update for new v2 parser strict syntax - use resourceLimits instead of check_max - workflow.onComplete must be inside another workflow --- .github/workflows/build.yml | 2 +- conf/base.config | 43 +++++++++++++++++----------------- main.nf | 19 +++++++-------- nextflow.config | 46 ++++--------------------------------- 4 files changed, 38 insertions(+), 72 deletions(-) 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..2cb8754 100644 --- a/main.nf +++ b/main.nf @@ -7,15 +7,6 @@ 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' @@ -67,4 +58,14 @@ workflow { if (params.bagel_run) { BAGEL(ch_count, control) } + + workflow.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 03cd2a3..07ff3c6 100644 --- a/nextflow.config +++ b/nextflow.config @@ -94,22 +94,21 @@ 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' @@ -123,8 +122,6 @@ validation { } } -String pipeline_version = new File("${projectDir}/VERSION").text - manifest { name = "CCBR/CRISPIN" author = "CCR Collaborative Bioinformatics Resource" @@ -132,38 +129,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() }() } From 68a837771b1b4ca01a98e3b6c8771f50714eaa18 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 12 May 2026 14:04:22 -0400 Subject: [PATCH 3/5] chore: add tracedir param --- nextflow.config | 1 + 1 file changed, 1 insertion(+) diff --git a/nextflow.config b/nextflow.config index 07ff3c6..f738527 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 From aced30e55e24b7e156b38b26c4f0fd7207f6eb18 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 12 May 2026 14:12:10 -0400 Subject: [PATCH 4/5] chore: fix sing cache dir --- nextflow.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nextflow.config b/nextflow.config index f738527..78bb684 100644 --- a/nextflow.config +++ b/nextflow.config @@ -55,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 { From a6ddba24aba64103a021c419bb1516855d69c463 Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Tue, 12 May 2026 14:12:25 -0400 Subject: [PATCH 5/5] fix: onComplete handler syntax --- main.nf | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/main.nf b/main.nf index 2cb8754..a26c73e 100644 --- a/main.nf +++ b/main.nf @@ -11,20 +11,21 @@ include { DRUGZ } from './modules/local/drugz.nf' 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)) @@ -59,13 +60,11 @@ workflow { BAGEL(ch_count, control) } - workflow.onComplete { - if (!workflow.stubRun && !workflow.commandLine.contains('-preview')) { - def message = Utils.spooker(workflow) - if (message) { - println message - } - } - } - + onComplete: + if (!workflow.stubRun && !workflow.commandLine.contains('-preview')) { + def message = Utils.spooker(workflow) + if (message) { + println message + } + } }