refactor: create new settings input

This commit is contained in:
Moritz E. Beber 2022-05-08 16:46:52 +02:00
parent 5d593bdb45
commit d4f13ebfff

View file

@ -9,6 +9,7 @@ process SRATOOLS_FASTERQDUMP {
input: input:
tuple val(meta), path(sra) tuple val(meta), path(sra)
path(ncbi_settings)
output: output:
tuple val(meta), path(output), emit: reads tuple val(meta), path(output), emit: reads
@ -20,16 +21,13 @@ process SRATOOLS_FASTERQDUMP {
script: script:
def args = task.ext.args ?: '' def args = task.ext.args ?: ''
def args2 = task.ext.args2 ?: '' def args2 = task.ext.args2 ?: ''
def config = "/LIBS/GUID = \"${UUID.randomUUID().toString()}\"\\n/libs/cloud/report_instance_identity = \"true\"\\n"
// Paired-end data extracted by fasterq-dump (--split-3 the default) always creates // Paired-end data extracted by fasterq-dump (--split-3 the default) always creates
// *_1.fastq *_2.fastq files but sometimes also an additional *.fastq file // *_1.fastq *_2.fastq files but sometimes also an additional *.fastq file
// for unpaired reads which we ignore here. // for unpaired reads which we ignore here.
output = meta.single_end ? '*.fastq.gz' : '*_{1,2}.fastq.gz' output = meta.single_end ? '*.fastq.gz' : '*_{1,2}.fastq.gz'
""" """
eval "\$(vdb-config -o n NCBI_SETTINGS | sed 's/[" ]//g')" if [[ "${ncbi_settings.name}" != "EXISTS" ]]; then
if [[ ! -f "\${NCBI_SETTINGS}" ]]; then export NCBI_SETTINGS="\$PWD/${ncbi_settings}"
mkdir -p "\$(dirname "\${NCBI_SETTINGS}")"
printf '${config}' > "\${NCBI_SETTINGS}"
fi fi
fasterq-dump \\ fasterq-dump \\