annotate 0.7.0/modules/cat/tables/main.nf @ 17:0e7a0053e4a6

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