Mercurial > repos > kkonganti > cfsan_cronology
comparison 0.1.0/modules/mashtree/main.nf @ 0:c8597e9e1a97
"planemo upload"
author | kkonganti |
---|---|
date | Mon, 27 Nov 2023 12:37:44 -0500 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c8597e9e1a97 |
---|---|
1 process MASHTREE { | |
2 tag "$meta.id" | |
3 label 'process_medium' | |
4 | |
5 module (params.enable_module ? "${params.swmodulepath}${params.fs}mashtree${params.fs}1.4.3" : null) | |
6 conda (params.enable_conda ? "bioconda::mashtree=1.4.3 conda-forge::perl conda-forge::coreutils" : null) | |
7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? | |
8 'https://depot.galaxyproject.org/singularity/mashtree:1.4.3--pl5321h031d066_0' : | |
9 'quay.io/biocontainers/mashtree:1.4.3--pl5321h031d066_0' }" | |
10 | |
11 input: | |
12 tuple val(meta), path(seqs) | |
13 path reference | |
14 | |
15 output: | |
16 tuple val(meta), path("*.dnd"), emit: tree | |
17 tuple val(meta), path("*.tsv"), emit: matrix | |
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 def fofn = (args.toString().matches(/.*file\-of\-files/) ? 'true' : 'false') | |
27 def fas = reference.collect().join('\\n') | |
28 def ref_fasta = (fas ?: '') | |
29 """ | |
30 | |
31 echo -e "$ref_fasta" | while read -r fa; do | |
32 if ! grep -F "\${fa}" $seqs && [ "$fofn" = "true" ]; then | |
33 echo "\${fa}" >> $seqs | |
34 fi | |
35 done | |
36 | |
37 mashtree \\ | |
38 $args \\ | |
39 --tempdir "." \\ | |
40 --numcpus $task.cpus \\ | |
41 --outmatrix ${prefix}.tsv \\ | |
42 --outtree ${prefix}.dnd \\ | |
43 $seqs | |
44 | |
45 sed -ie 's/_scaffolded_genomic//g' ${prefix}.dnd | |
46 | |
47 cat <<-END_VERSIONS > versions.yml | |
48 "${task.process}": | |
49 mashtree: \$( echo \$( mashtree --version 2>&1 ) | sed 's/^.*Mashtree //' ) | |
50 END_VERSIONS | |
51 | |
52 sedver="" | |
53 grepver="" | |
54 | |
55 if [ "${workflow.containerEngine}" != "null" ]; then | |
56 sedver=\$( sed --help 2>&1 | sed -e '1!d; s/ (.*\$//' ) | |
57 grepver="\$sedver" | |
58 else | |
59 sedver=\$( echo \$(sed --version 2>&1) | sed 's/^.*(GNU sed) //; s/ Copyright.*\$//' ) | |
60 grepver=\$( echo \$(grep --version 2>&1) | sed 's/^.*(GNU grep) //; s/ Copyright.*\$//' ) | |
61 fi | |
62 | |
63 cat <<-END_VERSIONS >> versions.yml | |
64 grep: \$grepver | |
65 sed: \$sedver | |
66 END_VERSIONS | |
67 """ | |
68 } |