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