From 0cdf7767a79faf424645beeff83ecfa5528b6a7c Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Wed, 11 May 2022 13:02:52 +0200 Subject: [PATCH] refactor: require NCBI user settings always --- modules/sratools/fasterqdump/main.nf | 6 +-- modules/sratools/fasterqdump/meta.yml | 5 +- tests/modules/sratools/fasterqdump/main.nf | 46 ++----------------- .../sratools/fasterqdump/nextflow.config | 3 -- .../fasterqdump/nextflow_mount.config | 18 -------- tests/modules/sratools/fasterqdump/test.yml | 38 ++------------- 6 files changed, 12 insertions(+), 104 deletions(-) delete mode 100644 tests/modules/sratools/fasterqdump/nextflow_mount.config diff --git a/modules/sratools/fasterqdump/main.nf b/modules/sratools/fasterqdump/main.nf index 6351efd2..18f46e51 100644 --- a/modules/sratools/fasterqdump/main.nf +++ b/modules/sratools/fasterqdump/main.nf @@ -9,7 +9,7 @@ process SRATOOLS_FASTERQDUMP { input: tuple val(meta), path(sra) - path(ncbi_settings) + path ncbi_settings output: tuple val(meta), path(output), emit: reads @@ -26,9 +26,7 @@ process SRATOOLS_FASTERQDUMP { // for unpaired reads which we ignore here. output = meta.single_end ? '*.fastq.gz' : '*_{1,2}.fastq.gz' """ - if [[ "${ncbi_settings.name}" != "EXISTS" ]]; then - export NCBI_SETTINGS="\$PWD/${ncbi_settings}" - fi + export NCBI_SETTINGS="\$PWD/${ncbi_settings}" fasterq-dump \\ $args \\ diff --git a/modules/sratools/fasterqdump/meta.yml b/modules/sratools/fasterqdump/meta.yml index ac62bc61..d6fbd444 100644 --- a/modules/sratools/fasterqdump/meta.yml +++ b/modules/sratools/fasterqdump/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/tests/modules/sratools/fasterqdump/main.nf b/tests/modules/sratools/fasterqdump/main.nf index 2bf9daed..daa7a5ae 100644 --- a/tests/modules/sratools/fasterqdump/main.nf +++ b/tests/modules/sratools/fasterqdump/main.nf @@ -5,11 +5,7 @@ nextflow.enable.dsl = 2 include { UNTAR } from '../../../../modules/untar/main.nf' include { SRATOOLS_FASTERQDUMP } from '../../../../modules/sratools/fasterqdump/main.nf' -workflow test_sratools_fasterqdump_single_end_with_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_fasterqdump_single_end { archive = [ [], file(params.test_data['sarscov2']['illumina']['SRR13255544_tar_gz'], checkIfExists: true) ] UNTAR ( archive ) @@ -17,14 +13,10 @@ workflow test_sratools_fasterqdump_single_end_with_input { def input = Channel.of([ id:'test_single_end', single_end:true ]) .combine(UNTAR.out.untar.map{ it[1] }) - SRATOOLS_FASTERQDUMP(input, settings) + SRATOOLS_FASTERQDUMP(input, file(params.test_data['generic']['config']['ncbi_user_settings'], checkIfExists: true)) } -workflow test_sratools_fasterqdump_paired_end_with_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_fasterqdump_paired_end { archive = [ [], file(params.test_data['sarscov2']['illumina']['SRR11140744_tar_gz'], checkIfExists: true) ] UNTAR ( archive ) @@ -32,35 +24,5 @@ workflow test_sratools_fasterqdump_paired_end_with_input { def input = Channel.of([ id:'test_paired_end', single_end:false ]) .combine(UNTAR.out.untar.map{ it[1] }) - SRATOOLS_FASTERQDUMP(input, settings) -} - -workflow test_sratools_fasterqdump_single_end_without_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" - - archive = [ [], file(params.test_data['sarscov2']['illumina']['SRR13255544_tar_gz'], checkIfExists: true) ] - UNTAR ( archive ) - - def input = Channel.of([ id:'test_single_end', single_end:true ]) - .combine(UNTAR.out.untar.map{ it[1] }) - - SRATOOLS_FASTERQDUMP(input, file('EXISTS')) -} - -workflow test_sratools_fasterqdump_paired_end_without_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" - - archive = [ [], file(params.test_data['sarscov2']['illumina']['SRR11140744_tar_gz'], checkIfExists: true) ] - UNTAR ( archive ) - - def input = Channel.of([ id:'test_paired_end', single_end:false ]) - .combine(UNTAR.out.untar.map{ it[1] }) - - SRATOOLS_FASTERQDUMP(input, file('EXISTS')) + SRATOOLS_FASTERQDUMP(input, file(params.test_data['generic']['config']['ncbi_user_settings'], checkIfExists: true)) } diff --git a/tests/modules/sratools/fasterqdump/nextflow.config b/tests/modules/sratools/fasterqdump/nextflow.config index a6c70bd3..8730f1c4 100644 --- a/tests/modules/sratools/fasterqdump/nextflow.config +++ b/tests/modules/sratools/fasterqdump/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/fasterqdump/nextflow_mount.config b/tests/modules/sratools/fasterqdump/nextflow_mount.config deleted file mode 100644 index b79d1a82..00000000 --- a/tests/modules/sratools/fasterqdump/nextflow_mount.config +++ /dev/null @@ -1,18 +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_FASTERQDUMP { - containerOptions = { - (workflow.containerEngine == 'singularity') ? - "-B ${params.settings_path}:${params.settings_path}" : - "-v ${params.settings_path}:${params.settings_path}" - } - } -} diff --git a/tests/modules/sratools/fasterqdump/test.yml b/tests/modules/sratools/fasterqdump/test.yml index 73f9a0aa..6fbf608c 100644 --- a/tests/modules/sratools/fasterqdump/test.yml +++ b/tests/modules/sratools/fasterqdump/test.yml @@ -1,5 +1,5 @@ -- name: sratools fasterqdump test_sratools_fasterqdump_single_end_with_input - command: nextflow run ./tests/modules/sratools/fasterqdump -entry test_sratools_fasterqdump_single_end_with_input -c ./tests/config/nextflow.config -c ./tests/modules/sratools/fasterqdump/nextflow.config +- name: sratools fasterqdump test_sratools_fasterqdump_single_end + command: nextflow run ./tests/modules/sratools/fasterqdump -entry test_sratools_fasterqdump_single_end -c ./tests/config/nextflow.config -c ./tests/modules/sratools/fasterqdump/nextflow.config tags: - sratools - sratools/fasterqdump @@ -12,38 +12,8 @@ contains: - "sratools: 2.11.0" -- name: sratools fasterqdump test_sratools_fasterqdump_paired_end_with_input - command: nextflow run ./tests/modules/sratools/fasterqdump -entry test_sratools_fasterqdump_paired_end_with_input -c ./tests/config/nextflow.config -c ./tests/modules/sratools/fasterqdump/nextflow.config - tags: - - sratools - - sratools/fasterqdump - files: - - path: output/sratools/SRR11140744_1.fastq.gz - md5sum: 193809c784a4ea132ab2a253fa4f55b6 - - path: output/sratools/SRR11140744_2.fastq.gz - md5sum: 3e3b3af3413f50a1685fd7b3f1456d4e - - path: output/untar/SRR11140744/SRR11140744.sra - md5sum: 065666caf5b2d5dfb0cb25d5f3abe659 - - path: output/sratools/versions.yml - contains: - - "sratools: 2.11.0" - -- name: sratools fasterqdump test_sratools_fasterqdump_single_end_without_input - command: nextflow run ./tests/modules/sratools/fasterqdump -entry test_sratools_fasterqdump_single_end_without_input -c ./tests/config/nextflow.config -c ./tests/modules/sratools/fasterqdump/nextflow_mount.config - tags: - - sratools - - sratools/fasterqdump - files: - - path: output/sratools/SRR13255544.fastq.gz - md5sum: 1054c7b71884acdb5eed8a378f18be82 - - path: output/untar/SRR13255544/SRR13255544.sra - md5sum: 466d05dafb2eec672150754168010b4d - - path: output/sratools/versions.yml - contains: - - "sratools: 2.11.0" - -- name: sratools fasterqdump test_sratools_fasterqdump_paired_end_without_input - command: nextflow run ./tests/modules/sratools/fasterqdump -entry test_sratools_fasterqdump_paired_end_without_input -c ./tests/config/nextflow.config -c ./tests/modules/sratools/fasterqdump/nextflow_mount.config +- name: sratools fasterqdump test_sratools_fasterqdump_paired_end + command: nextflow run ./tests/modules/sratools/fasterqdump -entry test_sratools_fasterqdump_paired_end -c ./tests/config/nextflow.config -c ./tests/modules/sratools/fasterqdump/nextflow.config tags: - sratools - sratools/fasterqdump