Mercurial > repos > kkonganti > cfsan_centriflaken
comparison 0.2.1/modules/abricate/summary/main.nf @ 0:77494b0fa3c7
"planemo upload"
author | kkonganti |
---|---|
date | Mon, 27 Jun 2022 15:55:37 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:77494b0fa3c7 |
---|---|
1 process ABRICATE_SUMMARY { | |
2 tag "${abdbs.join(',')}" | |
3 label 'process_low' | |
4 | |
5 module (params.enable_module ? "${params.swmodulepath}${params.fs}abricate${params.fs}1.0.1" : null) | |
6 conda (params.enable_conda ? "bioconda::abricate=1.0.1 conda-forge::coreutils" : null) | |
7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | |
8 'https://depot.galaxyproject.org/singularity/abricate%3A1.0.1--ha8f3691_1': | |
9 'quay.io/biocontainers/abricate:1.0.1--ha8f3691_1' }" | |
10 | |
11 input: | |
12 tuple val(abdbs), path(abfiles) | |
13 | |
14 output: | |
15 tuple val('abricate_ncbi'), path("*.ncbi.absum.txt") , emit: ncbi, optional: true | |
16 tuple val('abricate_ncbiamrplus'), path("*.ncbiamrplus.absum.txt"), emit: ncbiamrplus, optional: true | |
17 tuple val('abricate_resfinder'), path("*resfinder.absum.txt") , emit: resfinder, optional: true | |
18 tuple val('abricate_megares'), path("*.megares.absum.txt") , emit: megares, optional: true | |
19 tuple val('abricate_argannot'), path("*.argannot.absum.txt") , emit: argannot, optional: true | |
20 tuple val('abricate_ecoli_vf'), path("*.ecoli_vf.absum.txt") , emit: ecoli_vf, optional: true | |
21 path "versions.yml" , emit: versions | |
22 | |
23 when: | |
24 task.ext.when == null || task.ext.when | |
25 | |
26 script: | |
27 def args = task.ext.args ?: '' | |
28 def onthese = abdbs.collect{ db -> | |
29 abfiles.findAll { files -> | |
30 files =~ /\.${db}/ | |
31 }.join(' ') | |
32 }.join('\\n') | |
33 """ | |
34 filenum="1" | |
35 | |
36 echo -e "$onthese" | while read -r files; do | |
37 db=\$( echo -e "\${files}" | grep -E -o '\\w+\\.ab\\.txt' | sort -u | sed -e 's/.ab.txt//' ) | |
38 | |
39 if [ -z "\$db" ]; then | |
40 db="\$filenum" | |
41 fi | |
42 | |
43 abricate \\ | |
44 $args \\ | |
45 --summary \${files} \\ | |
46 1> "abricate.\${db}.absum.txt" | |
47 | |
48 filenum=\$((filenum+1)) | |
49 done | |
50 | |
51 cat <<-END_VERSIONS > versions.yml | |
52 "${task.process}": | |
53 abricate: \$(echo \$(abricate --version 2>&1) | sed 's/^.*abricate //' ) | |
54 bash: \$( bash --version 2>&1 | sed '1!d; s/^.*version //; s/ (.*\$//' ) | |
55 END_VERSIONS | |
56 | |
57 sedver="" | |
58 sortver="" | |
59 grepver="" | |
60 | |
61 if [ "${workflow.containerEngine}" != "null" ]; then | |
62 sortver=\$( sort --help 2>&1 | sed -e '1!d; s/ (.*\$//' ) | |
63 sedver="\$sortver" | |
64 grepver="\$sortver" | |
65 else | |
66 sortver=\$( sort --version 2>&1 | sed '1!d; s/^.*(GNU coreutils//; s/) //;' ) | |
67 sedver=\$( echo \$(sed --version 2>&1) | sed 's/^.*(GNU sed) //; s/ Copyright.*\$//' ) | |
68 grepver=\$( echo \$(grep --version 2>&1) | sed 's/^.*(GNU grep) //; s/ Copyright.*\$//' ) | |
69 fi | |
70 | |
71 cat <<-END_VERSIONS >> versions.yml | |
72 sort: \$sortver | |
73 grep: \$grepver | |
74 sed: \$sedver | |
75 END_VERSIONS | |
76 """ | |
77 } |