Mercurial > repos > kkonganti > cfsan_bettercallsal
comparison 0.6.1/modules/kma/align/main.nf @ 11:749faef1caa9
"planemo upload"
author | kkonganti |
---|---|
date | Tue, 05 Sep 2023 11:51:40 -0400 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
10:1b9de878b04a | 11:749faef1caa9 |
---|---|
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}*.frag.gz") , emit: frags, optional: true | |
19 tuple val(meta), path("${meta.id}_kma_res${params.fs}*_template_hits.txt"), emit: hits, optional: true | |
20 path "versions.yml" , emit: versions | |
21 | |
22 when: | |
23 task.ext.when == null || task.ext.when | |
24 | |
25 script: | |
26 def args = task.ext.args ?: '' | |
27 def prefix = task.ext.prefix ?: "${meta.id}" | |
28 def reads_in = (meta.single_end ? "-i $reads" : "-ipe ${reads[0]} ${reads[1]}") | |
29 def db = (meta.kma_t_db ?: "${index}") | |
30 def db_basename = (db ? "${index.baseName}" : '') | |
31 def get_hit_accs = (meta.get_kma_hit_accs ? 'true' : 'false') | |
32 def res_dir = prefix + '_kma_res' | |
33 reads_in = (params.kmaalign_int ? "-int $reads" : "-i $reads") | |
34 """ | |
35 mkdir -p $res_dir || exit 1 | |
36 kma \\ | |
37 $args \\ | |
38 -t_db $db${params.fs}$db_basename \\ | |
39 -t $task.cpus \\ | |
40 -o $res_dir${params.fs}$prefix \\ | |
41 $reads_in | |
42 | |
43 if [ "$get_hit_accs" == "true" ]; then | |
44 grep -v '^#' $res_dir${params.fs}${prefix}.res | \\ | |
45 grep -E -o 'GC[AF]\\_[0-9]+\\.*[0-9]*' > $res_dir${params.fs}${prefix}_template_hits.txt | |
46 fi | |
47 | |
48 cat <<-END_VERSIONS > versions.yml | |
49 "${task.process}": | |
50 kma: \$( kma -v | sed -e 's%KMA-%%' ) | |
51 END_VERSIONS | |
52 | |
53 mkdirver="" | |
54 cutver="" | |
55 grepver="" | |
56 | |
57 if [ "${workflow.containerEngine}" != "null" ]; then | |
58 mkdirver=\$( mkdir --help 2>&1 | sed -e '1!d; s/ (.*\$//' | cut -f1-2 -d' ' ) | |
59 cutver="\$mkdirver" | |
60 grepver="\$mkdirver" | |
61 else | |
62 mkdirver=\$( mkdir --version 2>&1 | sed '1!d; s/^.*(GNU coreutils//; s/) //;' ) | |
63 cutver=\$( cut --version 2>&1 | sed '1!d; s/^.*(GNU coreutils//; s/) //;' ) | |
64 grepver=\$( echo \$(grep --version 2>&1) | sed 's/^.*(GNU grep) //; s/ Copyright.*\$//' ) | |
65 fi | |
66 | |
67 cat <<-END_VERSIONS >> versions.yml | |
68 mkdir: \$mkdirver | |
69 cut: \$cutver | |
70 grep: \$grepver | |
71 END_VERSIONS | |
72 """ | |
73 } |