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