comparison 0.5.0/modules/kma/align/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 KMA_ALIGN {
2 tag "$meta.id"
3 label 'process_micro'
4
5 module (params.enable_module ? "${params.swmodulepath}${params.fs}kma${params.fs}1.4.4" : null)
6 conda (params.enable_conda ? "conda-forge::libgcc-ng bioconda::kma=1.4.3" : null)
7 container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ?
8 'https://depot.galaxyproject.org/singularity/kma:1.4.3--h7132678_1':
9 'quay.io/biocontainers/kma:1.4.3--h7132678_1' }"
10
11 input:
12 tuple val(meta), path(reads), path(index)
13
14 output:
15 path "${meta.id}_kma_res"
16 tuple val(meta), path("${meta.id}_kma_res${params.fs}*.res") , emit: res
17 tuple val(meta), path("${meta.id}_kma_res${params.fs}*.mapstat") , emit: mapstat, optional: true
18 tuple val(meta), path("${meta.id}_kma_res${params.fs}*_template_hits.txt"), emit: hits, 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 reads_in = (meta.single_end ? "-i $reads" : "-ipe ${reads[0]} ${reads[1]}")
28 def db = (meta.kma_t_db ?: "${index}")
29 def db_basename = (db ? "${index.baseName}" : '')
30 def get_hit_accs = (meta.get_kma_hit_accs ? 'true' : 'false')
31 def res_dir = prefix + '_kma_res'
32 reads_in = (params.kmaalign_int ? "-int $reads" : "-i $reads")
33 """
34 mkdir -p $res_dir || exit 1
35 kma \\
36 $args \\
37 -t_db $db${params.fs}$db_basename \\
38 -t $task.cpus \\
39 -o $res_dir${params.fs}$prefix \\
40 $reads_in
41
42 if [ "$get_hit_accs" == "true" ]; then
43 grep -v '^#' $res_dir${params.fs}${prefix}.res | \\
44 cut -f1 > $res_dir${params.fs}${prefix}_template_hits.txt
45 fi
46
47 cat <<-END_VERSIONS > versions.yml
48 "${task.process}":
49 kma: \$( kma -v | sed -e 's%KMA-%%' )
50 END_VERSIONS
51
52 mkdirver=""
53 cutver=""
54 grepver=""
55
56 if [ "${workflow.containerEngine}" != "null" ]; then
57 mkdirver=\$( mkdir --help 2>&1 | sed -e '1!d; s/ (.*\$//' | cut -f1-2 -d' ' )
58 cutver="\$mkdirver"
59 grepver="\$mkdirver"
60 else
61 mkdirver=\$( mkdir --version 2>&1 | sed '1!d; s/^.*(GNU coreutils//; s/) //;' )
62 cutver=\$( cut --version 2>&1 | sed '1!d; s/^.*(GNU coreutils//; s/) //;' )
63 grepver=\$( echo \$(grep --version 2>&1) | sed 's/^.*(GNU grep) //; s/ Copyright.*\$//' )
64 fi
65
66 cat <<-END_VERSIONS >> versions.yml
67 mkdir: \$mkdirver
68 cut: \$cutver
69 grep: \$grepver
70 END_VERSIONS
71 """
72 }