refactor: require NCBI user settings always

This commit is contained in:
Moritz E. Beber 2022-05-11 13:02:52 +02:00
parent eae7161a32
commit 0cdf7767a7
6 changed files with 12 additions and 104 deletions

View file

@ -9,7 +9,7 @@ process SRATOOLS_FASTERQDUMP {
input:
tuple val(meta), path(sra)
path(ncbi_settings)
path ncbi_settings
output:
tuple val(meta), path(output), emit: reads
@ -26,9 +26,7 @@ process SRATOOLS_FASTERQDUMP {
// for unpaired reads which we ignore here.
output = meta.single_end ? '*.fastq.gz' : '*_{1,2}.fastq.gz'
"""
if [[ "${ncbi_settings.name}" != "EXISTS" ]]; then
export NCBI_SETTINGS="\$PWD/${ncbi_settings}"
fi
export NCBI_SETTINGS="\$PWD/${ncbi_settings}"
fasterq-dump \\
$args \\

View file

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

View file

@ -5,11 +5,7 @@ nextflow.enable.dsl = 2
include { UNTAR } from '../../../../modules/untar/main.nf'
include { SRATOOLS_FASTERQDUMP } from '../../../../modules/sratools/fasterqdump/main.nf'
workflow test_sratools_fasterqdump_single_end_with_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"
workflow test_sratools_fasterqdump_single_end {
archive = [ [], file(params.test_data['sarscov2']['illumina']['SRR13255544_tar_gz'], checkIfExists: true) ]
UNTAR ( archive )
@ -17,14 +13,10 @@ workflow test_sratools_fasterqdump_single_end_with_input {
def input = Channel.of([ id:'test_single_end', single_end:true ])
.combine(UNTAR.out.untar.map{ it[1] })
SRATOOLS_FASTERQDUMP(input, settings)
SRATOOLS_FASTERQDUMP(input, file(params.test_data['generic']['config']['ncbi_user_settings'], checkIfExists: true))
}
workflow test_sratools_fasterqdump_paired_end_with_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"
workflow test_sratools_fasterqdump_paired_end {
archive = [ [], file(params.test_data['sarscov2']['illumina']['SRR11140744_tar_gz'], checkIfExists: true) ]
UNTAR ( archive )
@ -32,35 +24,5 @@ workflow test_sratools_fasterqdump_paired_end_with_input {
def input = Channel.of([ id:'test_paired_end', single_end:false ])
.combine(UNTAR.out.untar.map{ it[1] })
SRATOOLS_FASTERQDUMP(input, settings)
}
workflow test_sratools_fasterqdump_single_end_without_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"
archive = [ [], file(params.test_data['sarscov2']['illumina']['SRR13255544_tar_gz'], checkIfExists: true) ]
UNTAR ( archive )
def input = Channel.of([ id:'test_single_end', single_end:true ])
.combine(UNTAR.out.untar.map{ it[1] })
SRATOOLS_FASTERQDUMP(input, file('EXISTS'))
}
workflow test_sratools_fasterqdump_paired_end_without_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"
archive = [ [], file(params.test_data['sarscov2']['illumina']['SRR11140744_tar_gz'], checkIfExists: true) ]
UNTAR ( archive )
def input = Channel.of([ id:'test_paired_end', single_end:false ])
.combine(UNTAR.out.untar.map{ it[1] })
SRATOOLS_FASTERQDUMP(input, file('EXISTS'))
SRATOOLS_FASTERQDUMP(input, file(params.test_data['generic']['config']['ncbi_user_settings'], checkIfExists: true))
}

View file

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

View file

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

View file

@ -1,5 +1,5 @@
- name: sratools fasterqdump test_sratools_fasterqdump_single_end_with_input
command: nextflow run ./tests/modules/sratools/fasterqdump -entry test_sratools_fasterqdump_single_end_with_input -c ./tests/config/nextflow.config -c ./tests/modules/sratools/fasterqdump/nextflow.config
- name: sratools fasterqdump test_sratools_fasterqdump_single_end
command: nextflow run ./tests/modules/sratools/fasterqdump -entry test_sratools_fasterqdump_single_end -c ./tests/config/nextflow.config -c ./tests/modules/sratools/fasterqdump/nextflow.config
tags:
- sratools
- sratools/fasterqdump
@ -12,38 +12,8 @@
contains:
- "sratools: 2.11.0"
- name: sratools fasterqdump test_sratools_fasterqdump_paired_end_with_input
command: nextflow run ./tests/modules/sratools/fasterqdump -entry test_sratools_fasterqdump_paired_end_with_input -c ./tests/config/nextflow.config -c ./tests/modules/sratools/fasterqdump/nextflow.config
tags:
- sratools
- sratools/fasterqdump
files:
- path: output/sratools/SRR11140744_1.fastq.gz
md5sum: 193809c784a4ea132ab2a253fa4f55b6
- path: output/sratools/SRR11140744_2.fastq.gz
md5sum: 3e3b3af3413f50a1685fd7b3f1456d4e
- path: output/untar/SRR11140744/SRR11140744.sra
md5sum: 065666caf5b2d5dfb0cb25d5f3abe659
- path: output/sratools/versions.yml
contains:
- "sratools: 2.11.0"
- name: sratools fasterqdump test_sratools_fasterqdump_single_end_without_input
command: nextflow run ./tests/modules/sratools/fasterqdump -entry test_sratools_fasterqdump_single_end_without_input -c ./tests/config/nextflow.config -c ./tests/modules/sratools/fasterqdump/nextflow_mount.config
tags:
- sratools
- sratools/fasterqdump
files:
- path: output/sratools/SRR13255544.fastq.gz
md5sum: 1054c7b71884acdb5eed8a378f18be82
- path: output/untar/SRR13255544/SRR13255544.sra
md5sum: 466d05dafb2eec672150754168010b4d
- path: output/sratools/versions.yml
contains:
- "sratools: 2.11.0"
- name: sratools fasterqdump test_sratools_fasterqdump_paired_end_without_input
command: nextflow run ./tests/modules/sratools/fasterqdump -entry test_sratools_fasterqdump_paired_end_without_input -c ./tests/config/nextflow.config -c ./tests/modules/sratools/fasterqdump/nextflow_mount.config
- name: sratools fasterqdump test_sratools_fasterqdump_paired_end
command: nextflow run ./tests/modules/sratools/fasterqdump -entry test_sratools_fasterqdump_paired_end -c ./tests/config/nextflow.config -c ./tests/modules/sratools/fasterqdump/nextflow.config
tags:
- sratools
- sratools/fasterqdump