Mercurial > repos > galaxytrakr > hfp_bettercallsal_konda
comparison 1.0.0/modules/cat_cat/main.nf @ 0:0a8dda29956e draft default tip
planemo upload
| author | galaxytrakr |
|---|---|
| date | Thu, 28 May 2026 20:41:10 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:0a8dda29956e |
|---|---|
| 1 process CAT_CAT { | |
| 2 tag "$meta.id" | |
| 3 label 'process_micro' | |
| 4 | |
| 5 module (params.enable_module ? "${params.swmodulepath}${params.fs}pigz${params.fs}2.7" : null) | |
| 6 conda (params.enable_conda ? "conda-forge::pigz=2.6" : null) | |
| 7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | |
| 8 'https://depot.galaxyproject.org/singularity/pigz:2.3.4' : | |
| 9 'quay.io/biocontainers/pigz:2.3.4' }" | |
| 10 | |
| 11 input: | |
| 12 tuple val(meta), path(files_in) | |
| 13 | |
| 14 output: | |
| 15 tuple val(meta), path("*${prefix}"), emit: concatenated_reads | |
| 16 path "versions.yml" , emit: versions | |
| 17 | |
| 18 when: | |
| 19 task.ext.when == null || task.ext.when | |
| 20 | |
| 21 script: | |
| 22 def args = task.ext.args ?: '' | |
| 23 def args2 = task.ext.args2 ?: '' | |
| 24 def file_list = files_in.collect { it.toString() } | |
| 25 | |
| 26 // | input | output | command1 | command2 | | |
| 27 // |-----------|------------|----------|----------| | |
| 28 // | gzipped | gzipped | cat | | | |
| 29 // | ungzipped | ungzipped | cat | | | |
| 30 // | gzipped | ungzipped | zcat | | | |
| 31 // | ungzipped | gzipped | cat | pigz | | |
| 32 | |
| 33 // Use input file ending as default | |
| 34 prefix = task.ext.prefix ? "${meta.id}.${task.ext.prefix}" : "${meta.id}${file_list[0].substring(file_list[0].lastIndexOf('.'))}" | |
| 35 out_zip = prefix.endsWith('.gz') | |
| 36 in_zip = file_list[0].endsWith('.gz') | |
| 37 command1 = (in_zip && !out_zip) ? 'zcat' : 'cat' | |
| 38 command2 = (!in_zip && out_zip) ? "| pigz -c -p $task.cpus $args2" : '' | |
| 39 """ | |
| 40 $command1 \\ | |
| 41 $args \\ | |
| 42 ${file_list.join(' ')} \\ | |
| 43 $command2 \\ | |
| 44 > ${prefix} | |
| 45 | |
| 46 cat <<-END_VERSIONS > versions.yml | |
| 47 "${task.process}": | |
| 48 pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) | |
| 49 END_VERSIONS | |
| 50 """ | |
| 51 | |
| 52 stub: | |
| 53 def file_list = files_in.collect { it.toString() } | |
| 54 prefix = task.ext.prefix ?: "${meta.id}${file_list[0].substring(file_list[0].lastIndexOf('.'))}" | |
| 55 """ | |
| 56 touch $prefix | |
| 57 | |
| 58 cat <<-END_VERSIONS > versions.yml | |
| 59 "${task.process}": | |
| 60 pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) | |
| 61 END_VERSIONS | |
| 62 | |
| 63 catver="" | |
| 64 zver="" | |
| 65 | |
| 66 if [ "${workflow.containerEngine}" != "null" ]; then | |
| 67 catver=\$( cat --help 2>&1 | sed -e '1!d; s/ (.*\$//' | cut -f1-2 -d' ' ) | |
| 68 zver=\$( zcat --help 2>&1 | sed -e '1!d; s/ (.*\$//' ) | |
| 69 | |
| 70 else | |
| 71 catver=\$( cat --version 2>&1 | sed '1!d; s/^.*(GNU coreutils//; s/) //;' ) | |
| 72 zver=\$( zcat --version 2>&1 | sed '1!d; s/^.*(gzip) //' ) | |
| 73 fi | |
| 74 | |
| 75 cat <<-END_VERSIONS >> versions.yml | |
| 76 cat: \$catver | |
| 77 zcat: \$zver | |
| 78 END_VERSIONS | |
| 79 """ | |
| 80 } |
