annotate 0.4.2/modules/cat/tables/main.nf @ 130:04f6ac8ca13c

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