annotate 0.6.1/modules/cat/tables/main.nf @ 15:1972677994a6

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