annotate 0.3.0/modules/cat/tables/main.nf @ 92:295c2597a475

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