annotate 0.4.0/modules/cat/tables/main.nf @ 101:ce6d9548fe89

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