nf-core_modules/modules/motus/merge/main.nf
James A. Fellows Yates 90aef30f43
Set process label to process_single for modules with no task.cpus usage (#2076)
* Set process label to `process_single` for modules with no `task.cpus` usage

* Fix tests of 'borked' modules

* prettier

* More modules are single-threaded and can use process_single

* Adding process_single to hmmer/esl* modules

* Fix failing tests

* Prettier

Co-authored-by: Matthieu Muffato <mm49@sanger.ac.uk>
Co-authored-by: Daniel Lundin <erik.rikard.daniel@gmail.com>
2022-09-19 11:54:47 +02:00

47 lines
1.6 KiB
Text

VERSION = '3.0.1'
process MOTUS_MERGE {
tag "$meta.id"
label 'process_single'
conda (params.enable_conda ? "bioconda::motus=3.0.1" : null)
container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
'https://depot.galaxyproject.org/singularity/motus:3.0.1--pyhdfd78af_0':
'quay.io/biocontainers/motus:3.0.1--pyhdfd78af_0' }"
input:
tuple val(meta), path(input)
path db // to stop docker saying it can't find it... would have to have the module in upstream steps anyway
path profile_version_yml, stageAs: 'profile_version.yml'
output:
tuple val(meta), path("*.txt") , optional: true, emit: txt
tuple val(meta), path("*.biom"), optional: true, emit: biom
path "versions.yml" , emit: versions
when:
task.ext.when == null || task.ext.when
script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${meta.id}"
def cmd_input = input.size() > 1 ? "-i ${input.join(',')}" : input.isDirectory() ? "-d ${input}" : "-i ${input}"
def suffix = task.ext.args?.contains("-B") ? "biom" : "txt"
"""
motus \\
merge \\
-db $db \\
${cmd_input} \\
$args \\
-o ${prefix}.${suffix}
## Take version from the mOTUs/profile module output, as cannot reconstruct
## version without having database staged in this directory.
VERSION=\$(cat ${profile_version_yml} | grep '/*motus:.*' | sed 's/.*otus: //g')
cat <<-END_VERSIONS > versions.yml
"${task.process}":
motus: \$VERSION
END_VERSIONS
"""
}