mirror of
https://github.com/MillironX/nf-core_modules.git
synced 2024-12-22 11:08:17 +00:00
07c0830057
* chore: apply module template * refactor: add NCBI settings to options * docs: complete meta information * feat: add prefetch process * fix: correct bash commands * tests: define the right tests * style: move option definition to satisfy linting * fix: extract version correctly * fix: correct newline issues * refactor: address review comments * Apply suggestions from code review * chore: add retrying via nf-core label * refactor: validate download thoroughly * refactor: remove vdb-config input Co-authored-by: Harshil Patel <drpatelh@users.noreply.github.com>
50 lines
1.6 KiB
Text
50 lines
1.6 KiB
Text
// Import generic module functions
|
|
include { initOptions; saveFiles; getSoftwareName; getProcessName } from './functions'
|
|
|
|
params.options = [:]
|
|
options = initOptions(params.options)
|
|
|
|
process SRATOOLS_PREFETCH {
|
|
tag "$id"
|
|
label 'process_low'
|
|
label 'error_retry'
|
|
publishDir "${params.outdir}",
|
|
mode: params.publish_dir_mode,
|
|
saveAs: { filename -> saveFiles(filename:filename, options:params.options, publish_dir:getSoftwareName(task.process), meta:meta, publish_by_meta:['id']) }
|
|
|
|
conda (params.enable_conda ? 'bioconda::sra-tools=2.11.0' : null)
|
|
if (workflow.containerEngine == 'singularity' && !params.singularity_pull_docker_container) {
|
|
container 'https://depot.galaxyproject.org/singularity/sra-tools:2.11.0--pl5262h314213e_0'
|
|
} else {
|
|
container 'quay.io/biocontainers/sra-tools:2.11.0--pl5262h314213e_0'
|
|
}
|
|
|
|
input:
|
|
tuple val(meta), val(id)
|
|
|
|
output:
|
|
tuple val(meta), path("$id"), emit: sra
|
|
path "versions.yml" , emit: versions
|
|
|
|
script:
|
|
def config = "/LIBS/GUID = \"${UUID.randomUUID().toString()}\"\\n/libs/cloud/report_instance_identity = \"true\"\\n"
|
|
"""
|
|
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
|
|
|
|
prefetch \\
|
|
$options.args \\
|
|
--progress \\
|
|
$id
|
|
|
|
vdb-validate $id
|
|
|
|
cat <<-END_VERSIONS > versions.yml
|
|
${getProcessName(task.process)}:
|
|
${getSoftwareName(task.process)}: \$(prefetch --version 2>&1 | grep -Eo '[0-9.]+')
|
|
END_VERSIONS
|
|
"""
|
|
}
|