refactor: require settings input always

This commit is contained in:
Moritz E. Beber 2022-05-10 12:29:42 +02:00
parent a303904eb0
commit 1b228835e9
6 changed files with 7 additions and 61 deletions

View file

@ -25,9 +25,8 @@ input:
- ncbi_settings: - ncbi_settings:
type: file type: file
description: > description: >
Either a proper NCBI settings file or in case an existing file should be used, An NCBI user settings file.
a file with name EXISTS. pattern: "*.mkfg"
pattern: "*.mkfg | EXISTS"
output: output:
- meta: - meta:

View file

@ -40,9 +40,7 @@ retry_with_backoff() {
echo "${output}" echo "${output}"
} }
if [[ "!{ncbi_settings.name}" != "EXISTS" ]]; then
export NCBI_SETTINGS="$PWD/!{ncbi_settings}" export NCBI_SETTINGS="$PWD/!{ncbi_settings}"
fi
retry_with_backoff !{args2} \ retry_with_backoff !{args2} \
prefetch \ prefetch \

View file

@ -4,31 +4,12 @@ nextflow.enable.dsl = 2
include { SRATOOLS_PREFETCH } from '../../../../modules/sratools/prefetch/main.nf' include { SRATOOLS_PREFETCH } from '../../../../modules/sratools/prefetch/main.nf'
workflow test_sratools_prefetch_with_settings_input { workflow test_sratools_prefetch {
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"
input = [ input = [
[ id:'test', single_end:false ], // meta map [ id:'test', single_end:false ], // meta map
'DRR000774' 'DRR000774'
] ]
SRATOOLS_PREFETCH(input, settings) SRATOOLS_PREFETCH(input, file(params.test_data['generic']['config']['ncbi_user_settings'], checkIfExists: true))
} }
workflow test_sratools_prefetch_without_settings_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"
input = [
[ id:'test', single_end:false ], // meta map
'DRR000774'
]
SRATOOLS_PREFETCH(input, file('EXISTS'))
}

View file

@ -1,6 +1,3 @@
params.settings_path = '/tmp/.ncbi'
params.settings_file = "${params.settings_path}/user-settings.mkfg"
process { process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }

View file

@ -1,17 +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_PREFETCH {
containerOptions = {
(workflow.containerEngine == 'singularity') ?
"-B ${params.settings_path}:${params.settings_path}" :
"-v ${params.settings_path}:${params.settings_path}"
}
}
}

View file

@ -1,17 +1,5 @@
- name: sratools prefetch test_sratools_prefetch_with_settings_input - name: sratools prefetch test_sratools_prefetch
command: nextflow run ./tests/modules/sratools/prefetch -entry test_sratools_prefetch_with_settings_input -c ./tests/config/nextflow.config -c ./tests/modules/sratools/prefetch/nextflow.config command: nextflow run ./tests/modules/sratools/prefetch -entry test_sratools_prefetch -c ./tests/config/nextflow.config -c ./tests/modules/sratools/prefetch/nextflow.config
tags:
- sratools/prefetch
- sratools
files:
- path: output/sratools/DRR000774/DRR000774.sra
md5sum: 7647dba20c89c0e3d7ad13842f060eb0
- path: output/sratools/versions.yml
contains:
- "sratools: 2.11.0"
- name: sratools prefetch test_sratools_prefetch_without_settings_input
command: nextflow run ./tests/modules/sratools/prefetch -entry test_sratools_prefetch_without_settings_input -c ./tests/config/nextflow.config -c ./tests/modules/sratools/prefetch/nextflow_mount.config
tags: tags:
- sratools/prefetch - sratools/prefetch
- sratools - sratools