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