refactor: always output settings

This commit is contained in:
Moritz E. Beber 2022-05-11 14:07:18 +02:00
parent 64ff23f3c1
commit e4551a9ab3
7 changed files with 30 additions and 24 deletions

View file

@ -8,8 +8,8 @@ process SRATOOLS_NCBISETTINGS {
'quay.io/biocontainers/sra-tools:2.11.0--pl5321ha49a11a_3' }" 'quay.io/biocontainers/sra-tools:2.11.0--pl5321ha49a11a_3' }"
output: output:
path('user-settings.mkfg'), optional: true, emit: ncbi_settings path('*.mkfg') , emit: ncbi_settings
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

View file

@ -21,8 +21,8 @@ output:
pattern: "versions.yml" pattern: "versions.yml"
- ncbi_settings: - ncbi_settings:
type: file type: file
description: An optional, minimal NCBI settings file. description: An NCBI user settings file.
pattern: "user-settings.mkfg" pattern: "*.mkfg"
authors: authors:
- "@Midnighter" - "@Midnighter"

View file

@ -31,6 +31,12 @@ else
echo "$(printf '!{config}')" >&2 echo "$(printf '!{config}')" >&2
exit 1 exit 1
fi fi
if [[ "${NCBI_SETTINGS}" != *.mkfg ]]; then
echo "The detected settings '${NCBI_SETTINGS}' do not have the required"\
"file extension '.mkfg'." >&2
exit 1
fi
cp "${NCBI_SETTINGS}" ./
fi fi
cat <<-END_VERSIONS > versions.yml cat <<-END_VERSIONS > versions.yml

View file

@ -37,10 +37,5 @@ workflow test_sratools_ncbisettings_with_bad_existing {
} }
workflow test_sratools_ncbisettings_with_nonexisting { workflow test_sratools_ncbisettings_with_nonexisting {
file(params.settings_path).mkdirs()
def settings = file(params.settings_file)
settings.delete()
SRATOOLS_NCBISETTINGS() SRATOOLS_NCBISETTINGS()
} }

View file

@ -1,17 +1,5 @@
params.settings_path = '/tmp/.ncbi'
params.settings_file = "${params.settings_path}/user-settings.mkfg"
env.NCBI_SETTINGS = params.settings_file
process { process {
publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" } publishDir = { "${params.outdir}/${task.process.tokenize(':')[-1].tokenize('_')[0].toLowerCase()}" }
withName: SRATOOLS_NCBISETTINGS {
containerOptions = {
(workflow.containerEngine == 'singularity') ?
"-B ${params.settings_path}:${params.settings_path}" :
"-v ${params.settings_path}:${params.settings_path}"
}
}
} }

View file

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

View file

@ -1,17 +1,17 @@
- name: "sratools ncbisettings test_sratools_ncbisettings_with_good_existing" - name: "sratools ncbisettings test_sratools_ncbisettings_with_good_existing"
command: nextflow run ./tests/modules/sratools/ncbisettings -entry test_sratools_ncbisettings_with_good_existing -c ./tests/config/nextflow.config -c ./tests/modules/sratools/ncbisettings/nextflow.config command: nextflow run ./tests/modules/sratools/ncbisettings -entry test_sratools_ncbisettings_with_good_existing -c ./tests/config/nextflow.config -c ./tests/modules/sratools/ncbisettings/nextflow_mount.config
tags: tags:
- "sratools" - "sratools"
- "sratools/ncbisettings" - "sratools/ncbisettings"
files: files:
- path: "output/sratools/user-settings.mkfg" - path: "output/sratools/user-settings.mkfg"
should_exist: false md5sum: 955e27aff2c277c2f1f0943a098888c1
- path: output/sratools/versions.yml - path: output/sratools/versions.yml
contains: contains:
- "sratools: 2.11.0" - "sratools: 2.11.0"
- name: "sratools ncbisettings test_sratools_ncbisettings_with_bad_existing" - name: "sratools ncbisettings test_sratools_ncbisettings_with_bad_existing"
command: nextflow run ./tests/modules/sratools/ncbisettings -entry test_sratools_ncbisettings_with_bad_existing -c ./tests/config/nextflow.config -c ./tests/modules/sratools/ncbisettings/nextflow.config command: nextflow run ./tests/modules/sratools/ncbisettings -entry test_sratools_ncbisettings_with_bad_existing -c ./tests/config/nextflow.config -c ./tests/modules/sratools/ncbisettings/nextflow_mount.config
tags: tags:
- "sratools" - "sratools"
- "sratools/ncbisettings" - "sratools/ncbisettings"