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