nf-core_modules/modules/tbprofiler/profile/main.nf
Robert A. Petit III 7be60774b6
add module for tbprofiler (#947)
* add module for tbprofiler

* Update test.yml

* Update meta.yml

Co-authored-by: Abhinav Sharma <abhi18av@users.noreply.github.com>
Co-authored-by: FriederikeHanssen <Friederike.hanssen@qbic.uni-tuebingen.de>
2021-11-15 15:35:55 +01:00

48 lines
1.8 KiB
Text

// Import generic module functions
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
params.options = [:]
options = initOptions(params.options)
process TBPROFILER_PROFILE {
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::tb-profiler=3.0.8" : null)
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
container "https://depot.galaxyproject.org/singularity/tb-profiler:3.0.8--pypyh5e36f6f_0"
} else {
container "quay.io/biocontainers/tb-profiler:3.0.8--pypyh5e36f6f_0"
}
input:
tuple val(meta), path(reads)
output:
tuple val(meta), path("bam/*.bam") , emit: bam
tuple val(meta), path("results/*.csv") , emit: csv, optional: true
tuple val(meta), path("results/*.json"), emit: json
tuple val(meta), path("results/*.txt") , emit: txt, optional: true
tuple val(meta), path("vcf/*.vcf.gz") , emit: vcf
path "versions.yml" , emit: versions
script:
prefix = options.suffix ? "${meta.id}${options.suffix}" : "${meta.id}"
def input_reads = meta.single_end ? "--read1 $reads" : "--read1 ${reads[0]} --read2 ${reads[1]}"
"""
tb-profiler \\
profile \\
$options.args \\
--prefix ${prefix} \\
--threads $task.cpus \\
$input_reads
cat <<-END_VERSIONS > versions.yml
${getProcessName(task.process)}:
${getSoftwareName(task.process)}: \$( echo \$(tb-profiler --version 2>&1) | sed 's/TBProfiler version //')
END_VERSIONS
"""
}