nf-core_modules/modules/motus/merge/main.nf
James A. Fellows Yates b02e648c22
Add MOTUS/MERGE (#1734)
* Add motus/merge module, missing test yml

* Fix prefix

* Fix polymersase

* Update test meta.yml

* Try new version system

* Typo fix

* Clairfy docs for the version file

* Switch to directory auto detection

* Now with the change and not just meta

* Remove now unneeded input parameter from test

* Fix input type check

* Try adding db requirement to fix docker issue

* Update modules/motus/merge/main.nf

* Fix input

* Apply suggestions from code review

* Fix md5sums

* Replace debugging db location with actual

* Fix contains due to further varialbility

* Indenting
2022-07-07 09:47:41 +02:00

47 lines
1.5 KiB
Text

VERSION = '3.0.1'
process MOTUS_MERGE {
label 'process_low'
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:
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'
val biom_format
output:
path("*.txt") , optional: true, emit: txt
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 = 'motus_merged'
def cmd_input = input.size() > 1 ? "-i ${input.join(',')}" : input.isDirectory() ? "-d ${input}" : "-i ${input}"
def output = biom_format ? "-B -o ${prefix}.biom" : "-o ${prefix}.txt"
"""
motus \\
merge \\
-db $db \\
${cmd_input} \\
$args \\
${output}
## 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
"""
}