From ee915a43e405324e62ee5d4c14a6a6ec6c610058 Mon Sep 17 00:00:00 2001 From: Ramprasad Neethiraj <20065894+ramprasadn@users.noreply.github.com> Date: Thu, 24 Feb 2022 09:49:30 +0100 Subject: [PATCH] update svdb merge (#1274) * update svdb merge * fix undefined variable error * remove prio join in the script block * fix error * fix error again * update tests and refactor --- modules/svdb/merge/main.nf | 12 ++++++++---- tests/modules/svdb/merge/main.nf | 10 ++++++++++ tests/modules/svdb/merge/test.yml | 7 +++++++ 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/modules/svdb/merge/main.nf b/modules/svdb/merge/main.nf index 1f479ea4..505e2c0b 100644 --- a/modules/svdb/merge/main.nf +++ b/modules/svdb/merge/main.nf @@ -21,15 +21,19 @@ process SVDB_MERGE { script: def args = task.ext.args ?: '' def prefix = task.ext.prefix ?: "${meta.id}" - def input = "" - for (int index = 0; index < vcfs.size(); index++) { - input += " ${vcfs[index]}:${priority[index]}" + def input = "${vcfs.join(" ")}" + def prio = "" + if(priority) { + prio = "--priority ${priority.join(',')}" + for (int index = 0; index < vcfs.size(); index++) { + input += " ${vcfs[index]}:${priority[index]}" + } } """ svdb \\ --merge \\ $args \\ - --priority ${priority.join(',')} \\ + $prio \\ --vcf $input \\ > ${prefix}_sv_merge.vcf diff --git a/tests/modules/svdb/merge/main.nf b/tests/modules/svdb/merge/main.nf index f417c3f7..3cbb4b44 100644 --- a/tests/modules/svdb/merge/main.nf +++ b/tests/modules/svdb/merge/main.nf @@ -14,3 +14,13 @@ workflow test_svdb_merge { SVDB_MERGE ( input, priority ) } + +workflow test_svdb_merge_noprio { + + input = [ [ id:'test' ], // meta map + [ file(params.test_data['sarscov2']['illumina']['test_vcf'], checkIfExists: true), + file(params.test_data['sarscov2']['illumina']['test2_vcf'], checkIfExists: true) ] + ] + + SVDB_MERGE ( input, [] ) +} diff --git a/tests/modules/svdb/merge/test.yml b/tests/modules/svdb/merge/test.yml index 8d16562f..46c4fef0 100644 --- a/tests/modules/svdb/merge/test.yml +++ b/tests/modules/svdb/merge/test.yml @@ -5,3 +5,10 @@ - svdb/merge files: - path: output/svdb/test_sv_merge.vcf +- name: svdb merge noprio + command: nextflow run ./tests/modules/svdb/merge -entry test_svdb_merge_noprio -c ./tests/config/nextflow.config -c ./tests/modules/svdb/merge/nextflow.config + tags: + - svdb + - svdb/merge + files: + - path: output/svdb/test_sv_merge.vcf