Mercurial > repos > kkonganti > cfsan_cronology
comparison 0.2.0/modules/mashtree/main.nf @ 11:a5f31c44f8c9
planemo upload
author | kkonganti |
---|---|
date | Mon, 15 Jul 2024 16:11:44 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
10:ddf7a172bf30 | 11:a5f31c44f8c9 |
---|---|
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 tuple val(meta), path("*.nwk"), emit: nwk, optional: true | |
19 path "versions.yml" , emit: versions | |
20 | |
21 when: | |
22 task.ext.when == null || task.ext.when | |
23 | |
24 script: | |
25 def args = task.ext.args ?: '' | |
26 def prefix = task.ext.prefix ?: "${meta.id}" | |
27 def fofn = (args.toString().matches(/.*file\-of\-files/) ? 'true' : 'false') | |
28 def fas = reference.collect().join('\\n') | |
29 def ref_fasta = (fas ?: '') | |
30 """ | |
31 | |
32 echo -e "$ref_fasta" | while read -r fa; do | |
33 if ! grep -F "\${fa}" $seqs && [ "$fofn" = "true" ]; then | |
34 echo "\${fa}" >> $seqs | |
35 fi | |
36 done | |
37 | |
38 mashtree \\ | |
39 $args \\ | |
40 --tempdir "." \\ | |
41 --numcpus $task.cpus \\ | |
42 --outmatrix ${prefix}.tsv \\ | |
43 --outtree ${prefix}.dnd \\ | |
44 $seqs | |
45 | |
46 sed -ie 's/_scaffolded_genomic//g' ${prefix}.dnd | |
47 cp ${prefix}.dnd ${prefix}.nwk | |
48 | |
49 cat <<-END_VERSIONS > versions.yml | |
50 "${task.process}": | |
51 mashtree: \$( echo \$( mashtree --version 2>&1 ) | sed 's/^.*Mashtree //' ) | |
52 END_VERSIONS | |
53 | |
54 sedver="" | |
55 grepver="" | |
56 | |
57 if [ "${workflow.containerEngine}" != "null" ]; then | |
58 sedver=\$( sed --help 2>&1 | sed -e '1!d; s/ (.*\$//' ) | |
59 grepver="\$sedver" | |
60 else | |
61 sedver=\$( echo \$(sed --version 2>&1) | sed 's/^.*(GNU sed) //; s/ Copyright.*\$//' ) | |
62 grepver=\$( echo \$(grep --version 2>&1) | sed 's/^.*(GNU grep) //; s/ Copyright.*\$//' ) | |
63 fi | |
64 | |
65 cat <<-END_VERSIONS >> versions.yml | |
66 grep: \$grepver | |
67 sed: \$sedver | |
68 END_VERSIONS | |
69 """ | |
70 } |