Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11"]
python-version: ["3.13"]

steps:
- uses: actions/checkout@v3
Expand Down
43 changes: 22 additions & 21 deletions conf/base.config
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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'
Expand All @@ -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 }
}
}
38 changes: 19 additions & 19 deletions main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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
}
}
}
51 changes: 8 additions & 43 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ params {
input = null
library = null
outdir = 'results'
tracedir = "${params.outdir}/pipeline_info"
exp_name = 'crispin'

count_table = null
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -94,76 +95,40 @@ 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 {
enabled = true
}
}

String pipeline_version = new File("${projectDir}/VERSION").text

manifest {
name = "CCBR/CRISPIN"
author = "CCR Collaborative Bioinformatics Resource"
homePage = "https://github.com/CCBR/CRISPIN"
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() }()
}
Loading