2022-04-24 11:55:17 +00:00
|
|
|
process MOTUS_PROFILE {
|
|
|
|
tag "$meta.id"
|
2022-05-06 12:11:29 +00:00
|
|
|
label 'process_medium'
|
2022-04-24 11:55:17 +00:00
|
|
|
|
|
|
|
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(reads)
|
2022-05-02 12:37:12 +00:00
|
|
|
path db
|
2022-04-24 11:55:17 +00:00
|
|
|
|
|
|
|
output:
|
|
|
|
tuple val(meta), path("*.out"), emit: out
|
|
|
|
tuple val(meta), path("*.bam"), optional: true, emit: bam
|
|
|
|
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}"
|
2022-05-06 12:11:22 +00:00
|
|
|
def inputs = "$reads[0]".getExtension == ('.bam') ?
|
2022-04-24 11:55:17 +00:00
|
|
|
"-i ${reads}" :
|
|
|
|
meta.single_end ?
|
|
|
|
"-s $reads" : "-f ${reads[0]} -r ${reads[1]}"
|
2022-05-02 12:37:12 +00:00
|
|
|
def refdb = db ? "-db ${db}" : ""
|
2022-04-24 11:55:17 +00:00
|
|
|
"""
|
|
|
|
motus profile \\
|
|
|
|
$args \\
|
|
|
|
$inputs \\
|
2022-05-02 12:37:12 +00:00
|
|
|
$refdb \\
|
2022-04-24 11:55:17 +00:00
|
|
|
-t $task.cpus \\
|
2022-05-02 12:37:12 +00:00
|
|
|
-n $prefix \\
|
2022-04-24 11:55:17 +00:00
|
|
|
-o ${prefix}.out
|
|
|
|
|
2022-05-05 17:38:46 +00:00
|
|
|
## mOTUs version number is not available from command line.
|
|
|
|
## mOTUs save the version number in index database folder.
|
|
|
|
## mOTUs will check the database version is same version as exec version.
|
2022-05-05 19:35:31 +00:00
|
|
|
if [ "$db" == "" ]; then
|
2022-05-05 17:38:46 +00:00
|
|
|
VERSION=\$(echo \$(motus -h 2>&1) | sed 's/^.*Version: //; s/References.*\$//')
|
|
|
|
else
|
2022-05-05 19:35:31 +00:00
|
|
|
VERSION=\$(grep motus $db/db_mOTU_versions | sed 's/motus\\t//g')
|
2022-05-05 17:38:46 +00:00
|
|
|
fi
|
2022-04-24 11:55:17 +00:00
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
|
|
"${task.process}":
|
2022-05-05 17:38:46 +00:00
|
|
|
mOTUs: \$VERSION
|
2022-04-24 11:55:17 +00:00
|
|
|
END_VERSIONS
|
|
|
|
"""
|
|
|
|
}
|