diff --git a/modules/sratools/prefetch/main.nf b/modules/sratools/prefetch/main.nf index 3408c3e9..3426ae12 100644 --- a/modules/sratools/prefetch/main.nf +++ b/modules/sratools/prefetch/main.nf @@ -9,10 +9,11 @@ process SRATOOLS_PREFETCH { input: tuple val(meta), val(id) + path ncbi_settings output: tuple val(meta), path(id), emit: sra - path "versions.yml" , emit: versions + path 'versions.yml' , emit: versions when: task.ext.when == null || task.ext.when @@ -20,7 +21,5 @@ process SRATOOLS_PREFETCH { shell: args = task.ext.args ?: '' args2 = task.ext.args2 ?: '5 1 100' // - config = "/LIBS/GUID = \"${UUID.randomUUID().toString()}\"\\n/libs/cloud/report_instance_identity = \"true\"\\n" - template 'retry_with_backoff.sh' } diff --git a/modules/sratools/prefetch/meta.yml b/modules/sratools/prefetch/meta.yml index e08b708c..a3a26522 100644 --- a/modules/sratools/prefetch/meta.yml +++ b/modules/sratools/prefetch/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,11 @@ input: type: val description: > A string denoting an SRA id. + - ncbi_settings: + type: file + description: > + An NCBI user settings file. + pattern: "*.mkfg" output: - meta: diff --git a/modules/sratools/prefetch/templates/retry_with_backoff.sh b/modules/sratools/prefetch/templates/retry_with_backoff.sh index fbcb6532..cec0ab43 100755 --- a/modules/sratools/prefetch/templates/retry_with_backoff.sh +++ b/modules/sratools/prefetch/templates/retry_with_backoff.sh @@ -40,11 +40,7 @@ retry_with_backoff() { echo "${output}" } -eval "$(vdb-config -o n NCBI_SETTINGS | sed 's/[" ]//g')" -if [[ ! -f "${NCBI_SETTINGS}" ]]; then - mkdir -p "$(dirname "${NCBI_SETTINGS}")" - printf '!{config}' > "${NCBI_SETTINGS}" -fi +export NCBI_SETTINGS="$PWD/!{ncbi_settings}" retry_with_backoff !{args2} \ prefetch \ diff --git a/tests/config/test_data.config b/tests/config/test_data.config index 506996b1..63c3ac16 100644 --- a/tests/config/test_data.config +++ b/tests/config/test_data.config @@ -426,6 +426,9 @@ params { test_merge_cool_cp2 = "${test_data_dir}/genomics/homo_sapiens/cooler/merge/toy/toy.symm.upper.2.cp2.cool" } + 'config' { + ncbi_user_settings = "${test_data_dir}/generic/config/ncbi_user_settings.mkfg" + } } } } diff --git a/tests/modules/sratools/prefetch/main.nf b/tests/modules/sratools/prefetch/main.nf index aa6252a1..cf9794ab 100644 --- a/tests/modules/sratools/prefetch/main.nf +++ b/tests/modules/sratools/prefetch/main.nf @@ -8,8 +8,8 @@ workflow test_sratools_prefetch { input = [ [ id:'test', single_end:false ], // meta map - 'ERR2815334' + 'DRR000774' ] - SRATOOLS_PREFETCH ( input ) + SRATOOLS_PREFETCH(input, file(params.test_data['generic']['config']['ncbi_user_settings'], checkIfExists: true)) } diff --git a/tests/modules/sratools/prefetch/test.yml b/tests/modules/sratools/prefetch/test.yml index a2efef77..a6c213f8 100644 --- a/tests/modules/sratools/prefetch/test.yml +++ b/tests/modules/sratools/prefetch/test.yml @@ -4,5 +4,8 @@ - sratools/prefetch - sratools files: - - path: output/sratools/ERR2815334/ERR2815334.sra - md5sum: 9a98c7f6f4774b7ef94aa915b92a54ea + - path: output/sratools/DRR000774/DRR000774.sra + md5sum: 7647dba20c89c0e3d7ad13842f060eb0 + - path: output/sratools/versions.yml + contains: + - "sratools: 2.11.0"