Mercurial > repos > kkonganti > cfsan_bettercallsal
view 0.5.0/modules/cat_cat/main.nf @ 10:1b9de878b04a
"planemo upload"
author | kkonganti |
---|---|
date | Thu, 15 Jun 2023 11:16:45 -0400 |
parents | 365849f031fd |
children |
line wrap: on
line source
process CAT_CAT { tag "$meta.id" label 'process_micro' module (params.enable_module ? "${params.swmodulepath}${params.fs}pigz${params.fs}2.7" : null) conda (params.enable_conda ? "conda-forge::pigz=2.6" : null) container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? 'https://depot.galaxyproject.org/singularity/pigz:2.3.4' : 'quay.io/biocontainers/pigz:2.3.4' }" input: tuple val(meta), path(files_in) output: tuple val(meta), path("*${prefix}"), emit: concatenated_reads path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when script: def args = task.ext.args ?: '' def args2 = task.ext.args2 ?: '' def file_list = files_in.collect { it.toString() } // | input | output | command1 | command2 | // |-----------|------------|----------|----------| // | gzipped | gzipped | cat | | // | ungzipped | ungzipped | cat | | // | gzipped | ungzipped | zcat | | // | ungzipped | gzipped | cat | pigz | // Use input file ending as default prefix = task.ext.prefix ? "${meta.id}.${task.ext.prefix}" : "${meta.id}${file_list[0].substring(file_list[0].lastIndexOf('.'))}" out_zip = prefix.endsWith('.gz') in_zip = file_list[0].endsWith('.gz') command1 = (in_zip && !out_zip) ? 'zcat' : 'cat' command2 = (!in_zip && out_zip) ? "| pigz -c -p $task.cpus $args2" : '' """ $command1 \\ $args \\ ${file_list.join(' ')} \\ $command2 \\ > ${prefix} cat <<-END_VERSIONS > versions.yml "${task.process}": pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) END_VERSIONS """ stub: def file_list = files_in.collect { it.toString() } prefix = task.ext.prefix ?: "${meta.id}${file_list[0].substring(file_list[0].lastIndexOf('.'))}" """ touch $prefix cat <<-END_VERSIONS > versions.yml "${task.process}": pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) END_VERSIONS catver="" zver="" if [ "${workflow.containerEngine}" != "null" ]; then catver=\$( cat --help 2>&1 | sed -e '1!d; s/ (.*\$//' | cut -f1-2 -d' ' ) zver=\$( zcat --help 2>&1 | sed -e '1!d; s/ (.*\$//' ) else catver=\$( cat --version 2>&1 | sed '1!d; s/^.*(GNU coreutils//; s/) //;' ) zver=\$( zcat --version 2>&1 | sed '1!d; s/^.*(gzip) //' ) fi cat <<-END_VERSIONS >> versions.yml cat: \$catver zcat: \$zver END_VERSIONS """ }