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:
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' // <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'
}

View file

@ -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:

View file

@ -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 \

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"
}
'config' {
ncbi_user_settings = "${test_data_dir}/generic/config/ncbi_user_settings.mkfg"
}
}
}
}

View file

@ -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))
}

View file

@ -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"