From 5d593bdb45eb241e65c9c7b1a4ffb2cf48ce695d Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Sun, 8 May 2022 16:44:33 +0200 Subject: [PATCH 01/24] docs: correct license and input description --- modules/sratools/fasterqdump/meta.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/modules/sratools/fasterqdump/meta.yml b/modules/sratools/fasterqdump/meta.yml index ec5f69a5..ac62bc61 100644 --- a/modules/sratools/fasterqdump/meta.yml +++ b/modules/sratools/fasterqdump/meta.yml @@ -10,7 +10,7 @@ tools: homepage: https://github.com/ncbi/sra-tools documentation: https://github.com/ncbi/sra-tools/wiki tool_dev_url: https://github.com/ncbi/sra-tools - licence: ["US-Government-Work"] + licence: ["Public Domain"] input: - meta: @@ -22,6 +22,12 @@ input: type: directory description: Directory containing ETL data for the given SRA. pattern: "*/*.sra" + - 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" output: - meta: From d4f13ebfff9b421bd36dbc6001669078adc2369a Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Sun, 8 May 2022 16:46:52 +0200 Subject: [PATCH 02/24] refactor: create new settings input --- modules/sratools/fasterqdump/main.nf | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/modules/sratools/fasterqdump/main.nf b/modules/sratools/fasterqdump/main.nf index 1980ffeb..6351efd2 100644 --- a/modules/sratools/fasterqdump/main.nf +++ b/modules/sratools/fasterqdump/main.nf @@ -9,6 +9,7 @@ process SRATOOLS_FASTERQDUMP { input: tuple val(meta), path(sra) + path(ncbi_settings) output: tuple val(meta), path(output), emit: reads @@ -20,16 +21,13 @@ process SRATOOLS_FASTERQDUMP { script: def args = task.ext.args ?: '' def args2 = task.ext.args2 ?: '' - def config = "/LIBS/GUID = \"${UUID.randomUUID().toString()}\"\\n/libs/cloud/report_instance_identity = \"true\"\\n" // Paired-end data extracted by fasterq-dump (--split-3 the default) always creates // *_1.fastq *_2.fastq files but sometimes also an additional *.fastq file // for unpaired reads which we ignore here. output = meta.single_end ? '*.fastq.gz' : '*_{1,2}.fastq.gz' """ - eval "\$(vdb-config -o n NCBI_SETTINGS | sed 's/[" ]//g')" - if [[ ! -f "\${NCBI_SETTINGS}" ]]; then - mkdir -p "\$(dirname "\${NCBI_SETTINGS}")" - printf '${config}' > "\${NCBI_SETTINGS}" + if [[ "${ncbi_settings.name}" != "EXISTS" ]]; then + export NCBI_SETTINGS="\$PWD/${ncbi_settings}" fi fasterq-dump \\ From eae7161a3213117c3ec6dfb37ee071cbbf896fc8 Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Sun, 8 May 2022 17:00:28 +0200 Subject: [PATCH 03/24] 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" From 0cdf7767a79faf424645beeff83ecfa5528b6a7c Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Wed, 11 May 2022 13:02:52 +0200 Subject: [PATCH 04/24] 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 From 3ae8cbfad754dc45cae7fb42315f2873a7e9e417 Mon Sep 17 00:00:00 2001 From: CMGG ICT Team Date: Wed, 11 May 2022 13:32:56 +0200 Subject: [PATCH 05/24] bowtie2: remove code duplication --- modules/bowtie2/align/main.nf | 112 +++++++++++++-------------- tests/modules/bowtie2/align/test.yml | 88 ++++----------------- 2 files changed, 65 insertions(+), 135 deletions(-) diff --git a/modules/bowtie2/align/main.nf b/modules/bowtie2/align/main.nf index c233f955..18209bdf 100644 --- a/modules/bowtie2/align/main.nf +++ b/modules/bowtie2/align/main.nf @@ -1,11 +1,11 @@ process BOWTIE2_ALIGN { tag "$meta.id" - label 'process_high' + label "process_high" - conda (params.enable_conda ? 'bioconda::bowtie2=2.4.4 bioconda::samtools=1.15.1 conda-forge::pigz=2.6' : null) - container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? - 'https://depot.galaxyproject.org/singularity/mulled-v2-ac74a7f02cebcfcc07d8e8d1d750af9c83b4d45a:1744f68fe955578c63054b55309e05b41c37a80d-0' : - 'quay.io/biocontainers/mulled-v2-ac74a7f02cebcfcc07d8e8d1d750af9c83b4d45a:1744f68fe955578c63054b55309e05b41c37a80d-0' }" + conda (params.enable_conda ? "bioconda::bowtie2=2.4.4 bioconda::samtools=1.15.1 conda-forge::pigz=2.6" : null) + container "${ workflow.containerEngine == "singularity" && !task.ext.singularity_pull_docker_container ? + "https://depot.galaxyproject.org/singularity/mulled-v2-ac74a7f02cebcfcc07d8e8d1d750af9c83b4d45a:1744f68fe955578c63054b55309e05b41c37a80d-0" : + "quay.io/biocontainers/mulled-v2-ac74a7f02cebcfcc07d8e8d1d750af9c83b4d45a:1744f68fe955578c63054b55309e05b41c37a80d-0" }" input: tuple val(meta), path(reads) @@ -13,69 +13,61 @@ process BOWTIE2_ALIGN { val save_unaligned output: - tuple val(meta), path('*.bam') , emit: bam - tuple val(meta), path('*.log') , emit: log - tuple val(meta), path('*fastq.gz'), emit: fastq, optional:true + tuple val(meta), path("*.bam") , emit: bam + tuple val(meta), path("*.log") , emit: log + tuple val(meta), path("*fastq.gz"), emit: fastq, optional:true path "versions.yml" , emit: versions when: task.ext.when == null || task.ext.when script: - def args = task.ext.args ?: '' - def args2 = task.ext.args2 ?: '' + def args = task.ext.args ?: "" + def args2 = task.ext.args2 ?: "" def prefix = task.ext.prefix ?: "${meta.id}" + + def unaligned = "" + def reads_args = "" + if (meta.single_end) { - def unaligned = save_unaligned ? "--un-gz ${prefix}.unmapped.fastq.gz" : '' - """ - INDEX=`find -L ./ -name "*.rev.1.bt2" | sed 's/.rev.1.bt2//'` - [ -z "\$INDEX" ] && INDEX=`find -L ./ -name "*.rev.1.bt2l" | sed 's/.rev.1.bt2l//'` - [ -z "\$INDEX" ] && echo "BT2 index files not found" 1>&2 && exit 1 - bowtie2 \\ - -x \$INDEX \\ - -U $reads \\ - --threads $task.cpus \\ - $unaligned \\ - $args \\ - 2> ${prefix}.bowtie2.log \\ - | samtools view -@ $task.cpus $args2 -bhS -o ${prefix}.bam - - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - bowtie2: \$(echo \$(bowtie2 --version 2>&1) | sed 's/^.*bowtie2-align-s version //; s/ .*\$//') - samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') - pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) - END_VERSIONS - """ + unaligned = save_unaligned ? "--un-gz ${prefix}.unmapped.fastq.gz" : "" + reads_args = "-U ${reads}" } else { - def unaligned = save_unaligned ? "--un-conc-gz ${prefix}.unmapped.fastq.gz" : '' - """ - INDEX=`find -L ./ -name "*.rev.1.bt2" | sed 's/.rev.1.bt2//'` - [ -z "\$INDEX" ] && INDEX=`find -L ./ -name "*.rev.1.bt2l" | sed 's/.rev.1.bt2l//'` - [ -z "\$INDEX" ] && echo "BT2 index files not found" 1>&2 && exit 1 - bowtie2 \\ - -x \$INDEX \\ - -1 ${reads[0]} \\ - -2 ${reads[1]} \\ - --threads $task.cpus \\ - $unaligned \\ - $args \\ - 2> ${prefix}.bowtie2.log \\ - | samtools view -@ $task.cpus $args2 -bhS -o ${prefix}.bam - - - if [ -f ${prefix}.unmapped.fastq.1.gz ]; then - mv ${prefix}.unmapped.fastq.1.gz ${prefix}.unmapped_1.fastq.gz - fi - if [ -f ${prefix}.unmapped.fastq.2.gz ]; then - mv ${prefix}.unmapped.fastq.2.gz ${prefix}.unmapped_2.fastq.gz - fi - - cat <<-END_VERSIONS > versions.yml - "${task.process}": - bowtie2: \$(echo \$(bowtie2 --version 2>&1) | sed 's/^.*bowtie2-align-s version //; s/ .*\$//') - samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') - pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) - END_VERSIONS - """ + unaligned = save_unaligned ? "--un-conc-gz ${prefix}.unmapped.fastq.gz" : "" + reads_args = "-1 ${reads[0]} -2 ${reads[1]}" } + + def samtools = "samtools view -@ $task.cpus --fast --with-header ${args2} > ${prefix}.bam" + + + """ + INDEX=`find -L ./ -name "*.rev.1.bt2" | sed "s/.rev.1.bt2//"` + [ -z "\$INDEX" ] && INDEX=`find -L ./ -name "*.rev.1.bt2l" | sed "s/.rev.1.bt2l//"` + [ -z "\$INDEX" ] && echo "BT2 index files not found" 1>&2 && exit 1 + + bowtie2 \\ + -x \$INDEX \\ + ${reads_args} \\ + --threads $task.cpus \\ + ${unaligned} \\ + $args \\ + 2> ${prefix}.bowtie2.log \\ + | ${samtools} + + if [ -f ${prefix}.unmapped.fastq.1.gz ]; then + mv ${prefix}.unmapped.fastq.1.gz ${prefix}.unmapped_1.fastq.gz + fi + + if [ -f ${prefix}.unmapped.fastq.2.gz ]; then + mv ${prefix}.unmapped.fastq.2.gz ${prefix}.unmapped_2.fastq.gz + fi + + cat <<-END_VERSIONS > versions.yml + "${task.process}": + bowtie2: \$(echo \$(bowtie2 --version 2>&1) | sed 's/^.*bowtie2-align-s version //; s/ .*\$//') + samtools: \$(echo \$(samtools --version 2>&1) | sed 's/^.*samtools //; s/Using.*\$//') + pigz: \$( pigz --version 2>&1 | sed 's/pigz //g' ) + END_VERSIONS + """ } + diff --git a/tests/modules/bowtie2/align/test.yml b/tests/modules/bowtie2/align/test.yml index ea9aa72a..b3cb8330 100644 --- a/tests/modules/bowtie2/align/test.yml +++ b/tests/modules/bowtie2/align/test.yml @@ -1,83 +1,21 @@ -- name: bowtie2 align single-end - command: nextflow run ./tests/modules/bowtie2/align -entry test_bowtie2_align_single_end -c ./tests/config/nextflow.config -c ./tests/modules/bowtie2/align/nextflow.config +- name: bowtie2 align test_bowtie2_align_single_end + command: nextflow run tests/modules/bowtie2/align -entry test_bowtie2_align_single_end -c tests/config/nextflow.config tags: - - bowtie2 - bowtie2/align + - bowtie2 files: - - path: ./output/bowtie2/test.bam - - path: ./output/bowtie2/test.bowtie2.log - - path: ./output/bowtie2/bowtie2/genome.3.bt2 - md5sum: 4ed93abba181d8dfab2e303e33114777 - - path: ./output/bowtie2/bowtie2/genome.2.bt2 - md5sum: 47b153cd1319abc88dda532462651fcf - - path: ./output/bowtie2/bowtie2/genome.1.bt2 - md5sum: cbe3d0bbea55bc57c99b4bfa25b5fbdf - - path: ./output/bowtie2/bowtie2/genome.4.bt2 - md5sum: c25be5f8b0378abf7a58c8a880b87626 - - path: ./output/bowtie2/bowtie2/genome.rev.1.bt2 - md5sum: 52be6950579598a990570fbcf5372184 - - path: ./output/bowtie2/bowtie2/genome.rev.2.bt2 - md5sum: e3b4ef343dea4dd571642010a7d09597 + - path: output/bowtie2/test.bam + - path: output/bowtie2/test.bowtie2.log + md5sum: 7b8a9e61b7646da1089b041333c41a87 + - path: output/bowtie2/versions.yml -- name: bowtie2 align paired-end - command: nextflow run ./tests/modules/bowtie2/align -entry test_bowtie2_align_paired_end -c ./tests/config/nextflow.config -c ./tests/modules/bowtie2/align/nextflow.config +- name: bowtie2 align test_bowtie2_align_paired_end + command: nextflow run tests/modules/bowtie2/align -entry test_bowtie2_align_paired_end -c tests/config/nextflow.config tags: - - bowtie2 - bowtie2/align - files: - - path: ./output/bowtie2/test.bam - - path: ./output/bowtie2/test.bowtie2.log - - path: ./output/bowtie2/bowtie2/genome.3.bt2 - md5sum: 4ed93abba181d8dfab2e303e33114777 - - path: ./output/bowtie2/bowtie2/genome.2.bt2 - md5sum: 47b153cd1319abc88dda532462651fcf - - path: ./output/bowtie2/bowtie2/genome.1.bt2 - md5sum: cbe3d0bbea55bc57c99b4bfa25b5fbdf - - path: ./output/bowtie2/bowtie2/genome.4.bt2 - md5sum: c25be5f8b0378abf7a58c8a880b87626 - - path: ./output/bowtie2/bowtie2/genome.rev.1.bt2 - md5sum: 52be6950579598a990570fbcf5372184 - - path: ./output/bowtie2/bowtie2/genome.rev.2.bt2 - md5sum: e3b4ef343dea4dd571642010a7d09597 - -- name: bowtie2 align single-end large-index - command: nextflow run ./tests/modules/bowtie2/align -entry test_bowtie2_align_single_end -c ./tests/config/nextflow.config -c ./tests/modules/bowtie2/align/nextflow.config --force_large_index - tags: - bowtie2 - - bowtie2/align files: - - path: ./output/bowtie2/test.bam - - path: ./output/bowtie2/test.bowtie2.log - - path: ./output/bowtie2/bowtie2/genome.3.bt2l - md5sum: 8952b3e0b1ce9a7a5916f2e147180853 - - path: ./output/bowtie2/bowtie2/genome.2.bt2l - md5sum: 22c284084784a0720989595e0c9461fd - - path: ./output/bowtie2/bowtie2/genome.1.bt2l - md5sum: 07d811cd4e350d56267183d2ac7023a5 - - path: ./output/bowtie2/bowtie2/genome.4.bt2l - md5sum: c25be5f8b0378abf7a58c8a880b87626 - - path: ./output/bowtie2/bowtie2/genome.rev.1.bt2l - md5sum: fda48e35925fb24d1c0785f021981e25 - - path: ./output/bowtie2/bowtie2/genome.rev.2.bt2l - md5sum: 802c26d32b970e1b105032b7ce7348b4 - -- name: bowtie2 align paired-end large-index - command: nextflow run ./tests/modules/bowtie2/align -entry test_bowtie2_align_paired_end -c ./tests/config/nextflow.config -c ./tests/modules/bowtie2/align/nextflow.config --force_large_index - tags: - - bowtie2 - - bowtie2/align - files: - - path: ./output/bowtie2/test.bam - - path: ./output/bowtie2/test.bowtie2.log - - path: ./output/bowtie2/bowtie2/genome.3.bt2l - md5sum: 8952b3e0b1ce9a7a5916f2e147180853 - - path: ./output/bowtie2/bowtie2/genome.2.bt2l - md5sum: 22c284084784a0720989595e0c9461fd - - path: ./output/bowtie2/bowtie2/genome.1.bt2l - md5sum: 07d811cd4e350d56267183d2ac7023a5 - - path: ./output/bowtie2/bowtie2/genome.4.bt2l - md5sum: c25be5f8b0378abf7a58c8a880b87626 - - path: ./output/bowtie2/bowtie2/genome.rev.1.bt2l - md5sum: fda48e35925fb24d1c0785f021981e25 - - path: ./output/bowtie2/bowtie2/genome.rev.2.bt2l - md5sum: 802c26d32b970e1b105032b7ce7348b4 + - path: output/bowtie2/test.bam + - path: output/bowtie2/test.bowtie2.log + md5sum: bd89ce1b28c93bf822bae391ffcedd19 + - path: output/bowtie2/versions.yml From 0d00452ecaff35d83ce931f57be9ab6244245c36 Mon Sep 17 00:00:00 2001 From: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Date: Wed, 11 May 2022 13:55:45 +0200 Subject: [PATCH 06/24] Update tests/modules/bowtie2/align/test.yml Co-authored-by: Harshil Patel --- tests/modules/bowtie2/align/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/modules/bowtie2/align/test.yml b/tests/modules/bowtie2/align/test.yml index b3cb8330..9aec709c 100644 --- a/tests/modules/bowtie2/align/test.yml +++ b/tests/modules/bowtie2/align/test.yml @@ -1,5 +1,5 @@ - name: bowtie2 align test_bowtie2_align_single_end - command: nextflow run tests/modules/bowtie2/align -entry test_bowtie2_align_single_end -c tests/config/nextflow.config + command: nextflow run ./tests/modules/bowtie2/align -entry test_bowtie2_align_single_end -c ./tests/config/nextflow.config -c ./tests/modules/bowtie2/align/nextflow.config tags: - bowtie2/align - bowtie2 From 9dd083fa9480fd03b4995e364d2634e78b572049 Mon Sep 17 00:00:00 2001 From: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Date: Wed, 11 May 2022 13:55:55 +0200 Subject: [PATCH 07/24] Update modules/bowtie2/align/main.nf Co-authored-by: Harshil Patel --- modules/bowtie2/align/main.nf | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/bowtie2/align/main.nf b/modules/bowtie2/align/main.nf index 18209bdf..605aae34 100644 --- a/modules/bowtie2/align/main.nf +++ b/modules/bowtie2/align/main.nf @@ -28,7 +28,6 @@ process BOWTIE2_ALIGN { def unaligned = "" def reads_args = "" - if (meta.single_end) { unaligned = save_unaligned ? "--un-gz ${prefix}.unmapped.fastq.gz" : "" reads_args = "-U ${reads}" From 94e8c3a882b7c03e7c24ee9a710a28511e31611f Mon Sep 17 00:00:00 2001 From: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Date: Wed, 11 May 2022 13:56:03 +0200 Subject: [PATCH 08/24] Update tests/modules/bowtie2/align/test.yml Co-authored-by: Harshil Patel --- tests/modules/bowtie2/align/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/modules/bowtie2/align/test.yml b/tests/modules/bowtie2/align/test.yml index 9aec709c..ef05d70d 100644 --- a/tests/modules/bowtie2/align/test.yml +++ b/tests/modules/bowtie2/align/test.yml @@ -10,7 +10,7 @@ - path: output/bowtie2/versions.yml - name: bowtie2 align test_bowtie2_align_paired_end - command: nextflow run tests/modules/bowtie2/align -entry test_bowtie2_align_paired_end -c tests/config/nextflow.config + command: nextflow run ./tests/modules/bowtie2/align -entry test_bowtie2_align_paired_end -c ./tests/config/nextflow.config -c ./tests/modules/bowtie2/align/nextflow.config tags: - bowtie2/align - bowtie2 From ff4b297827d3a78ea66172241a4ed414ea1148da Mon Sep 17 00:00:00 2001 From: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Date: Wed, 11 May 2022 13:57:11 +0200 Subject: [PATCH 09/24] Update modules/bowtie2/align/main.nf Co-authored-by: Harshil Patel --- modules/bowtie2/align/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/bowtie2/align/main.nf b/modules/bowtie2/align/main.nf index 605aae34..8ee198bb 100644 --- a/modules/bowtie2/align/main.nf +++ b/modules/bowtie2/align/main.nf @@ -48,7 +48,7 @@ process BOWTIE2_ALIGN { -x \$INDEX \\ ${reads_args} \\ --threads $task.cpus \\ - ${unaligned} \\ + $unaligned \\ $args \\ 2> ${prefix}.bowtie2.log \\ | ${samtools} From b456d8fa0aa797258ea9a308120be45e5b7b9667 Mon Sep 17 00:00:00 2001 From: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Date: Wed, 11 May 2022 13:57:19 +0200 Subject: [PATCH 10/24] Update modules/bowtie2/align/main.nf Co-authored-by: Harshil Patel --- modules/bowtie2/align/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/bowtie2/align/main.nf b/modules/bowtie2/align/main.nf index 8ee198bb..b7334614 100644 --- a/modules/bowtie2/align/main.nf +++ b/modules/bowtie2/align/main.nf @@ -46,7 +46,7 @@ process BOWTIE2_ALIGN { bowtie2 \\ -x \$INDEX \\ - ${reads_args} \\ + $reads_args \\ --threads $task.cpus \\ $unaligned \\ $args \\ From 971a889e2a8adce2c8831f296ac37d335c5f93c7 Mon Sep 17 00:00:00 2001 From: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Date: Wed, 11 May 2022 13:57:27 +0200 Subject: [PATCH 11/24] Update modules/bowtie2/align/main.nf Co-authored-by: Harshil Patel --- modules/bowtie2/align/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/bowtie2/align/main.nf b/modules/bowtie2/align/main.nf index b7334614..6d65aa50 100644 --- a/modules/bowtie2/align/main.nf +++ b/modules/bowtie2/align/main.nf @@ -42,7 +42,7 @@ process BOWTIE2_ALIGN { """ INDEX=`find -L ./ -name "*.rev.1.bt2" | sed "s/.rev.1.bt2//"` [ -z "\$INDEX" ] && INDEX=`find -L ./ -name "*.rev.1.bt2l" | sed "s/.rev.1.bt2l//"` - [ -z "\$INDEX" ] && echo "BT2 index files not found" 1>&2 && exit 1 + [ -z "\$INDEX" ] && echo "Bowtie2 index files not found" 1>&2 && exit 1 bowtie2 \\ -x \$INDEX \\ From 9097abf277f25b34bd41480c35bd7deac6f9a7c2 Mon Sep 17 00:00:00 2001 From: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Date: Wed, 11 May 2022 13:58:58 +0200 Subject: [PATCH 12/24] Update modules/bowtie2/align/main.nf Co-authored-by: Harshil Patel --- modules/bowtie2/align/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/bowtie2/align/main.nf b/modules/bowtie2/align/main.nf index 6d65aa50..126c93ae 100644 --- a/modules/bowtie2/align/main.nf +++ b/modules/bowtie2/align/main.nf @@ -36,7 +36,7 @@ process BOWTIE2_ALIGN { reads_args = "-1 ${reads[0]} -2 ${reads[1]}" } - def samtools = "samtools view -@ $task.cpus --fast --with-header ${args2} > ${prefix}.bam" + def samtools_command = "samtools view -@ $task.cpus --fast --with-header ${args2} > ${prefix}.bam" """ From bcd7fe55b171e4532cd19312c091258ee7ccc26a Mon Sep 17 00:00:00 2001 From: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Date: Wed, 11 May 2022 13:59:03 +0200 Subject: [PATCH 13/24] Update modules/bowtie2/align/main.nf Co-authored-by: Harshil Patel --- modules/bowtie2/align/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/bowtie2/align/main.nf b/modules/bowtie2/align/main.nf index 126c93ae..9fd19469 100644 --- a/modules/bowtie2/align/main.nf +++ b/modules/bowtie2/align/main.nf @@ -51,7 +51,7 @@ process BOWTIE2_ALIGN { $unaligned \\ $args \\ 2> ${prefix}.bowtie2.log \\ - | ${samtools} + | $samtools_command if [ -f ${prefix}.unmapped.fastq.1.gz ]; then mv ${prefix}.unmapped.fastq.1.gz ${prefix}.unmapped_1.fastq.gz From fbe2f85e7b9a047c6deed6155c145422524959ee Mon Sep 17 00:00:00 2001 From: Mahesh Binzer-Panchal Date: Wed, 11 May 2022 13:53:38 +0000 Subject: [PATCH 14/24] Fix path --- tests/config/test_data.config | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/config/test_data.config b/tests/config/test_data.config index 63c3ac16..aaab2243 100644 --- a/tests/config/test_data.config +++ b/tests/config/test_data.config @@ -382,7 +382,7 @@ params { test3_gff = "${test_data_dir}/genomics/prokaryotes/candidatus_portiera_aleyrodidarum/genome/gff/test3.gff" } 'illumina' { - test_1_fastq_gz = "${test_data_dir}/genomics/prokaryotes/candidatus_portiera_aleyrodidarum/illumina/fasta/test_1.fastq.gz" + test_1_fastq_gz = "${test_data_dir}/genomics/prokaryotes/candidatus_portiera_aleyrodidarum/illumina/fastq/test_1.fastq.gz" test_2_fastq_gz = "${test_data_dir}/genomics/prokaryotes/candidatus_portiera_aleyrodidarum/illumina/fastq/test_2.fastq.gz" test_se_fastq_gz = "${test_data_dir}/genomics/prokaryotes/candidatus_portiera_aleyrodidarum/illumina/fastq/test_se.fastq.gz" } From c8d3de2ad965bfd8e165f6f6d91249eea3436854 Mon Sep 17 00:00:00 2001 From: Matthias De Smet <11850640+matthdsm@users.noreply.github.com> Date: Wed, 11 May 2022 16:17:30 +0200 Subject: [PATCH 15/24] restore samtools cmd to defaults --- modules/bowtie2/align/main.nf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/bowtie2/align/main.nf b/modules/bowtie2/align/main.nf index 9fd19469..38242fcb 100644 --- a/modules/bowtie2/align/main.nf +++ b/modules/bowtie2/align/main.nf @@ -36,7 +36,7 @@ process BOWTIE2_ALIGN { reads_args = "-1 ${reads[0]} -2 ${reads[1]}" } - def samtools_command = "samtools view -@ $task.cpus --fast --with-header ${args2} > ${prefix}.bam" + def samtools_command = "samtools view -@ $task.cpus --bam --with-header ${args2} > ${prefix}.bam" """ From 64ff23f3c1d26e22742e13e93da29b52a82da8d2 Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Sun, 8 May 2022 15:44:13 +0200 Subject: [PATCH 16/24] feat: add module that verifies NCBI settings --- modules/sratools/ncbisettings/main.nf | 20 ++++++++ modules/sratools/ncbisettings/meta.yml | 28 +++++++++++ .../templates/detect_ncbi_settings.sh | 39 ++++++++++++++++ tests/config/pytest_modules.yml | 4 ++ tests/modules/sratools/ncbisettings/main.nf | 46 +++++++++++++++++++ .../sratools/ncbisettings/nextflow.config | 17 +++++++ tests/modules/sratools/ncbisettings/test.yml | 44 ++++++++++++++++++ 7 files changed, 198 insertions(+) create mode 100644 modules/sratools/ncbisettings/main.nf create mode 100644 modules/sratools/ncbisettings/meta.yml create mode 100644 modules/sratools/ncbisettings/templates/detect_ncbi_settings.sh create mode 100644 tests/modules/sratools/ncbisettings/main.nf create mode 100644 tests/modules/sratools/ncbisettings/nextflow.config create mode 100644 tests/modules/sratools/ncbisettings/test.yml diff --git a/modules/sratools/ncbisettings/main.nf b/modules/sratools/ncbisettings/main.nf new file mode 100644 index 00000000..9d905f8b --- /dev/null +++ b/modules/sratools/ncbisettings/main.nf @@ -0,0 +1,20 @@ +process SRATOOLS_NCBISETTINGS { + tag 'ncbi-settings' + label 'process_low' + + conda (params.enable_conda ? 'bioconda::sra-tools=2.11.0' : null) + container "${ workflow.containerEngine == 'singularity' && !task.ext.singularity_pull_docker_container ? + 'https://depot.galaxyproject.org/singularity/sra-tools:2.11.0--pl5321ha49a11a_3' : + 'quay.io/biocontainers/sra-tools:2.11.0--pl5321ha49a11a_3' }" + + output: + path('user-settings.mkfg'), optional: true, emit: ncbi_settings + path 'versions.yml' , emit: versions + + when: + task.ext.when == null || task.ext.when + + shell: + config = "/LIBS/GUID = \"${UUID.randomUUID().toString()}\"\\n/libs/cloud/report_instance_identity = \"true\"\\n" + template 'detect_ncbi_settings.sh' +} diff --git a/modules/sratools/ncbisettings/meta.yml b/modules/sratools/ncbisettings/meta.yml new file mode 100644 index 00000000..29bcfe34 --- /dev/null +++ b/modules/sratools/ncbisettings/meta.yml @@ -0,0 +1,28 @@ +name: "sratools_ncbisettings" +description: Test for the presence of suitable NCBI settings or create them on the fly. +keywords: + - NCBI + - settings + - sra-tools + - prefetch + - fasterq-dump +tools: + - "sratools": + description: "SRA Toolkit and SDK from NCBI" + homepage: https://github.com/ncbi/sra-tools + documentation: https://github.com/ncbi/sra-tools/wiki + tool_dev_url: https://github.com/ncbi/sra-tools + licence: "['Public Domain']" + +output: + - versions: + type: file + description: File containing software versions + pattern: "versions.yml" + - ncbi_settings: + type: file + description: An optional, minimal NCBI settings file. + pattern: "user-settings.mkfg" + +authors: + - "@Midnighter" diff --git a/modules/sratools/ncbisettings/templates/detect_ncbi_settings.sh b/modules/sratools/ncbisettings/templates/detect_ncbi_settings.sh new file mode 100644 index 00000000..b1b51c1f --- /dev/null +++ b/modules/sratools/ncbisettings/templates/detect_ncbi_settings.sh @@ -0,0 +1,39 @@ +#!/usr/bin/env bash + +set -u + + +# Get the expected NCBI settings path and define the environment variable +# `NCBI_SETTINGS`. +eval "$(vdb-config -o n NCBI_SETTINGS | sed 's/[" ]//g')" + +# If the user settings do not exist yet, create a file suitable for `prefetch` +# and `fasterq-dump`. If an existing settings file does not contain the required +# values, error out with a helpful message. +if [[ ! -f "${NCBI_SETTINGS}" ]]; then + printf '!{config}' > 'user-settings.mkfg' +else + prefetch --help &> /dev/null + if [[ $? = 78 ]]; then + echo "You have an existing vdb-config at '${NCBI_SETTINGS}' but it is"\ + "missing the required entries for /LIBS/GUID and"\ + "/libs/cloud/report_instance_identity."\ + "Feel free to add the following to your settings file:" >&2 + echo "$(printf '!{config}')" >&2 + exit 1 + fi + fasterq-dump --help &> /dev/null + if [[ $? = 78 ]]; then + echo "You have an existing vdb-config at '${NCBI_SETTINGS}' but it is"\ + "missing the required entries for /LIBS/GUID and"\ + "/libs/cloud/report_instance_identity."\ + "Feel free to add the following to your settings file:" >&2 + echo "$(printf '!{config}')" >&2 + exit 1 + fi +fi + +cat <<-END_VERSIONS > versions.yml +"!{task.process}": + sratools: $(vdb-config --version 2>&1 | grep -Eo '[0-9.]+') +END_VERSIONS diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 9afe83fd..4a922a4d 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -1819,6 +1819,10 @@ sratools/fasterqdump: - modules/sratools/fasterqdump/** - tests/modules/sratools/fasterqdump/** +sratools/ncbisettings: + - modules/sratools/ncbisettings/** + - tests/modules/sratools/ncbisettings/** + sratools/prefetch: - modules/sratools/prefetch/** - tests/modules/sratools/prefetch/** diff --git a/tests/modules/sratools/ncbisettings/main.nf b/tests/modules/sratools/ncbisettings/main.nf new file mode 100644 index 00000000..08968bb9 --- /dev/null +++ b/tests/modules/sratools/ncbisettings/main.nf @@ -0,0 +1,46 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { SRATOOLS_NCBISETTINGS } from '../../../../modules/sratools/ncbisettings/main.nf' + +workflow test_sratools_ncbisettings_with_good_existing { + + 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" + + SRATOOLS_NCBISETTINGS() +} + +workflow test_sratools_ncbisettings_with_bad_existing { + + file(params.settings_path).mkdirs() + def settings = file(params.settings_file) + settings.text = ''' + ## auto-generated configuration file - DO NOT EDIT ## + + config/default = "false" + /repository/remote/main/CGI/resolver-cgi = "https://trace.ncbi.nlm.nih.gov/Traces/names/names.fcgi" + /repository/remote/protected/CGI/resolver-cgi = "https://trace.ncbi.nlm.nih.gov/Traces/names/names.fcgi" + /repository/user/ad/public/apps/file/volumes/flatAd = "." + /repository/user/ad/public/apps/refseq/volumes/refseqAd = "." + /repository/user/ad/public/apps/sra/volumes/sraAd = "." + /repository/user/ad/public/apps/sraPileup/volumes/ad = "." + /repository/user/ad/public/apps/sraRealign/volumes/ad = "." + /repository/user/ad/public/apps/wgs/volumes/wgsAd = "." + /repository/user/ad/public/root = "." + /repository/user/default-path = "/root/ncbi" + '''.stripIndent() + + SRATOOLS_NCBISETTINGS() +} + +workflow test_sratools_ncbisettings_with_nonexisting { + + file(params.settings_path).mkdirs() + def settings = file(params.settings_file) + settings.delete() + + SRATOOLS_NCBISETTINGS() +} diff --git a/tests/modules/sratools/ncbisettings/nextflow.config b/tests/modules/sratools/ncbisettings/nextflow.config new file mode 100644 index 00000000..823082c0 --- /dev/null +++ b/tests/modules/sratools/ncbisettings/nextflow.config @@ -0,0 +1,17 @@ +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_NCBISETTINGS { + containerOptions = { + (workflow.containerEngine == 'singularity') ? + "-B ${params.settings_path}:${params.settings_path}" : + "-v ${params.settings_path}:${params.settings_path}" + } + } +} diff --git a/tests/modules/sratools/ncbisettings/test.yml b/tests/modules/sratools/ncbisettings/test.yml new file mode 100644 index 00000000..07c45dc7 --- /dev/null +++ b/tests/modules/sratools/ncbisettings/test.yml @@ -0,0 +1,44 @@ +- name: "sratools ncbisettings test_sratools_ncbisettings_with_good_existing" + command: nextflow run ./tests/modules/sratools/ncbisettings -entry test_sratools_ncbisettings_with_good_existing -c ./tests/config/nextflow.config -c ./tests/modules/sratools/ncbisettings/nextflow.config + tags: + - "sratools" + - "sratools/ncbisettings" + files: + - path: "output/sratools/user-settings.mkfg" + should_exist: false + - path: output/sratools/versions.yml + contains: + - "sratools: 2.11.0" + +- name: "sratools ncbisettings test_sratools_ncbisettings_with_bad_existing" + command: nextflow run ./tests/modules/sratools/ncbisettings -entry test_sratools_ncbisettings_with_bad_existing -c ./tests/config/nextflow.config -c ./tests/modules/sratools/ncbisettings/nextflow.config + tags: + - "sratools" + - "sratools/ncbisettings" + exit_code: 1 + stdout: + contains: + - "Command error:" + - "missing the required entries" + - "/LIBS/GUID" + - "/libs/cloud/report_instance_identity" + - "Feel free to add the following" + files: + - path: "output/sratools/user-settings.mkfg" + should_exist: false + - path: output/sratools/versions.yml + should_exist: false + +- name: "sratools ncbisettings test_sratools_ncbisettings_with_nonexisting" + command: nextflow run ./tests/modules/sratools/ncbisettings -entry test_sratools_ncbisettings_with_nonexisting -c ./tests/config/nextflow.config -c ./tests/modules/sratools/ncbisettings/nextflow.config + tags: + - "sratools" + - "sratools/ncbisettings" + files: + - path: "output/sratools/user-settings.mkfg" + contains: + - "/LIBS/GUID" + - "/libs/cloud/report_instance_identity" + - path: output/sratools/versions.yml + contains: + - "sratools: 2.11.0" From e4551a9ab3bf4317a485ddfe0cd867b1a9baabb0 Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Wed, 11 May 2022 14:07:18 +0200 Subject: [PATCH 17/24] refactor: always output settings --- modules/sratools/ncbisettings/main.nf | 4 ++-- modules/sratools/ncbisettings/meta.yml | 4 ++-- .../templates/detect_ncbi_settings.sh | 6 ++++++ tests/modules/sratools/ncbisettings/main.nf | 5 ----- .../sratools/ncbisettings/nextflow.config | 12 ------------ .../sratools/ncbisettings/nextflow_mount.config | 17 +++++++++++++++++ tests/modules/sratools/ncbisettings/test.yml | 6 +++--- 7 files changed, 30 insertions(+), 24 deletions(-) create mode 100644 tests/modules/sratools/ncbisettings/nextflow_mount.config diff --git a/modules/sratools/ncbisettings/main.nf b/modules/sratools/ncbisettings/main.nf index 9d905f8b..f3015c74 100644 --- a/modules/sratools/ncbisettings/main.nf +++ b/modules/sratools/ncbisettings/main.nf @@ -8,8 +8,8 @@ process SRATOOLS_NCBISETTINGS { 'quay.io/biocontainers/sra-tools:2.11.0--pl5321ha49a11a_3' }" output: - path('user-settings.mkfg'), optional: true, emit: ncbi_settings - path 'versions.yml' , emit: versions + path('*.mkfg') , emit: ncbi_settings + path 'versions.yml', emit: versions when: task.ext.when == null || task.ext.when diff --git a/modules/sratools/ncbisettings/meta.yml b/modules/sratools/ncbisettings/meta.yml index 29bcfe34..6043ece4 100644 --- a/modules/sratools/ncbisettings/meta.yml +++ b/modules/sratools/ncbisettings/meta.yml @@ -21,8 +21,8 @@ output: pattern: "versions.yml" - ncbi_settings: type: file - description: An optional, minimal NCBI settings file. - pattern: "user-settings.mkfg" + description: An NCBI user settings file. + pattern: "*.mkfg" authors: - "@Midnighter" diff --git a/modules/sratools/ncbisettings/templates/detect_ncbi_settings.sh b/modules/sratools/ncbisettings/templates/detect_ncbi_settings.sh index b1b51c1f..cfe3a324 100644 --- a/modules/sratools/ncbisettings/templates/detect_ncbi_settings.sh +++ b/modules/sratools/ncbisettings/templates/detect_ncbi_settings.sh @@ -31,6 +31,12 @@ else echo "$(printf '!{config}')" >&2 exit 1 fi + if [[ "${NCBI_SETTINGS}" != *.mkfg ]]; then + echo "The detected settings '${NCBI_SETTINGS}' do not have the required"\ + "file extension '.mkfg'." >&2 + exit 1 + fi + cp "${NCBI_SETTINGS}" ./ fi cat <<-END_VERSIONS > versions.yml diff --git a/tests/modules/sratools/ncbisettings/main.nf b/tests/modules/sratools/ncbisettings/main.nf index 08968bb9..e52c993e 100644 --- a/tests/modules/sratools/ncbisettings/main.nf +++ b/tests/modules/sratools/ncbisettings/main.nf @@ -37,10 +37,5 @@ workflow test_sratools_ncbisettings_with_bad_existing { } workflow test_sratools_ncbisettings_with_nonexisting { - - file(params.settings_path).mkdirs() - def settings = file(params.settings_file) - settings.delete() - SRATOOLS_NCBISETTINGS() } diff --git a/tests/modules/sratools/ncbisettings/nextflow.config b/tests/modules/sratools/ncbisettings/nextflow.config index 823082c0..8730f1c4 100644 --- a/tests/modules/sratools/ncbisettings/nextflow.config +++ b/tests/modules/sratools/ncbisettings/nextflow.config @@ -1,17 +1,5 @@ -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_NCBISETTINGS { - containerOptions = { - (workflow.containerEngine == 'singularity') ? - "-B ${params.settings_path}:${params.settings_path}" : - "-v ${params.settings_path}:${params.settings_path}" - } - } } diff --git a/tests/modules/sratools/ncbisettings/nextflow_mount.config b/tests/modules/sratools/ncbisettings/nextflow_mount.config new file mode 100644 index 00000000..823082c0 --- /dev/null +++ b/tests/modules/sratools/ncbisettings/nextflow_mount.config @@ -0,0 +1,17 @@ +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_NCBISETTINGS { + containerOptions = { + (workflow.containerEngine == 'singularity') ? + "-B ${params.settings_path}:${params.settings_path}" : + "-v ${params.settings_path}:${params.settings_path}" + } + } +} diff --git a/tests/modules/sratools/ncbisettings/test.yml b/tests/modules/sratools/ncbisettings/test.yml index 07c45dc7..891ebb58 100644 --- a/tests/modules/sratools/ncbisettings/test.yml +++ b/tests/modules/sratools/ncbisettings/test.yml @@ -1,17 +1,17 @@ - name: "sratools ncbisettings test_sratools_ncbisettings_with_good_existing" - command: nextflow run ./tests/modules/sratools/ncbisettings -entry test_sratools_ncbisettings_with_good_existing -c ./tests/config/nextflow.config -c ./tests/modules/sratools/ncbisettings/nextflow.config + command: nextflow run ./tests/modules/sratools/ncbisettings -entry test_sratools_ncbisettings_with_good_existing -c ./tests/config/nextflow.config -c ./tests/modules/sratools/ncbisettings/nextflow_mount.config tags: - "sratools" - "sratools/ncbisettings" files: - path: "output/sratools/user-settings.mkfg" - should_exist: false + md5sum: 955e27aff2c277c2f1f0943a098888c1 - path: output/sratools/versions.yml contains: - "sratools: 2.11.0" - name: "sratools ncbisettings test_sratools_ncbisettings_with_bad_existing" - command: nextflow run ./tests/modules/sratools/ncbisettings -entry test_sratools_ncbisettings_with_bad_existing -c ./tests/config/nextflow.config -c ./tests/modules/sratools/ncbisettings/nextflow.config + command: nextflow run ./tests/modules/sratools/ncbisettings -entry test_sratools_ncbisettings_with_bad_existing -c ./tests/config/nextflow.config -c ./tests/modules/sratools/ncbisettings/nextflow_mount.config tags: - "sratools" - "sratools/ncbisettings" From a83dd33a7ef63a362786c3943bb02d3cc43eb8d3 Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Wed, 11 May 2022 14:13:50 +0200 Subject: [PATCH 18/24] tests: use remove settings file --- tests/modules/sratools/ncbisettings/main.nf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/modules/sratools/ncbisettings/main.nf b/tests/modules/sratools/ncbisettings/main.nf index e52c993e..f4d1fcfd 100644 --- a/tests/modules/sratools/ncbisettings/main.nf +++ b/tests/modules/sratools/ncbisettings/main.nf @@ -7,8 +7,8 @@ include { SRATOOLS_NCBISETTINGS } from '../../../../modules/sratools/ncbisetting workflow test_sratools_ncbisettings_with_good_existing { 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" + def settings = file(params.test_data['generic']['config']['ncbi_user_settings'], checkIfExists: true) + settings.copyTo(params.settings_file) SRATOOLS_NCBISETTINGS() } From 23091aabdaa8815ed86e57e7aa40dd4a44593745 Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Wed, 11 May 2022 17:07:59 +0200 Subject: [PATCH 19/24] refactor: move files to custom section --- modules/{sratools => custom}/ncbisettings/main.nf | 0 modules/{sratools => custom}/ncbisettings/meta.yml | 0 .../ncbisettings/templates/detect_ncbi_settings.sh | 0 tests/modules/{sratools => custom}/ncbisettings/main.nf | 0 tests/modules/{sratools => custom}/ncbisettings/nextflow.config | 0 .../{sratools => custom}/ncbisettings/nextflow_mount.config | 0 tests/modules/{sratools => custom}/ncbisettings/test.yml | 0 7 files changed, 0 insertions(+), 0 deletions(-) rename modules/{sratools => custom}/ncbisettings/main.nf (100%) rename modules/{sratools => custom}/ncbisettings/meta.yml (100%) rename modules/{sratools => custom}/ncbisettings/templates/detect_ncbi_settings.sh (100%) rename tests/modules/{sratools => custom}/ncbisettings/main.nf (100%) rename tests/modules/{sratools => custom}/ncbisettings/nextflow.config (100%) rename tests/modules/{sratools => custom}/ncbisettings/nextflow_mount.config (100%) rename tests/modules/{sratools => custom}/ncbisettings/test.yml (100%) diff --git a/modules/sratools/ncbisettings/main.nf b/modules/custom/ncbisettings/main.nf similarity index 100% rename from modules/sratools/ncbisettings/main.nf rename to modules/custom/ncbisettings/main.nf diff --git a/modules/sratools/ncbisettings/meta.yml b/modules/custom/ncbisettings/meta.yml similarity index 100% rename from modules/sratools/ncbisettings/meta.yml rename to modules/custom/ncbisettings/meta.yml diff --git a/modules/sratools/ncbisettings/templates/detect_ncbi_settings.sh b/modules/custom/ncbisettings/templates/detect_ncbi_settings.sh similarity index 100% rename from modules/sratools/ncbisettings/templates/detect_ncbi_settings.sh rename to modules/custom/ncbisettings/templates/detect_ncbi_settings.sh diff --git a/tests/modules/sratools/ncbisettings/main.nf b/tests/modules/custom/ncbisettings/main.nf similarity index 100% rename from tests/modules/sratools/ncbisettings/main.nf rename to tests/modules/custom/ncbisettings/main.nf diff --git a/tests/modules/sratools/ncbisettings/nextflow.config b/tests/modules/custom/ncbisettings/nextflow.config similarity index 100% rename from tests/modules/sratools/ncbisettings/nextflow.config rename to tests/modules/custom/ncbisettings/nextflow.config diff --git a/tests/modules/sratools/ncbisettings/nextflow_mount.config b/tests/modules/custom/ncbisettings/nextflow_mount.config similarity index 100% rename from tests/modules/sratools/ncbisettings/nextflow_mount.config rename to tests/modules/custom/ncbisettings/nextflow_mount.config diff --git a/tests/modules/sratools/ncbisettings/test.yml b/tests/modules/custom/ncbisettings/test.yml similarity index 100% rename from tests/modules/sratools/ncbisettings/test.yml rename to tests/modules/custom/ncbisettings/test.yml From b2dbaa99309a2057efc32ef9d029ed91140068df Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Wed, 11 May 2022 17:32:50 +0200 Subject: [PATCH 20/24] refactor: rename module --- .../main.nf | 2 +- .../meta.yml | 2 +- .../templates/detect_ncbi_settings.sh | 0 tests/config/pytest_modules.yml | 8 ++-- tests/modules/custom/ncbisettings/test.yml | 44 ------------------- .../main.nf | 14 +++--- .../nextflow.config | 0 .../nextflow_mount.config | 2 +- .../custom/sratoolsncbisettings/test.yml | 44 +++++++++++++++++++ 9 files changed, 58 insertions(+), 58 deletions(-) rename modules/custom/{ncbisettings => sratoolsncbisettings}/main.nf (94%) rename modules/custom/{ncbisettings => sratoolsncbisettings}/meta.yml (95%) rename modules/custom/{ncbisettings => sratoolsncbisettings}/templates/detect_ncbi_settings.sh (100%) delete mode 100644 tests/modules/custom/ncbisettings/test.yml rename tests/modules/custom/{ncbisettings => sratoolsncbisettings}/main.nf (75%) rename tests/modules/custom/{ncbisettings => sratoolsncbisettings}/nextflow.config (100%) rename tests/modules/custom/{ncbisettings => sratoolsncbisettings}/nextflow_mount.config (91%) create mode 100644 tests/modules/custom/sratoolsncbisettings/test.yml diff --git a/modules/custom/ncbisettings/main.nf b/modules/custom/sratoolsncbisettings/main.nf similarity index 94% rename from modules/custom/ncbisettings/main.nf rename to modules/custom/sratoolsncbisettings/main.nf index f3015c74..21bf3005 100644 --- a/modules/custom/ncbisettings/main.nf +++ b/modules/custom/sratoolsncbisettings/main.nf @@ -1,4 +1,4 @@ -process SRATOOLS_NCBISETTINGS { +process CUSTOM_SRATOOLSNCBISETTINGS { tag 'ncbi-settings' label 'process_low' diff --git a/modules/custom/ncbisettings/meta.yml b/modules/custom/sratoolsncbisettings/meta.yml similarity index 95% rename from modules/custom/ncbisettings/meta.yml rename to modules/custom/sratoolsncbisettings/meta.yml index 6043ece4..01e98856 100644 --- a/modules/custom/ncbisettings/meta.yml +++ b/modules/custom/sratoolsncbisettings/meta.yml @@ -1,4 +1,4 @@ -name: "sratools_ncbisettings" +name: "sratoolsncbisettings" description: Test for the presence of suitable NCBI settings or create them on the fly. keywords: - NCBI diff --git a/modules/custom/ncbisettings/templates/detect_ncbi_settings.sh b/modules/custom/sratoolsncbisettings/templates/detect_ncbi_settings.sh similarity index 100% rename from modules/custom/ncbisettings/templates/detect_ncbi_settings.sh rename to modules/custom/sratoolsncbisettings/templates/detect_ncbi_settings.sh diff --git a/tests/config/pytest_modules.yml b/tests/config/pytest_modules.yml index 4a922a4d..428c3652 100644 --- a/tests/config/pytest_modules.yml +++ b/tests/config/pytest_modules.yml @@ -495,6 +495,10 @@ custom/getchromsizes: - modules/custom/getchromsizes/** - tests/modules/custom/getchromsizes/** +custom/sratoolsncbisettings: + - modules/custom/sratoolsncbisettings/** + - tests/modules/custom/sratoolsncbisettings/** + cutadapt: - modules/cutadapt/** - tests/modules/cutadapt/** @@ -1819,10 +1823,6 @@ sratools/fasterqdump: - modules/sratools/fasterqdump/** - tests/modules/sratools/fasterqdump/** -sratools/ncbisettings: - - modules/sratools/ncbisettings/** - - tests/modules/sratools/ncbisettings/** - sratools/prefetch: - modules/sratools/prefetch/** - tests/modules/sratools/prefetch/** diff --git a/tests/modules/custom/ncbisettings/test.yml b/tests/modules/custom/ncbisettings/test.yml deleted file mode 100644 index 891ebb58..00000000 --- a/tests/modules/custom/ncbisettings/test.yml +++ /dev/null @@ -1,44 +0,0 @@ -- name: "sratools ncbisettings test_sratools_ncbisettings_with_good_existing" - command: nextflow run ./tests/modules/sratools/ncbisettings -entry test_sratools_ncbisettings_with_good_existing -c ./tests/config/nextflow.config -c ./tests/modules/sratools/ncbisettings/nextflow_mount.config - tags: - - "sratools" - - "sratools/ncbisettings" - files: - - path: "output/sratools/user-settings.mkfg" - md5sum: 955e27aff2c277c2f1f0943a098888c1 - - path: output/sratools/versions.yml - contains: - - "sratools: 2.11.0" - -- name: "sratools ncbisettings test_sratools_ncbisettings_with_bad_existing" - command: nextflow run ./tests/modules/sratools/ncbisettings -entry test_sratools_ncbisettings_with_bad_existing -c ./tests/config/nextflow.config -c ./tests/modules/sratools/ncbisettings/nextflow_mount.config - tags: - - "sratools" - - "sratools/ncbisettings" - exit_code: 1 - stdout: - contains: - - "Command error:" - - "missing the required entries" - - "/LIBS/GUID" - - "/libs/cloud/report_instance_identity" - - "Feel free to add the following" - files: - - path: "output/sratools/user-settings.mkfg" - should_exist: false - - path: output/sratools/versions.yml - should_exist: false - -- name: "sratools ncbisettings test_sratools_ncbisettings_with_nonexisting" - command: nextflow run ./tests/modules/sratools/ncbisettings -entry test_sratools_ncbisettings_with_nonexisting -c ./tests/config/nextflow.config -c ./tests/modules/sratools/ncbisettings/nextflow.config - tags: - - "sratools" - - "sratools/ncbisettings" - files: - - path: "output/sratools/user-settings.mkfg" - contains: - - "/LIBS/GUID" - - "/libs/cloud/report_instance_identity" - - path: output/sratools/versions.yml - contains: - - "sratools: 2.11.0" diff --git a/tests/modules/custom/ncbisettings/main.nf b/tests/modules/custom/sratoolsncbisettings/main.nf similarity index 75% rename from tests/modules/custom/ncbisettings/main.nf rename to tests/modules/custom/sratoolsncbisettings/main.nf index f4d1fcfd..be316a39 100644 --- a/tests/modules/custom/ncbisettings/main.nf +++ b/tests/modules/custom/sratoolsncbisettings/main.nf @@ -2,18 +2,18 @@ nextflow.enable.dsl = 2 -include { SRATOOLS_NCBISETTINGS } from '../../../../modules/sratools/ncbisettings/main.nf' +include { CUSTOM_SRATOOLSNCBISETTINGS } from '../../../../modules/custom/sratoolsncbisettings/main.nf' -workflow test_sratools_ncbisettings_with_good_existing { +workflow test_sratoolsncbisettings_with_good_existing { file(params.settings_path).mkdirs() def settings = file(params.test_data['generic']['config']['ncbi_user_settings'], checkIfExists: true) settings.copyTo(params.settings_file) - SRATOOLS_NCBISETTINGS() + CUSTOM_SRATOOLSNCBISETTINGS() } -workflow test_sratools_ncbisettings_with_bad_existing { +workflow test_sratoolsncbisettings_with_bad_existing { file(params.settings_path).mkdirs() def settings = file(params.settings_file) @@ -33,9 +33,9 @@ workflow test_sratools_ncbisettings_with_bad_existing { /repository/user/default-path = "/root/ncbi" '''.stripIndent() - SRATOOLS_NCBISETTINGS() + CUSTOM_SRATOOLSNCBISETTINGS() } -workflow test_sratools_ncbisettings_with_nonexisting { - SRATOOLS_NCBISETTINGS() +workflow test_sratoolsncbisettings_with_nonexisting { + CUSTOM_SRATOOLSNCBISETTINGS() } diff --git a/tests/modules/custom/ncbisettings/nextflow.config b/tests/modules/custom/sratoolsncbisettings/nextflow.config similarity index 100% rename from tests/modules/custom/ncbisettings/nextflow.config rename to tests/modules/custom/sratoolsncbisettings/nextflow.config diff --git a/tests/modules/custom/ncbisettings/nextflow_mount.config b/tests/modules/custom/sratoolsncbisettings/nextflow_mount.config similarity index 91% rename from tests/modules/custom/ncbisettings/nextflow_mount.config rename to tests/modules/custom/sratoolsncbisettings/nextflow_mount.config index 823082c0..853844c5 100644 --- a/tests/modules/custom/ncbisettings/nextflow_mount.config +++ b/tests/modules/custom/sratoolsncbisettings/nextflow_mount.config @@ -7,7 +7,7 @@ process { publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } - withName: SRATOOLS_NCBISETTINGS { + withName: CUSTOM_SRATOOLSNCBISETTINGS { containerOptions = { (workflow.containerEngine == 'singularity') ? "-B ${params.settings_path}:${params.settings_path}" : diff --git a/tests/modules/custom/sratoolsncbisettings/test.yml b/tests/modules/custom/sratoolsncbisettings/test.yml new file mode 100644 index 00000000..df3cd936 --- /dev/null +++ b/tests/modules/custom/sratoolsncbisettings/test.yml @@ -0,0 +1,44 @@ +- name: "custom sratoolsncbisettings test_sratoolsncbisettings_with_good_existing" + command: nextflow run ./tests/modules/custom/sratoolsncbisettings -entry test_sratoolsncbisettings_with_good_existing -c ./tests/config/nextflow.config -c ./tests/modules/custom/sratoolsncbisettings/nextflow_mount.config + tags: + - "custom" + - "custom/sratoolsncbisettings" + files: + - path: "output/custom/user-settings.mkfg" + md5sum: 955e27aff2c277c2f1f0943a098888c1 + - path: output/custom/versions.yml + contains: + - "sratools: 2.11.0" + +- name: "custom sratoolsncbisettings test_sratoolsncbisettings_with_bad_existing" + command: nextflow run ./tests/modules/custom/sratoolsncbisettings -entry test_sratoolsncbisettings_with_bad_existing -c ./tests/config/nextflow.config -c ./tests/modules/custom/sratoolsncbisettings/nextflow_mount.config + tags: + - "custom" + - "custom/sratoolsncbisettings" + exit_code: 1 + stdout: + contains: + - "Command error:" + - "missing the required entries" + - "/LIBS/GUID" + - "/libs/cloud/report_instance_identity" + - "Feel free to add the following" + files: + - path: "output/custom/user-settings.mkfg" + should_exist: false + - path: output/custom/versions.yml + should_exist: false + +- name: "custom sratoolsncbisettings test_sratoolsncbisettings_with_nonexisting" + command: nextflow run ./tests/modules/custom/sratoolsncbisettings -entry test_sratoolsncbisettings_with_nonexisting -c ./tests/config/nextflow.config -c ./tests/modules/custom/sratoolsncbisettings/nextflow.config + tags: + - "custom" + - "custom/sratoolsncbisettings" + files: + - path: "output/custom/user-settings.mkfg" + contains: + - "/LIBS/GUID" + - "/libs/cloud/report_instance_identity" + - path: output/custom/versions.yml + contains: + - "sratools: 2.11.0" From 888620063bb67a1645b54de1dba022a409f9a44f Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Wed, 11 May 2022 17:44:49 +0200 Subject: [PATCH 21/24] tests: delete settings for conda --- tests/modules/custom/sratoolsncbisettings/main.nf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/modules/custom/sratoolsncbisettings/main.nf b/tests/modules/custom/sratoolsncbisettings/main.nf index be316a39..9f49f20e 100644 --- a/tests/modules/custom/sratoolsncbisettings/main.nf +++ b/tests/modules/custom/sratoolsncbisettings/main.nf @@ -37,5 +37,8 @@ workflow test_sratoolsncbisettings_with_bad_existing { } workflow test_sratoolsncbisettings_with_nonexisting { + def settings = file(params.settings_file) + settings.delete() + CUSTOM_SRATOOLSNCBISETTINGS() } From 98d8a741ec574823a799e9c375ec2c62da654cf5 Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Wed, 11 May 2022 18:17:27 +0200 Subject: [PATCH 22/24] tests: add missing paths to config --- tests/modules/custom/sratoolsncbisettings/nextflow.config | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/modules/custom/sratoolsncbisettings/nextflow.config b/tests/modules/custom/sratoolsncbisettings/nextflow.config index 8730f1c4..a6c70bd3 100644 --- a/tests/modules/custom/sratoolsncbisettings/nextflow.config +++ b/tests/modules/custom/sratoolsncbisettings/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()}" } From 74b11ccc4431caf5bc2daffb52629799927fee86 Mon Sep 17 00:00:00 2001 From: "Moritz E. Beber" Date: Wed, 11 May 2022 19:21:32 +0200 Subject: [PATCH 23/24] refactor: rename and update subworkflow --- subworkflows/nf-core/sra_fastq/main.nf | 34 ----------------- subworkflows/nf-core/srafastq/main.nf | 38 +++++++++++++++++++ .../nf-core/{sra_fastq => srafastq}/meta.yml | 7 +++- .../{sra_fastq => srafastq}/nextflow.config | 0 tests/subworkflows/nf-core/sra_fastq/main.nf | 23 ----------- tests/subworkflows/nf-core/sra_fastq/test.yml | 27 ------------- tests/subworkflows/nf-core/srafastq/main.nf | 29 ++++++++++++++ .../nf-core/srafastq/nextflow.config | 5 +++ tests/subworkflows/nf-core/srafastq/test.yml | 29 ++++++++++++++ 9 files changed, 106 insertions(+), 86 deletions(-) delete mode 100644 subworkflows/nf-core/sra_fastq/main.nf create mode 100644 subworkflows/nf-core/srafastq/main.nf rename subworkflows/nf-core/{sra_fastq => srafastq}/meta.yml (90%) rename subworkflows/nf-core/{sra_fastq => srafastq}/nextflow.config (100%) delete mode 100644 tests/subworkflows/nf-core/sra_fastq/main.nf delete mode 100644 tests/subworkflows/nf-core/sra_fastq/test.yml create mode 100644 tests/subworkflows/nf-core/srafastq/main.nf create mode 100644 tests/subworkflows/nf-core/srafastq/nextflow.config create mode 100644 tests/subworkflows/nf-core/srafastq/test.yml diff --git a/subworkflows/nf-core/sra_fastq/main.nf b/subworkflows/nf-core/sra_fastq/main.nf deleted file mode 100644 index ffa380d9..00000000 --- a/subworkflows/nf-core/sra_fastq/main.nf +++ /dev/null @@ -1,34 +0,0 @@ -// -// Download FASTQ sequencing reads from the NCBI's Sequence Read Archive (SRA). -// - -params.prefetch_options = [:] -params.fasterqdump_options = [:] - -include { SRATOOLS_PREFETCH } from '../../../modules/sratools/prefetch/main' addParams( options: params.prefetch_options ) -include { SRATOOLS_FASTERQDUMP } from '../../../modules/sratools/fasterqdump/main' addParams( options: params.fasterqdump_options ) - -workflow SRA_FASTQ { - take: - sra_ids // channel: [ val(meta), val(id) ] - - main: - - ch_versions = Channel.empty() - - // - // Prefetch sequencing reads in SRA format. - // - SRATOOLS_PREFETCH ( sra_ids ) - ch_versions = ch_versions.mix( SRATOOLS_PREFETCH.out.versions.first() ) - - // - // Convert the SRA format into one or more compressed FASTQ files. - // - SRATOOLS_FASTERQDUMP ( SRATOOLS_PREFETCH.out.sra ) - ch_versions = ch_versions.mix( SRATOOLS_FASTERQDUMP.out.versions.first() ) - - emit: - reads = SRATOOLS_FASTERQDUMP.out.reads // channel: [ val(meta), [ reads ] ] - versions = ch_versions // channel: [ versions.yml ] -} diff --git a/subworkflows/nf-core/srafastq/main.nf b/subworkflows/nf-core/srafastq/main.nf new file mode 100644 index 00000000..26e8105e --- /dev/null +++ b/subworkflows/nf-core/srafastq/main.nf @@ -0,0 +1,38 @@ +include { CUSTOM_SRATOOLSNCBISETTINGS } from '../../../modules/custom/sratoolsncbisettings/main' +include { SRATOOLS_PREFETCH } from '../../../modules/sratools/prefetch/main' +include { SRATOOLS_FASTERQDUMP } from '../../../modules/sratools/fasterqdump/main' + +/** + * Download FASTQ sequencing reads from the NCBI's Sequence Read Archive (SRA). + */ +workflow SRAFASTQ { + take: + sra_ids // channel: [ val(meta), val(id) ] + + main: + + ch_versions = Channel.empty() + + // + // Detect existing NCBI user settings or create new ones. + // + CUSTOM_SRATOOLSNCBISETTINGS() + def settings = CUSTOM_SRATOOLSNCBISETTINGS.out.ncbi_settings + ch_versions = ch_versions.mix( CUSTOM_SRATOOLSNCBISETTINGS.out.versions ) + + // + // Prefetch sequencing reads in SRA format. + // + SRATOOLS_PREFETCH ( sra_ids, settings ) + ch_versions = ch_versions.mix( SRATOOLS_PREFETCH.out.versions.first() ) + + // + // Convert the SRA format into one or more compressed FASTQ files. + // + SRATOOLS_FASTERQDUMP ( SRATOOLS_PREFETCH.out.sra, settings ) + ch_versions = ch_versions.mix( SRATOOLS_FASTERQDUMP.out.versions.first() ) + + emit: + reads = SRATOOLS_FASTERQDUMP.out.reads // channel: [ val(meta), [ reads ] ] + versions = ch_versions // channel: [ versions.yml ] +} diff --git a/subworkflows/nf-core/sra_fastq/meta.yml b/subworkflows/nf-core/srafastq/meta.yml similarity index 90% rename from subworkflows/nf-core/sra_fastq/meta.yml rename to subworkflows/nf-core/srafastq/meta.yml index 5114bce5..873ccaca 100644 --- a/subworkflows/nf-core/sra_fastq/meta.yml +++ b/subworkflows/nf-core/srafastq/meta.yml @@ -1,11 +1,14 @@ name: sra_fastq description: Download FASTQ sequencing reads from the NCBI's Sequence Read Archive (SRA). keywords: + - SRA + - NCBI - sequencing - FASTQ - prefetch - - dump + - fasterq-dump modules: + - custom/sratoolsncbisettings - sratools/prefetch - sratools/fasterqdump input: @@ -17,7 +20,7 @@ input: - id: type: string description: > - SRA identifier. + SRA run identifier. # TODO Update when we decide on a standard for subworkflow docs output: - meta: diff --git a/subworkflows/nf-core/sra_fastq/nextflow.config b/subworkflows/nf-core/srafastq/nextflow.config similarity index 100% rename from subworkflows/nf-core/sra_fastq/nextflow.config rename to subworkflows/nf-core/srafastq/nextflow.config diff --git a/tests/subworkflows/nf-core/sra_fastq/main.nf b/tests/subworkflows/nf-core/sra_fastq/main.nf deleted file mode 100644 index 988758f3..00000000 --- a/tests/subworkflows/nf-core/sra_fastq/main.nf +++ /dev/null @@ -1,23 +0,0 @@ -#!/usr/bin/env nextflow - -nextflow.enable.dsl = 2 - -include { SRA_FASTQ } from '../../../../subworkflows/nf-core/sra_fastq/main.nf' addParams( [:] ) - -workflow test_sra_fastq_single_end { - input = [ - [ id:'test_single_end', single_end:true ], // meta map - 'SRR13255544' - ] - - SRA_FASTQ ( input ) -} - -workflow test_sra_fastq_paired_end { - input = [ - [ id:'test_paired_end', single_end:false ], // meta map - 'SRR11140744' - ] - - SRA_FASTQ ( input ) -} diff --git a/tests/subworkflows/nf-core/sra_fastq/test.yml b/tests/subworkflows/nf-core/sra_fastq/test.yml deleted file mode 100644 index 4b75431f..00000000 --- a/tests/subworkflows/nf-core/sra_fastq/test.yml +++ /dev/null @@ -1,27 +0,0 @@ -- name: sra fastq single-end - command: nextflow run ./tests/subworkflows/nf-core/sra_fastq -entry test_sra_fastq_single_end -c tests/config/nextflow.config - tags: - - subworkflows - # - subworkflows/sra_fastq - # Modules - # - sratools - # - sratools/prefetch - # - sratools/fasterqdump - files: - - path: output/sratools/SRR13255544.fastq.gz - md5sum: 1054c7b71884acdb5eed8a378f18be82 - -- name: sra fastq paired-end - command: nextflow run ./tests/subworkflows/nf-core/sra_fastq -entry test_sra_fastq_paired_end -c tests/config/nextflow.config - tags: - - subworkflows - # - subworkflows/sra_fastq - # Modules - # - sratools - # - sratools/prefetch - # - sratools/fasterqdump - files: - - path: output/sratools/SRR11140744_1.fastq.gz - md5sum: 193809c784a4ea132ab2a253fa4f55b6 - - path: output/sratools/SRR11140744_2.fastq.gz - md5sum: 3e3b3af3413f50a1685fd7b3f1456d4e diff --git a/tests/subworkflows/nf-core/srafastq/main.nf b/tests/subworkflows/nf-core/srafastq/main.nf new file mode 100644 index 00000000..82c8f29d --- /dev/null +++ b/tests/subworkflows/nf-core/srafastq/main.nf @@ -0,0 +1,29 @@ +#!/usr/bin/env nextflow + +nextflow.enable.dsl = 2 + +include { SRAFASTQ } from '../../../../subworkflows/nf-core/srafastq/main.nf' + +workflow test_srafastq_single_end { + input = Channel.of( + [ + [ id:'test_single_end1', single_end:true ], // meta map + 'DRR000774' + ], + [ + [ id:'test_single_end2', single_end:true ], // meta map + 'DRR000775' + ] + ) + + SRAFASTQ ( input ) +} + +workflow test_srafastq_paired_end { + input = [ + [ id:'test_paired_end', single_end:false ], // meta map + 'SRR11140744' + ] + + SRAFASTQ ( input ) +} diff --git a/tests/subworkflows/nf-core/srafastq/nextflow.config b/tests/subworkflows/nf-core/srafastq/nextflow.config new file mode 100644 index 00000000..8730f1c4 --- /dev/null +++ b/tests/subworkflows/nf-core/srafastq/nextflow.config @@ -0,0 +1,5 @@ +process { + + publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } + +} diff --git a/tests/subworkflows/nf-core/srafastq/test.yml b/tests/subworkflows/nf-core/srafastq/test.yml new file mode 100644 index 00000000..73424171 --- /dev/null +++ b/tests/subworkflows/nf-core/srafastq/test.yml @@ -0,0 +1,29 @@ +- name: srafastq single-end + command: nextflow run ./tests/subworkflows/nf-core/srafastq -entry test_srafastq_single_end -c tests/config/nextflow.config -c tests/subworkflows/nf-core/srafastq/nextflow.config + tags: + - subworkflows + # - subworkflows/srafastq + # Modules + # - sratools + # - sratools/prefetch + # - sratools/fasterqdump + files: + - path: output/sratools/DRR000774.fastq.gz + md5sum: 19029a1132115b55277a0d79ee089b49 + - path: output/sratools/DRR000775.fastq.gz + md5sum: 59ff24c86ecb260752668c059c2a1eaf + +- name: srafastq paired-end + command: nextflow run ./tests/subworkflows/nf-core/srafastq -entry test_srafastq_paired_end -c tests/config/nextflow.config -c tests/subworkflows/nf-core/srafastq/nextflow.config + tags: + - subworkflows + # - subworkflows/srafastq + # Modules + # - sratools + # - sratools/prefetch + # - sratools/fasterqdump + files: + - path: output/sratools/SRR11140744_1.fastq.gz + md5sum: 193809c784a4ea132ab2a253fa4f55b6 + - path: output/sratools/SRR11140744_2.fastq.gz + md5sum: 3e3b3af3413f50a1685fd7b3f1456d4e From 6fa1c8089afe83e612dbc14e4b85f277166c4a2b Mon Sep 17 00:00:00 2001 From: Nicolas Vannieuwkerke Date: Fri, 13 May 2022 10:03:20 +0200 Subject: [PATCH 24/24] Added memory allocation to VCFeval --- modules/rtgtools/vcfeval/main.nf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/rtgtools/vcfeval/main.nf b/modules/rtgtools/vcfeval/main.nf index 1bad4231..27a488f7 100644 --- a/modules/rtgtools/vcfeval/main.nf +++ b/modules/rtgtools/vcfeval/main.nf @@ -35,12 +35,13 @@ process RTGTOOLS_VCFEVAL { def eval_regions = evaluation_regions ? "--evaluation-regions=$evaluation_regions" : "" def truth_index = truth_vcf_tbi ? "" : "rtg index $truth_vcf" def query_index = query_vcf_tbi ? "" : "rtg index $query_vcf" + def avail_mem = task.memory.toGiga() + "G" """ $truth_index $query_index - rtg vcfeval \\ + rtg RTG_MEM=$avail_mem vcfeval \\ $args \\ --baseline=$truth_vcf \\ $bed_regions \\