From 1b228835e9525990db99243cb4f0d07aa6e01bc3 Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Tue, 10 May 2022 12:29:42 +0200 Subject: [PATCH] refactor: require settings input always --- modules/sratools/prefetch/meta.yml | 5 ++-- .../prefetch/templates/retry_with_backoff.sh | 4 +--- tests/modules/sratools/prefetch/main.nf | 23 ++----------------- .../modules/sratools/prefetch/nextflow.config | 3 --- .../sratools/prefetch/nextflow_mount.config | 17 -------------- tests/modules/sratools/prefetch/test.yml | 16 ++----------- 6 files changed, 7 insertions(+), 61 deletions(-) delete mode 100644 tests/modules/sratools/prefetch/nextflow_mount.config diff --git a/modules/sratools/prefetch/meta.yml b/modules/sratools/prefetch/meta.yml index f8c50a0d..a3a26522 100644 --- a/modules/sratools/prefetch/meta.yml +++ b/modules/sratools/prefetch/meta.yml @@ -25,9 +25,8 @@ input: - ncbi_settings: type: file description: > - Either a proper NCBI settings file or in case an existing file should be used, - a file with name EXISTS. - pattern: "*.mkfg | EXISTS" + An NCBI user settings file. + pattern: "*.mkfg" output: - meta: diff --git a/modules/sratools/prefetch/templates/retry_with_backoff.sh b/modules/sratools/prefetch/templates/retry_with_backoff.sh index 17395ef1..cec0ab43 100755 --- a/modules/sratools/prefetch/templates/retry_with_backoff.sh +++ b/modules/sratools/prefetch/templates/retry_with_backoff.sh @@ -40,9 +40,7 @@ retry_with_backoff() { echo "${output}" } -if [[ "!{ncbi_settings.name}" != "EXISTS" ]]; then - export NCBI_SETTINGS="$PWD/!{ncbi_settings}" -fi +export NCBI_SETTINGS="$PWD/!{ncbi_settings}" retry_with_backoff !{args2} \ prefetch \ diff --git a/tests/modules/sratools/prefetch/main.nf b/tests/modules/sratools/prefetch/main.nf index eb579920..cf9794ab 100644 --- a/tests/modules/sratools/prefetch/main.nf +++ b/tests/modules/sratools/prefetch/main.nf @@ -4,31 +4,12 @@ nextflow.enable.dsl = 2 include { SRATOOLS_PREFETCH } from '../../../../modules/sratools/prefetch/main.nf' -workflow test_sratools_prefetch_with_settings_input { - - file(params.settings_path).mkdirs() - def settings = file(params.settings_file) - settings.text = "/LIBS/GUID = \"5b0d4b7d-88c7-4802-98fd-e3afd06feb32\"\n/libs/cloud/report_instance_identity = \"true\"\n" +workflow test_sratools_prefetch { input = [ [ id:'test', single_end:false ], // meta map 'DRR000774' ] - SRATOOLS_PREFETCH(input, settings) + SRATOOLS_PREFETCH(input, file(params.test_data['generic']['config']['ncbi_user_settings'], checkIfExists: true)) } - -workflow test_sratools_prefetch_without_settings_input { - - file(params.settings_path).mkdirs() - def settings = file(params.settings_file) - settings.text = "/LIBS/GUID = \"5b0d4b7d-88c7-4802-98fd-e3afd06feb32\"\n/libs/cloud/report_instance_identity = \"true\"\n" - - input = [ - [ id:'test', single_end:false ], // meta map - 'DRR000774' - ] - - SRATOOLS_PREFETCH(input, file('EXISTS')) -} - diff --git a/tests/modules/sratools/prefetch/nextflow.config b/tests/modules/sratools/prefetch/nextflow.config index a6c70bd3..8730f1c4 100644 --- a/tests/modules/sratools/prefetch/nextflow.config +++ b/tests/modules/sratools/prefetch/nextflow.config @@ -1,6 +1,3 @@ -params.settings_path = '/tmp/.ncbi' -params.settings_file = "${params.settings_path}/user-settings.mkfg" - process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } diff --git a/tests/modules/sratools/prefetch/nextflow_mount.config b/tests/modules/sratools/prefetch/nextflow_mount.config deleted file mode 100644 index 1a0eed2a..00000000 --- a/tests/modules/sratools/prefetch/nextflow_mount.config +++ /dev/null @@ -1,17 +0,0 @@ -params.settings_path = '/tmp/.ncbi' -params.settings_file = "${params.settings_path}/user-settings.mkfg" - -env.NCBI_SETTINGS = params.settings_file - -process { - - publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - - withName: SRATOOLS_PREFETCH { - containerOptions = { - (workflow.containerEngine == 'singularity') ? - "-B ${params.settings_path}:${params.settings_path}" : - "-v ${params.settings_path}:${params.settings_path}" - } - } -} diff --git a/tests/modules/sratools/prefetch/test.yml b/tests/modules/sratools/prefetch/test.yml index d747b9a6..a6c213f8 100644 --- a/tests/modules/sratools/prefetch/test.yml +++ b/tests/modules/sratools/prefetch/test.yml @@ -1,17 +1,5 @@ -- name: sratools prefetch test_sratools_prefetch_with_settings_input - command: nextflow run ./tests/modules/sratools/prefetch -entry test_sratools_prefetch_with_settings_input -c ./tests/config/nextflow.config -c ./tests/modules/sratools/prefetch/nextflow.config - tags: - - sratools/prefetch - - sratools - files: - - path: output/sratools/DRR000774/DRR000774.sra - md5sum: 7647dba20c89c0e3d7ad13842f060eb0 - - path: output/sratools/versions.yml - contains: - - "sratools: 2.11.0" - -- name: sratools prefetch test_sratools_prefetch_without_settings_input - command: nextflow run ./tests/modules/sratools/prefetch -entry test_sratools_prefetch_without_settings_input -c ./tests/config/nextflow.config -c ./tests/modules/sratools/prefetch/nextflow_mount.config +- name: sratools prefetch test_sratools_prefetch + command: nextflow run ./tests/modules/sratools/prefetch -entry test_sratools_prefetch -c ./tests/config/nextflow.config -c ./tests/modules/sratools/prefetch/nextflow.config tags: - sratools/prefetch - sratools