annotate 0.5.0/modules/cat/tables/main.nf @ 1:365849f031fd

"planemo upload"
author kkonganti
date Mon, 05 Jun 2023 18:48:51 -0400
parents
children
rev   line source
kkonganti@1 1 process TABLE_SUMMARY {
kkonganti@1 2 tag "$table_sum_on"
kkonganti@1 3 label 'process_low'
kkonganti@1 4
kkonganti@1 5 // Requires `pyyaml` which does not have a dedicated container but is in the MultiQC container
kkonganti@1 6 module (params.enable_module ? "${params.swmodulepath}${params.fs}python${params.fs}3.8.1" : null)
kkonganti@1 7 conda (params.enable_conda ? "conda-forge::python=3.9 conda-forge::pyyaml conda-forge::coreutils" : null)
kkonganti@1 8 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
kkonganti@1 9 'https://depot.galaxyproject.org/singularity/multiqc:1.11--pyhdfd78af_0' :
kkonganti@1 10 'quay.io/biocontainers/multiqc:1.11--pyhdfd78af_0' }"
kkonganti@1 11
kkonganti@1 12 input:
kkonganti@1 13 tuple val(table_sum_on), path(tables)
kkonganti@1 14
kkonganti@1 15 output:
kkonganti@1 16 tuple val(table_sum_on), path("*.tblsum.txt"), emit: tblsummed
kkonganti@1 17 path "*_mqc.yml" , emit: mqc_yml
kkonganti@1 18 path "versions.yml" , emit: versions
kkonganti@1 19
kkonganti@1 20 when:
kkonganti@1 21 task.ext.when == null || task.ext.when || tables
kkonganti@1 22
kkonganti@1 23 script:
kkonganti@1 24 def args = task.ext.args ?: ''
kkonganti@1 25 def onthese = tables.collect().join('\\n')
kkonganti@1 26 """
kkonganti@1 27 filenum="1"
kkonganti@1 28 header=""
kkonganti@1 29
kkonganti@1 30 echo -e "$onthese" | while read -r file; do
kkonganti@1 31
kkonganti@1 32 if [ "\${filenum}" == "1" ]; then
kkonganti@1 33 header=\$( head -n1 "\${file}" )
kkonganti@1 34 echo -e "\${header}" > ${table_sum_on}.tblsum.txt
kkonganti@1 35 fi
kkonganti@1 36
kkonganti@1 37 tail -n+2 "\${file}" >> ${table_sum_on}.tblsum.txt
kkonganti@1 38
kkonganti@1 39 filenum=\$((filenum+1))
kkonganti@1 40 done
kkonganti@1 41
kkonganti@1 42 create_mqc_data_table.py $table_sum_on ${workflow.manifest.name}
kkonganti@1 43
kkonganti@1 44 cat <<-END_VERSIONS > versions.yml
kkonganti@1 45 "${task.process}":
kkonganti@1 46 bash: \$( bash --version 2>&1 | sed '1!d; s/^.*version //; s/ (.*\$//' )
kkonganti@1 47 python: \$( python --version | sed 's/Python //g' )
kkonganti@1 48 END_VERSIONS
kkonganti@1 49
kkonganti@1 50 headver=\$( head --version 2>&1 | sed '1!d; s/^.*(GNU coreutils//; s/) //;' )
kkonganti@1 51 tailver=\$( tail --version 2>&1 | sed '1!d; s/^.*(GNU coreutils//; s/) //;' )
kkonganti@1 52
kkonganti@1 53 cat <<-END_VERSIONS >> versions.yml
kkonganti@1 54 head: \$headver
kkonganti@1 55 tail: \$tailver
kkonganti@1 56 END_VERSIONS
kkonganti@1 57 """
kkonganti@1 58 }