comparison 0.5.0/modules/custom/sourmash/compare/main.nf @ 1:365849f031fd

"planemo upload"
author kkonganti
date Mon, 05 Jun 2023 18:48:51 -0400
parents
children
comparison
equal deleted inserted replaced
0:a4b1ee4b68b1 1:365849f031fd
1 process SOURMASH_COMPARE {
2 tag "Samples vs Genomes"
3 label 'process_micro'
4
5 module (params.enable_module ? "${params.swmodulepath}${params.fs}sourmash${params.fs}4.6.1" : null)
6 conda (params.enable_conda ? "conda-forge::python bioconda::sourmash=4.6.1" : null)
7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
8 'https://depot.galaxyproject.org/singularity/sourmash:4.6.1--hdfd78af_0':
9 'quay.io/biocontainers/sourmash:4.6.1--hdfd78af_0' }"
10
11 input:
12 path queries
13 path accessions
14
15 output:
16 path "bcs_sourmash_cont_mat.csv" , emit: matrix, optional: true
17 path "bcs_sourmash_cont_mat.data.labels.txt", emit: labels, optional: true
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 sm_compare_mode = ("${params.sourmashcompare_mode.split(',')}"
26 ? "--${params.sourmashcompare_mode.split(',').join(' --')}"
27 : '')
28 def sketch_args = (params.sourmashsketch_mode ?: '')
29 sketch_args += (params.sourmashsketch_singleton ? ' --singleton ' : '')
30 sketch_args += (params.sourmashsketch_p ? " -p ${params.sourmashsketch_p} " : '')
31 """
32
33 gen_otf_genome.py \\
34 -gd "${params.tuspy_gd}" \\
35 -gds "${params.tuspy_gds}" \\
36 -txt $accessions
37
38 if [ ! -e "CATTED_GENOMES_FAILED.txt" ]; then
39
40 sourmash sketch \\
41 $sketch_args \\
42 --output OTF.db.sig \\
43 CATTED_GENOMES_scaffolded_genomic.fna.gz
44
45 sourmash compare \\
46 $sm_compare_mode \\
47 --${params.sourmashsketch_mode} \\
48 -k ${params.sourmashgather_k} \\
49 --csv bcs_sourmash_cont_mat.csv \\
50 --output bcs_sourmash_cont_mat.data \\
51 ${queries.collect().join(' ')} \\
52 OTF.db.sig
53 fi
54
55 cat <<-END_VERSIONS > versions.yml
56 "${task.process}":
57 sourmash: \$(echo \$(sourmash --version 2>&1) | sed 's/^sourmash //' )
58 python: \$( python --version | sed 's/Python //g' )
59 bash: \$( bash --version 2>&1 | sed '1!d; s/^.*version //; s/ (.*\$//' )
60 END_VERSIONS
61 """
62 }