From eae7161a3213117c3ec6dfb37ee071cbbf896fc8 Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Sun, 8 May 2022 17:00:28 +0200 Subject: [PATCH] tests: add settings input or not and test all branches --- tests/modules/sratools/fasterqdump/main.nf | 46 +++++++++++++++++-- .../sratools/fasterqdump/nextflow.config | 3 ++ .../fasterqdump/nextflow_mount.config | 18 ++++++++ tests/modules/sratools/fasterqdump/test.yml | 44 ++++++++++++++++-- 4 files changed, 103 insertions(+), 8 deletions(-) create mode 100644 tests/modules/sratools/fasterqdump/nextflow_mount.config diff --git a/tests/modules/sratools/fasterqdump/main.nf b/tests/modules/sratools/fasterqdump/main.nf index c2b98526..2bf9daed 100644 --- a/tests/modules/sratools/fasterqdump/main.nf +++ b/tests/modules/sratools/fasterqdump/main.nf @@ -5,7 +5,11 @@ 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 { +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" archive = [ [], file(params.test_data['sarscov2']['illumina']['SRR13255544_tar_gz'], checkIfExists: true) ] UNTAR ( archive ) @@ -13,10 +17,14 @@ workflow test_sratools_fasterqdump_single_end { def input = Channel.of([ id:'test_single_end', single_end:true ]) .combine(UNTAR.out.untar.map{ it[1] }) - SRATOOLS_FASTERQDUMP ( input ) + SRATOOLS_FASTERQDUMP(input, settings) } -workflow test_sratools_fasterqdump_paired_end { +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" archive = [ [], file(params.test_data['sarscov2']['illumina']['SRR11140744_tar_gz'], checkIfExists: true) ] UNTAR ( archive ) @@ -24,5 +32,35 @@ workflow test_sratools_fasterqdump_paired_end { def input = Channel.of([ id:'test_paired_end', single_end:false ]) .combine(UNTAR.out.untar.map{ it[1] }) - SRATOOLS_FASTERQDUMP ( input ) + 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')) } diff --git a/tests/modules/sratools/fasterqdump/nextflow.config b/tests/modules/sratools/fasterqdump/nextflow.config index 8730f1c4..a6c70bd3 100644 --- a/tests/modules/sratools/fasterqdump/nextflow.config +++ b/tests/modules/sratools/fasterqdump/nextflow.config @@ -1,3 +1,6 @@ +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 new file mode 100644 index 00000000..b79d1a82 --- /dev/null +++ b/tests/modules/sratools/fasterqdump/nextflow_mount.config @@ -0,0 +1,18 @@ + +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 64cf2404..73f9a0aa 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 - 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 +- 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 tags: - sratools - sratools/fasterqdump @@ -8,9 +8,12 @@ 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 - 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 +- 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 @@ -21,3 +24,36 @@ 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 + 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"