Skip to content
Closed
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
5 changes: 2 additions & 3 deletions .github/workflows/docker-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v3

- name: Build and push R container
- name: Build and push R container to docker hub
uses: mr-smithers-excellent/[email protected]
with:
image: fishbotherer/r-tools
Expand All @@ -31,5 +31,4 @@ jobs:
dockerfile: containers/r/Dockerfile
directory: containers/r
username: ${{ secrets.DOCKER_LOGIN }}
password: ${{ secrets.DOCKER_TOKEN }}

password: ${{ secrets.DOCKER_TOKEN }}
54 changes: 11 additions & 43 deletions conf/base.config
Original file line number Diff line number Diff line change
@@ -1,31 +1,23 @@
int cores = (int)get_p(params,'maxCpus')
nextflow.util.MemoryUnit mem = get_p(params,'maxMemory') as nextflow.util.MemoryUnit
nextflow.util.Duration d = get_p(params,'maxTime') as nextflow.util.Duration
insect = get_p(params,"insect")
blast = get_p(params,"blast")
demux = get_p(params,"demultiplexedBy") == "index"
split = get_p(params,"split")


/*
* general process options (mainly which labels go with which docker/singulariy images)
* but also the base resource usage settings
*/
process {
withLabel: 'fastqc' { container = 'biocontainers/fastqc:v0.11.9_cv7' }
withLabel: 'adapterRemoval' { container = 'biocontainers/adapterremoval:v2.2.0-1-deb_cv1' }
withLabel: 'obitools' { container = 'biocontainers/obitools:v1.2.12dfsg-2-deb_cv1' }
withLabel: 'r' { container = 'fishbotherer/r-tools:latest' }
withLabel: 'shell' { container = 'nextflow/bash:latest' }
withLabel: 'multiqc' { container = 'multiqc/multiqc:latest'}
withName: 'fastqc' { container = 'quay.io/biocontainers/fastqc:0.12.1--hdfd78af_0 ' }
withName: 'filter_merge' { container = 'quay.io/biocontainers/adapterremoval:2.3.4--pl5321haf24da9_1' }
withName: 'multiqc' { container = 'quay.io/biocontainers/multiqc:1.27.1--pyhdfd78af_0'}
withLabel: 'shell' { container = 'quay.io/nextflow/bash:latest' }
withLabel: 'obitools' { container = 'quay.io/biocontainers/obitools:1.2.13--py27heb79e2c_3' }
withLabel: 'blast' { container = 'quay.io/biocontainers/blast:2.17.0--h66d330f_0' }
withLabel: 'r' { container = 'fishbotherer/r-tools:latest' }

withLabel: 'denoiser' {
if (params.execDenoiser)
container = ''
else if (params.denoiser == "vsearch") {
container = 'biocontainers/vsearch:v2.10.4-1-deb_cv1'
container = 'quay.io/biocontainers/vsearch:2.30.0--hd6d6fdc_0'
} else if (params.denoiser in ['usearch','usearch32']) {
container = 'sunqiangkun/usearch:v1'
container = 'quay.io/biocontainers/usearch:12.0_beta--h9ee0642_1'
}
}

Expand Down Expand Up @@ -68,34 +60,10 @@ process {
errorStrategy = 'retry'
maxRetries = 2
}

// // allocate cpus to AdapterRemoval
// withLabel: 'demux_cpus' {
// if (get_p(params,'demultiplexedBy') == 'barcode' ) {
// cpus = cores > 1 ? cores-1 : cores
// } else {
// cpus = 4 * task.attempt
// }
// }

// allow all cpus
withLabel: 'all_cpus' { cpus = { cores } }

// allocate blast cpus
withLabel: 'blast' {
// cpus = { params.insect ? cores / 2 : cores }
// memory = { params.insect ? mem / 2 : mem }
container = 'ncbi/blast:latest'
}

// alloacte insect cpus
withLabel: 'insect' {
// cpus = { params.blast ? cores / 2 : cores }
// memory = { params.blast ? mem / 2 : mem }
container = 'fishbotherer/r-tools:latest'
}
withLabel: 'all_cpus' { cpus = { (int)params.maxCpus } }

cache = 'lenient'
cache = 'lenient'

// set default cpus and memory
cpus = { check_max( 1 * task.attempt, 'cpus' ) }
Expand Down
2 changes: 1 addition & 1 deletion containers/r/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ MAINTAINER "Mykle Hoban" [email protected]
RUN /rocker_scripts/install_tidyverse.sh

# install packages
RUN Rscript -e 'install.packages(c("insect","optparse","phangorn","furrr","worrms","rentrez"))'
RUN Rscript -e 'install.packages(c("insect","optparse","phangorn"))'
RUN Rscript -e 'devtools::install_github(c("tobiasgf/lulu","GuillemSalazar/EcolUtils"))'
RUN Rscript -e 'BiocManager::install(c("phyloseq","dada2","DECIPHER","decontam"))'
54 changes: 16 additions & 38 deletions nextflow.config
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ manifest {
mainScript = 'rainbow_bridge.nf'
defaultBranch = 'main'
version = '1.33.8'
nextflowVersion = '!>=22.03'
nextflowVersion = '!>=25.04.7'
}


Expand Down Expand Up @@ -73,6 +73,7 @@ try {
}

/* general script options */
params.saveConfig = false
params.preDir = 'preprocess'
params.outDir = 'output'
params.publishMode = "symlink"
Expand Down Expand Up @@ -164,53 +165,33 @@ params.maxTime = 240.h
// ourselves if we want consisistency. what we'll do is give the
// kebab-case version priority

// convert string to camelCase
def to_camel(s) {
return s.replaceAll(/(?<small>[a-z])-(?<big>[a-z])/) {
m,a,b -> a+b.toUpperCase()
}
}

// convert string to kebab-case
def to_kebab(s) {
return s.replaceAll(/([a-z])([A-Z])/,'$1-$2').toLowerCase()
}

def get_p(p,k) {
if (p.containsKey(to_kebab(k))) {
return p.get(to_kebab(k))
} else {
return p.get(k)
}
}

// 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(get_p(params,'maxMemory') as nextflow.util.MemoryUnit) == 1)
return get_p(params,'maxMemory') as nextflow.util.MemoryUnit
if (obj.compareTo(params.maxMemory as nextflow.util.MemoryUnit) == 1)
return params.maxMemory as nextflow.util.MemoryUnit
else
return obj
} catch (all) {
println " ### ERROR ### Max memory '${get_p(params,'maxMemory')}' is not valid! Using default value: $obj"
println " ### ERROR ### Max memory '${params.maxMemory}' is not valid! Using default value: $obj"
return obj
}
} else if (type == 'time') {
try {
if (obj.compareTo(get_p(params,'maxTime') as nextflow.util.Duration) == 1)
return get_p(params,'maxTime') as nextflow.util.Duration
if (obj.compareTo(params.maxTime as nextflow.util.Duration) == 1)
return params.maxTime as nextflow.util.Duration
else
return obj
} catch (all) {
println " ### ERROR ### Max time '${get_p(params,'maxTime')}' is not valid! Using default value: $obj"
println " ### ERROR ### Max time '${params.maxTime}' is not valid! Using default value: $obj"
return obj
}
} else if (type == 'cpus') {
try {
return Math.min( obj, get_p(params,'maxCpus') as int )
return Math.min( obj, params.maxCpus as int )
} catch (all) {
println " ### ERROR ### Max cpus '${get_p(params,'maxCpus')}' is not valid! Using default value: $obj"
println " ### ERROR ### Max cpus '${params.maxCpus}' is not valid! Using default value: $obj"
return obj
}
}
Expand All @@ -229,25 +210,22 @@ profiles {
// make default executor local
// and limit max cpus to param value
executor.name = 'local'
executor.cpus = (int)get_p(params,'maxCpus')
executor.memory = get_p(params,'maxMemory')
executor.cpus = (int)params.maxCpus
executor.memory = params.maxMemory

singularity {
/* enable singularity and have it do automounts */
enabled = true
autoMounts = true

String bd = get_p(params,'bindDir')
String sc = get_p(params,'singularityCache')

// construct options for singularity bind directories
if (bd && bd != '') {
runOptions = "-B " + bd.split().join(" -B ")
if (params.bindDir && params.bindDir != '') {
runOptions = "-B " + params.bindDir.split().join(" -B ")
}

// set singularity cache directory if specified
if (sc && sc != "") {
cacheDir = sc
if (params.singularityCache && params.singularityCache != "") {
cacheDir = params.singularityCache
}
}
}
Expand Down
Loading