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:
tuple val(meta), path(sra)
path(ncbi_settings)
output:
tuple val(meta), path(output), emit: reads
@ -20,16 +21,13 @@ process SRATOOLS_FASTERQDUMP {
script:
def args = task.ext.args ?: ''
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
// *_1.fastq *_2.fastq files but sometimes also an additional *.fastq file
// for unpaired reads which we ignore here.
output = meta.single_end ? '*.fastq.gz' : '*_{1,2}.fastq.gz'
"""
eval "\$(vdb-config -o n NCBI_SETTINGS | sed 's/[" ]//g')"
if [[ ! -f "\${NCBI_SETTINGS}" ]]; then
mkdir -p "\$(dirname "\${NCBI_SETTINGS}")"
printf '${config}' > "\${NCBI_SETTINGS}"
if [[ "${ncbi_settings.name}" != "EXISTS" ]]; then
export NCBI_SETTINGS="\$PWD/${ncbi_settings}"
fi
fasterq-dump \\