nf-core_modules/modules/bakta/main.nf
Robert A. Petit III 29c669766d
add bakta module (#1085)
* add bakta module

* Update main.nf

* Update main.nf

Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
2021-11-21 12:17:25 +00:00

77 lines
2.8 KiB
Text

// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process BAKTA {
tag "$meta.id"
label 'process_medium'
publishDir "${params.outdir}",
mode: params.publish_dir_mode,
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
conda (params.enable_conda ? "bioconda::bakta=1.2.2" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/bakta:1.2.2--pyhdfd78af_0"
} else {
container "quay.io/biocontainers/bakta:1.2.2--pyhdfd78af_0"
}
input:
tuple val(meta), path(fasta)
path db
path proteins
path prodigal_tf
output:
tuple val(meta), path("${prefix}.embl") , emit: embl
tuple val(meta), path("${prefix}.faa") , emit: faa
tuple val(meta), path("${prefix}.ffn") , emit: ffn
tuple val(meta), path("${prefix}.fna") , emit: fna
tuple val(meta), path("${prefix}.gbff") , emit: gbff
tuple val(meta), path("${prefix}.gff3") , emit: gff
tuple val(meta), path("${prefix}.hypotheticals.tsv"), emit: hypotheticals_tsv
tuple val(meta), path("${prefix}.hypotheticals.faa"), emit: hypotheticals_faa
tuple val(meta), path("${prefix}.tsv") , emit: tsv
path "versions.yml" , emit: versions
script:
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def proteins_opt = proteins ? "--proteins ${proteins[0]}" : ""
def prodigal_opt = prodigal_tf ? "--prodigal-tf ${prodigal_tf[0]}" : ""
"""
bakta \\
$options.args \\
--threads $task.cpus \\
--prefix ${prefix} \\
--db $db \\
$proteins_opt \\
$prodigal_tf \\
$fasta
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( echo \$(bakta --version 2>&1) | sed 's/^.*bakta //' )
END_VERSIONS
"""
stub:
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
"""
touch ${prefix}.embl
touch ${prefix}.faa
touch ${prefix}.ffn
touch ${prefix}.fna
touch ${prefix}.gbff
touch ${prefix}.gff3
touch ${prefix}.hypotheticals.tsv
touch ${prefix}.hypotheticals.faa
touch ${prefix}.tsv
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( echo \$(bakta --version 2>&1) | sed 's/^.*bakta //' )
END_VERSIONS
"""
}