annotate 0.5.0/modules/cat/tables/main.nf @ 10:74ac6f6a9526 tip

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