annotate 0.2.1/modules/centrifuge/extract/main.nf @ 38:d7c07f2456b4

"planemo upload"
author kkonganti
date Wed, 29 Jun 2022 23:40:53 -0400
parents 77494b0fa3c7
children
rev   line source
kkonganti@0 1 process CENTRIFUGE_EXTRACT {
kkonganti@0 2 tag "$meta.id"
kkonganti@0 3 label 'process_low'
kkonganti@0 4
kkonganti@0 5 //seqkit container contains required bash and other utilities
kkonganti@0 6 module (params.enable_module ? "${params.swmodulepath}${params.fs}python${params.fs}3.8.1" : null)
kkonganti@0 7 conda (params.enable_conda ? "conda-forge::sed=4.7 conda-forge::coreutils" : null)
kkonganti@0 8 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
kkonganti@0 9 'https://depot.galaxyproject.org/singularity/mulled-v2-039542721b6b463b663872ba8b7e9fbc05f01925:1de88053ebf8fb9884758395c4871f642c57750c-0':
kkonganti@0 10 'quay.io/biocontainers/mulled-v2-039542721b6b463b663872ba8b7e9fbc05f01925:1de88053ebf8fb9884758395c4871f642c57750c-0' }"
kkonganti@0 11
kkonganti@0 12 input:
kkonganti@0 13 tuple val(meta), path(centrifuge_report)
kkonganti@0 14 tuple val(meta), path(centrifuge_output)
kkonganti@0 15
kkonganti@0 16 output:
kkonganti@0 17 tuple val(meta), path('*.extract-centrifuge-bug-ids.txt'), emit: extracted
kkonganti@0 18 path "versions.yml" , emit: versions
kkonganti@0 19
kkonganti@0 20 when:
kkonganti@0 21 task.ext.when == null || task.ext.when
kkonganti@0 22
kkonganti@0 23 script:
kkonganti@0 24 def args = task.ext.args ?: ''
kkonganti@0 25 def prefix = task.ext.prefix ?: "${meta.id}"
kkonganti@0 26 """
kkonganti@0 27 grep -F '${params.centrifuge_extract_bug}' $centrifuge_report \
kkonganti@0 28 | cut -f2 \
kkonganti@0 29 | sort -u \
kkonganti@0 30 | while read -r taxId; do
kkonganti@0 31 echo -e "\t\$taxId"'\$'
kkonganti@0 32 done > gotcha.txt
kkonganti@0 33
kkonganti@0 34 cut -f1-3 $centrifuge_output | grep -E -f gotcha.txt | cut -f1 | sort -u > ${prefix}.extract-centrifuge-bug-ids.txt || true
kkonganti@0 35
kkonganti@0 36 cat <<-END_VERSIONS > versions.yml
kkonganti@0 37 "${task.process}":
kkonganti@0 38 bash: \$( bash --version 2>&1 | sed '1!d; s/^.*version //; s/ (.*\$//' )
kkonganti@0 39 END_VERSIONS
kkonganti@0 40
kkonganti@0 41 ver=""
kkonganti@0 42 sedver=""
kkonganti@0 43
kkonganti@0 44 if [ "${workflow.containerEngine}" != "null" ]; then
kkonganti@0 45 ver=\$( cut --help 2>&1 | sed -e '1!d; s/ (.*\$//' )
kkonganti@0 46 sedver="\$ver"
kkonganti@0 47 else
kkonganti@0 48 ver=\$( cut --version 2>&1 | sed '1!d; s/^.*(GNU coreutils//; s/) //;' )
kkonganti@0 49 sedver=\$( echo \$(sed --version 2>&1) | sed 's/^.*(GNU sed) //; s/ Copyright.*\$//' )
kkonganti@0 50 fi
kkonganti@0 51
kkonganti@0 52 cat <<-END_VERSIONS >> versions.yml
kkonganti@0 53 cut: \$ver
kkonganti@0 54 tail: \$ver
kkonganti@0 55 sort: \$ver
kkonganti@0 56 sed: \$sedver
kkonganti@0 57 END_VERSIONS
kkonganti@0 58 """
kkonganti@0 59 }