kkonganti@11: process BBTOOLS_BBMERGE { kkonganti@11: tag "$meta.id" kkonganti@11: label 'process_micro' kkonganti@11: kkonganti@11: module (params.enable_module ? "${params.swmodulepath}${params.fs}bbtools${params.fs}38.94" : null) kkonganti@11: conda (params.enable_conda ? "conda-forge::pbzip2 bioconda::bbmap=38.95" : null) kkonganti@11: container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? kkonganti@11: 'https://depot.galaxyproject.org/singularity/bbmap:38.95--he522d1c_0' : kkonganti@11: 'quay.io/biocontainers/bbmap:38.95--he522d1c_0' }" kkonganti@11: kkonganti@11: input: kkonganti@11: tuple val(meta), path(reads) kkonganti@11: kkonganti@11: output: kkonganti@11: tuple val(meta), path("*.fastq.gz"), emit: fastq kkonganti@11: tuple val(meta), path("*.log") , emit: log kkonganti@11: path "versions.yml" , emit: versions kkonganti@11: kkonganti@11: when: kkonganti@11: !meta.single_end kkonganti@11: kkonganti@11: script: kkonganti@11: def args = task.ext.args ?: '' kkonganti@11: def prefix = task.ext.prefix ?: "${meta.id}" kkonganti@11: def in_files = "in1=${reads[0]} in2=${reads[1]}" kkonganti@11: def out_file = "out=${prefix}.bbmerge.fastq.gz" kkonganti@11: def adapters_file = file (meta.adapters) kkonganti@11: def adapters = !("${adapters_file.simpleName}" ==~ 'dummy_file.*') && adapters_file.exits() ? "adapters=${meta.adapters}" : '' kkonganti@11: def args_formatted = args.replaceAll('=\s+', '=') kkonganti@11: """ kkonganti@11: bbmerge.sh \\ kkonganti@11: -Xmx${task.memory.toGiga()}G \\ kkonganti@11: threads=$task.cpus \\ kkonganti@11: $args_formatted \\ kkonganti@11: $adapters \\ kkonganti@11: $in_files \\ kkonganti@11: $out_file &> ${prefix}.bbmerge.log kkonganti@11: kkonganti@11: cat <<-END_VERSIONS > versions.yml kkonganti@11: "${task.process}": kkonganti@11: bbmerge: \$( bbversion.sh ) kkonganti@11: END_VERSIONS kkonganti@11: """ kkonganti@11: }