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