Merge pull request #1631 from nf-core/refactor-prefetch

Refactor prefetch
This commit is contained in:
Harshil Patel 2022-05-11 11:29:02 +01:00 committed by GitHub
commit 79bf60fa11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 19 additions and 13 deletions

View file

@ -9,10 +9,11 @@ process SRATOOLS_PREFETCH {
input: input:
tuple val(meta), val(id) tuple val(meta), val(id)
path ncbi_settings
output: output:
tuple val(meta), path(id), emit: sra tuple val(meta), path(id), emit: sra
path "versions.yml" , emit: versions path 'versions.yml' , emit: versions
when: when:
task.ext.when == null || task.ext.when task.ext.when == null || task.ext.when
@ -20,7 +21,5 @@ process SRATOOLS_PREFETCH {
shell: shell:
args = task.ext.args ?: '' args = task.ext.args ?: ''
args2 = task.ext.args2 ?: '5 1 100' // <num retries> <base delay in seconds> <max delay in seconds> args2 = task.ext.args2 ?: '5 1 100' // <num retries> <base delay in seconds> <max delay in seconds>
config = "/LIBS/GUID = \"${UUID.randomUUID().toString()}\"\\n/libs/cloud/report_instance_identity = \"true\"\\n"
template 'retry_with_backoff.sh' template 'retry_with_backoff.sh'
} }

View file

@ -10,7 +10,7 @@ tools:
homepage: https://github.com/ncbi/sra-tools homepage: https://github.com/ncbi/sra-tools
documentation: https://github.com/ncbi/sra-tools/wiki documentation: https://github.com/ncbi/sra-tools/wiki
tool_dev_url: https://github.com/ncbi/sra-tools tool_dev_url: https://github.com/ncbi/sra-tools
licence: ["US-Government-Work"] licence: ["Public Domain"]
input: input:
- meta: - meta:
@ -22,6 +22,11 @@ input:
type: val type: val
description: > description: >
A string denoting an SRA id. A string denoting an SRA id.
- ncbi_settings:
type: file
description: >
An NCBI user settings file.
pattern: "*.mkfg"
output: output:
- meta: - meta:

View file

@ -40,11 +40,7 @@ retry_with_backoff() {
echo "${output}" echo "${output}"
} }
eval "$(vdb-config -o n NCBI_SETTINGS | sed 's/[" ]//g')" export NCBI_SETTINGS="$PWD/!{ncbi_settings}"
if [[ ! -f "${NCBI_SETTINGS}" ]]; then
mkdir -p "$(dirname "${NCBI_SETTINGS}")"
printf '!{config}' > "${NCBI_SETTINGS}"
fi
retry_with_backoff !{args2} \ retry_with_backoff !{args2} \
prefetch \ prefetch \

View file

@ -426,6 +426,9 @@ params {
test_merge_cool_cp2 = "${test_data_dir}/genomics/homo_sapiens/cooler/merge/toy/toy.symm.upper.2.cp2.cool" 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"
}
} }
} }
} }

View file

@ -8,8 +8,8 @@ workflow test_sratools_prefetch {
input = [ input = [
[ id:'test', single_end:false ], // meta map [ 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))
} }

View file

@ -4,5 +4,8 @@
- sratools/prefetch - sratools/prefetch
- sratools - sratools
files: files:
- path: output/sratools/ERR2815334/ERR2815334.sra - path: output/sratools/DRR000774/DRR000774.sra
md5sum: 9a98c7f6f4774b7ef94aa915b92a54ea md5sum: 7647dba20c89c0e3d7ad13842f060eb0
- path: output/sratools/versions.yml
contains:
- "sratools: 2.11.0"